Welcome to my Mastering Emacs reading guide. Here’s a selection of articles that cover a variety of topics that will make you better at Emacs.
I’m New to Emacs
If you’re a complete beginner to Emacs, then you should start out by first reading the built-in tutorial (type
C-h t) and then read my Beginner’s Guide to Emacs. Unlike the builtin tutorial, my tutorial is more about explaining terminology and getting to grips with a handful of core concepts that Emacs revolves around, interspersed with a selection of practical advice:
- How do you customize Emacs?
- How can I make cut/copy/paste work like other editors?
- How do I load Emacs packages I found on the Internet?
- Why you shouldn’t use the terminal to edit your code (unless you must)
- Avoiding bad Emacs habits that people keep promulgating
… and much more.
Next on the list is my very detailed guide to effective editing and movement in Emacs. In it, I explain all but the most esoteric “movement” commands available, out-of-the-box, in Emacs. I highly, highly recommend you read this next. One of the hallmark advantages of Emacs is its stellar movement and editing support. So if you’re ready slip the surly bonds of arrow key movement and gee up your keyboard skills, you should read this article next.
I’d consider those two articles a key part in advancing your Emacs skills. My book, Mastering Emacs, is even more detailed, and at 314 pages will take you from being a complete novice to knowing everything you’d want to know about Emacs to get on with your work. Unlike the article on movement, the book goes into editing and workflow also, and how everything fits neatly together.
Emacs 26 onward put a lot of emphasis on improving the user experience of Emacs’s builtin completion mechanism. However, as great as it is now, you may want to try something altogether different. Although there’s a large corpus of third-party packages that modify how you find things in Emacs, I still think my Introduction to IDO Mode article is a good place to start, if you’re wondering what it means to switch completion mechanisms — or, indeed, why you should!
Customization is the corner stone of Emacs. No other editor – no other editor – has the flexibility and extensibility offered by Emacs. Once you’re comfortable using the
M-x customize GUI in Emacs you’re probably itching to customize Emacs’s keybindings – the one thing you cannot easily do, and persist to your Emacs init file, without getting your hands dirty. My article on Mastering Key Bindings in Emacs explains, well, everything you’d care to know about binding keys in Emacs. I also include handy templates for the most frequent key binding tasks you’ll encounter, so it’s easy to copy the example code and modify it to suit your needs.
Emacs’s built-in Info system is the same as the one that powers Linux’s info manuals, but with one key difference: the Emacs Info browser is miles ahead of the old, crusty commandline viewer. If you’re not sure where to find something, you can use apropos with info to full text search all the Info documents.
Why Emacs is the way it is
There’s a lot to be said – and a lot has been said – about why Emacs behaves the way it does; why its terminology and user experience is the way it is; and whether it’s worth changing Emacs to be more like “modern” editors and IDEs.
I believe Emacs is broadly fine the way it is, and that Emacs’s way of doing things is eminently sensible once you understand why. So, if you’re wondering why buffers are called buffers in Emacs, you should read Why Emacs has Buffers — understanding why is a key part to understanding Emacs.
I want to Customize Emacs
Emacs has a wealth of built-in customization toggles, dials and switches; but unfortunately not everything is configurable through a UI. Here’s a handful of articles where I talk about changing some aspect of Emacs to make it better, more productive or easier to use.
The first thing to read is my article on Keyboard Macros are Misunderstood. In it, I explain how you can use Emacs’s keyboard macro recorder to do more than just edit text. You can configure window layouts, execute commands in shells, and all of it automated at the press of a key — no elisp required!
If you dislike distractions then you may want to disable some prompts in Emacs. The prompts are useful, yes; and they serve a purpose, yes; but they have a habit of driving you insane after a while.
The next simple change is to make tooltips appear in the echo area. Very useful if you’re a keyboard person and don’t use a mouse. Along a similar vein, you can make Emacs start up maximized so as to save you the hassle of maximizing Emacs manually.
If you’re using a Window system you can force Emacs to move deleted files to the trash can
Elisp underpins all aspects of Emacs in ways that no other editor can ever really approximate. Almost everything you see, and interact with, in Emacs is written in Elisp. So here’s a handful of Elisp-focused articles:
First up is how to evaluate the code you’re writing. You have a panoply of choices, and they’re all important to know about. A surprising number of experienced Emacs hackers don’t know that Emacs has a REPL, like Python, that lets you interactively evaluate elisp. So Evaluating Elisp Code in Emacs is essential reading!
Interacting with external programs – inferior processes in Emacs parlance – is a common, and diverse, activity that you may find yourself on the bleeding edge of technology and without an Emacs package to help you do this. My article on writing a Comint interpreter for cassandra is a good first step in the right direction.
diminish.el accomplish a lot of the same, I wrote about how you can hide stuff in your modeline with a little bit of elisp.
Here’s how you can use some advanced colorimetric features from from
color.el to sort colors by how perceptively similar they are to other colors. It’s a niche use, but once that shows how you can combine disparate features of Emacs to achieve something novel.
Emacs’s input methods are meant for Serious Stuff like inserting accented characters. But you can use it to build emoji from text much like what you can do in modern chat apps. It’s another (simple!) example that demonstrates the power of Emacs.
Although it’s a common thing to do nowadays, back in the day when
use-package first came out, it was a rather novel thing. I briefly go over how to use use-package and why you’d use it.
Emacs 28 adds a cool Elisp cheat sheet. New or expert alike, you should know about the cheat sheet feature.
Emacs has a fantastically advanced reverse-polish notation, symbolic calculator. I cannot even begin to tell you how many things you can do with this. So here’s how you can use it programmatically to convert geographic coordinates — even if that is not something you need, it’ll serve as inspiration.
These articles set out to improve productivity in some way. This may involve changing key bindings, copying some elisp code or explaining an underused feature.
First up is how to master the mysterious and, sadly, under-documented shell replacement, Eshell, a shell written entirely in Elisp.
You can find files faster by remembering recently used files and hotwiring it so it uses IDO mode to display the files.
Next on the list is finding stuff faster using occur, a very handy feature that searches an open buffer for a regexp of your choosing. I also show how to extend occur to make it more useful for searching multiple buffers at once.
Another massive productivity booster is learning how to execute shell commands in Emacs and how to pipe input from a buffer and output from the command in and out of Emacs. Amazingly useful – especially if you’re good at commandline-fu and want to apply your one-liners to Emacs buffers.
Once you’re comfortable invoking commands in Emacs, why not use Emacs’s own terminal emulators or some of its shell support? My article on running shells in Emacs will put you on the right path.
Doing the same thing over and over again is normally a job for a macro; but what if you just want to repeat the last command?
The dired functionality in Emacs is great, but it only works on one directory at a time. So what if you want to work on multiple files spread out over many directories? Why, you use dired’s find file functionality.
If you interact with buffers in emacs, you should know about the many secret comint history commands as they replicate – with an Emacs twist – some of the history commands you may know from tools like
Some things are best kept a secret: your logins and passwords, or that Matlock screenplay you’re secretly working on. Emacs can automatically, and transparently, encrypt and decrypt files with
GPG. Keeping secrets in Emacs has never been easier.
Working with Text
This is where Emacs starts to shine. Manipulating text. Other users of inferior editors invariably reach for a scripting language or a commandline tool to perform all but the most banal text manipulation tasks.
First up is sorting text in Emacs. But actually, Emacs can do more than just sort by line. Check it out. Useful knowledge to have.
If you’re a fan of regular expressions, you should be using re-builder, Emacs’s regular expression builder. Even if you’re a skilled regex guy, it will come in handy occasionally.
Converting between tabs and spaces is a useful thing to know, regardless of whether you’re in this camp or that camp.
If you find yourself switching between keyboard layouts, you should try using Emacs’s input methods. They’re terrific and unobtrusive. How to insert diacritic marks with input methods is a good place to start.
Emacs’s search and replace is capable of applying evaluting elisp forms which opens up a whole new world of opportunities.
IEdit does multi-cursor text editing and it’s really simple and easy to use.
I’ve written about text expansion with hippie expand, a smart text expander that tries to do the right thing. And hot on the heels of that, I’ve also written about auto-correcting typos with abbrev.
These articles cover very specific tasks in great detail, and they use a variety of commands and concepts, including elisp code where necessary. If you’re looking for examples of how to apply all your new-found knowledge in new and interesting ways, these articles can help.
Here’s a very common problem people encounter: how do you trim blank or whitespaced lines?
If you regularly use network commandline tools like
ping, etc. you should try Emacs’s network utility wrappers.
Poring over log files or structured data is a big part of our lives, whether you work in technology or not. Emacs can highlight text based on patterns for you. It’s an essential feature to know about.
You can switch Emacs’s
M-x dired to a WDired, an editable dired mode and edit a dired buffer inline as though it were a normal buffer. Great for bulk renaming files. Combine it with dired’s find file functionality and supercharge your bulk file handling!
top when you can use Emacs’s proced and handle process management from inside Emacs? (Oh, and it works fine on Windows, too!)
Add a bit of levity and fun to your life with Emacs’s many builtin games and game-like tools. Try the text adventure game – it’s great.