Running Your Life With Emacs

Garrett Hopper Problem Solving, Programming, Technology Snapshot Leave a Comment

I program a lot, but I also do a lot of other things using a computer.

The problem is, I often want to use the same efficient key bindings I use while programming when I’m doing other tasks. I want to be writing an email or documentation and edit a code snippet in the same way I normally edit code. I want to manage Git repositories right from my editor without having to touch the mouse. I want to browse the web in my editor, so I can easily copy code examples and run them. I want to track my to-do lists and the amount of time spent on each task.

Imagine if there was a tool that could do all that and a ton more in an efficiently consistent way. There is, and that tool is Emacs.

In this blog, I give a brief introduction to my favorite tool Emacs and show how it saves me hours daily as a developer.

Efficiency

As someone who spends a lot of time at a computer, any small improvement to my workflow compounds over time. Switching to Emacs is the biggest efficiency boosts I’ve ever had. Most GUI applications have plenty of shortcuts, however, most don’t follow any sort of consistency between them.

When I switch between Firefox and an IDE, few (if any) key bindings are consistent between the two. Emacs, however, excels at having consistent key bindings between disparate modes. Key bindings can also be easily re-mapped in a central location to make my entire workflow consistent and seamless.

Context switching between programs is a thing of the past. I can copy the code I’m editing in one buffer into an email in another and continue using the same key bindings to edit it while I write feedback to the author. I can do absolutely everything without ever having to touch the mouse. Where others would need to reach for a mouse and go search through menus to find the functionality they need, I can search for it by name and learn the key binding for future use. Where others would need to reach for the mouse to begin editing settings, I can open my config file and write a few lines of code to make my editor do exactly what I want.

There are some great IDEs and other tools out there which are highly configurable and efficient, but in my opinion, none will ever come close to Emacs. Using Emacs easily saves me hours every day.

Customizability

Everything in Emacs can be customized. Any text you see on your screen can be modified (from changing the color or font to making it blink and be bold). Every function in Emacs can also be modified; if you don’t like the way something works, you can change it. Even some of the most low-level functions used by Emacs can be modified on the fly.

See Also:  Refreshing Your Scrum

If you can imagine something you would want to modify, it can be modified with a little bit of EmacsLisp. Change some configuration, evaluate it, test it, repeat. Some editors allow plugins and the like, but most don’t allow on the fly modification. I can make a change to a function and evaluate it, and the next time it’s run, my new version will be used. This is possible thanks to the amazing power of Lisp.

Emacs is the most powerful editor ever made because anything that can be written in EmacsLisp can be run on Emacs. That means I can have my email client, browser, to-do manager, music player, terminal emulator, etc. all in the same program and perfectly integrated with each other.

Self-Documenting

Emacs is self-documenting. At any time, I can search for a function and see what keys are bound to it, find what function a key binding executes and edit it, or find the documentation for a variable. If there’s any variable or function I don’t understand, it’s easy to jump to where it’s defined and find where/how it’s used to understand it.

There’s no more need to switch back and forth between a browser and my editor while reading the settings’ documentation. Sometimes I’ll be in the middle of editing, realize my editor isn’t behaving exactly how I want, run a quick search for some variables/functions that will change that behavior, write some quick EmacsLisp, and move on with my editing.

Programming

Emacs is ostensibly a programmer’s tool, and it is. Emacs, as a text editor, is amazing at exactly what you would think: editing text.

I personally prefer to be Evil and run Vim emulation on top of it to make it even better. Almost every programming language has either a built-in mode or a package you can install that provides most of your IDE’s abilities. If you want the ability to do refactoring or debugging in your language of choice, you’re probably able to with Emacs.

Packages

There are some amazing packages available for Emacs that do almost everything you can imagine.

There are packages for editing every file format you can imagine complete with syntax highlighting and file-type specific functions.

See Also:  Angular and Swagger: Experiences Learned

There’s a REST client package that behaves similar to Postman and creates curl commands under the hood.

There’s a package for spell checking and another for looking up words in a dictionary or thesaurus.

There’s even a package to make Emacs a window manager. That’s perhaps a bridge too far for some, but instead of having some sort of desktop environment (Unit, GNOME, KDE, KFCE, etc.) or even a small window manager (i3, Awesome, XMonad, Openbox, etc.), I can let Emacs manage my windows for me. This lets me tie the management of my windows into the rest of my workflow allowing me to manage my processes with non-Emacs programs more efficiently.

These packages often times have some of the most well thought out UXs I’ve seen. Magit, for example, is the best Git client ever. It’s better than whatever GUI you may be using, and it’s even better than the Git CLI itself. Nothing is able to come close to the ease and simplicity it offers when doing even the most complicated Git operations.

If you can imagine something, there’s probably an Emacs package to do it.

*Org*anizing

Emacs Org-mode is the feature that finally brought me over to the dark side from Vim. Org-mode is a combination of a markup file format (like markdown) and an Emacs package. The file format is just plain text and can be edited in any editor, but when used with the Emacs package, it’s more powerful.

Though, I would argue that even without Emacs, it’s a better markup format than markdown. The Emacs package provides tons of abilities such as: expanding/collapsing large trees of information, modifying dates in a consistent format, flagging headings as TODO/DONE, editing tables, tracking time, etc. Most of my life is organized in Emacs Org-mode files.

Conclusion

At this point, whenever I have to open up another application, I begin to cry inside as I reach for the mouse and wonder why Emacs hasn’t consumed this task yet. Using Emacs feel like talking directly to the heart of my computer.

I encourage you to give it a try!

What Do You Think?