What is this? I’ve liked many things throughout the years. While some have fallen out of my attention, others remain firmly cemented in my memories and feelings. So, I’ve decided to start a mini-series where each week (hopefully), I pick something random that I like or have liked and discuss it, why I like it, and its impact on me. These things can be varied, and range from more trivial matters such as my favourite animal, to books, games, and movies I’ve liked, to topics that have shaped who I am as a person. The posts, accordingly, will vary in length. See my rating system here.
Welcome back to the first TIL in nearly a year. Yikes.
Today we’ll be talking about a tool that is nowadays pretty obscure, but still a favourite of many: the venerable Emacs text editor (?).
Emacs is a family of text editors, originally beginning as a set of “Editor MACroS” and gradually organically growing into an extensible productivity environment. Nowadays, it mainly refers to GNU Emacs, the predominant variant. The trademark feature of Emacs editors is their extensibility, any aspect of the environment of the program can be examined and adjusted on-the-fly. This is thanks to the program’s use of Emacs Lisp as an extension language.
Examples of things that have been done in Emacs:
- Emulating vi keybindings (evil-mode)
- Reading Atom/RSS feeds (elfeed)
- Support for Microsoft’s language server protocol, bringing automatic support for many newer programming languages (lsp-mode)
- Transparently access and develop on a remote system (tramp, built-in)
- Various games like tetris (built-in)
- Git frontend (magit)
- Note-taking and life-organization (org-mode)
- magit and org-mode are apparently so life-changing that people switch to Emacs just to use it. I’m not there yet, though.
- An X11 window manager, which is particularly mind-bending (exwm)
Given all this, a common joke is that Emacs is an operating system, and it simply needs a good text editor (which evil satisfies).
Why and How I Use Emacs
I was first introduced to Emacs when a classmate in school used it in front of us while collaborating, and I thought Magit was super cool. Afterward, I dabbled with it here and there, but only starting to flesh out my setup the past few months or so. Besides IntelliJ for Java (Minecraft Modding), I’ve switched to Emacs for all programming, text editing, and Atom/RSS feed reading.
Why is Emacs attractive to me? It’s simply because I prefer it to the alternatives:
- Atom: Electron, I used it at Facebook the previous two summers and it’s painfully slow (though that might be the heap of internal plugins we had on top). Even outside of Facebook, though, its performance is a common criticism.
- VSCode: Good in a pinch, fast for an Electron app, and quite extensible to boot. However, I still find Emacs a better use of resources and more extensible.
- Vi/vim: Ergonomic keybindings, but nowhere near as extensible. My thought process is: I can get the best parts of vim (the bindings) in Emacs, so why use vim itself?
- Spacemacs: Cheating a bit since Spacemacs is a heavily customized Emacs, but I’ve tried Spacemacs before and didn’t like how bloated it felt. I’d much rather start with a bare Emacs and build it up from scratch to only have what I need.
Additionally, I love how discoverable it is. One thing most complex programs do very poorly is providing a way for users to discover what is even possible to do. This is something I enjoy in IntelliJ as well. If I don’t know the binding or shortcut to do something, I press Ctrl-Shift-a, type in what I want to do, and nine times out of ten what I want pops up, along with a tooltip teaching me where it can be found in the future.
Emacs has the same thing. For example, I’m typing this in markdown-mode in Emacs right now, and I forgot the binding to insert a list element. I can simply type Alt-x to bring up a search list of commands, and type “markdown insert list”, and there the function is. Like IntelliJ, it also shows the keyboard shortcut currently bound, so I can use it directly next time.
The same can be done with configuration variables, using Ctrl-h v, allowing me to discover interactively what options are available in my environment.
At the time of writing, here’s all the plugins I have installed and what they’re for:
- helm: Provides better searching in many environments, like Alt-x.
- spacemacs-theme: I don’t like spacemacs' setup, but the theme is pretty sweet
- lsp-mode, company-lsp, lsp-ui, flycheck: Support utilities for programming in languages that support LSP
- go-mode, typescript-mode, markdown-mode, rust-mode, tuareg, auctex: Syntax highlighting and shortcuts for various languages
- rainbow-delimiters: Changes the colors of nested braces, brackets, and parentheses to easily tell where you are. Good for lisp-family languages.
- elfeed: Atom/RSS feed reader
In the future, I’d like to explore the following more:
- Org-mode: My notes folder is just a loose collection of text and markdown documents right now, and with a little work I think I could switch it all to org-mode, whose virtues have been extolled by many.
- Common Lisp (SLIME) and Clojure (CIDER) programming: Lisp family programming naturally belongs in Emacs, but I haven’t had much opportunity or motivation to do more of either recently.
TIL Rating: 2.8. I’m not involved that heavily in the community, but my usage and reliance is growing with time.