This page holds all the tips, tutorials, and articles I have ever written on Emacs. The page is automatically updated when I add new articles so feel free to bookmark it to return to it at a later date.
Most command line programs that offer line editing -- like bash, Python, GDB, psql, sqlite and more -- do so using GNU readline. Readline's a powerful library that grants history, completion, movement and editing to programs that use it --- and a stable and consistent set of keyboard shortcuts. Shame, then, that even serious command line hackers never bother learning about its capabilities, as they can supercharge your command line productivity.
If you're tired of reaching for your smartphone authenticator or key fob to type in a TOTP, or Time-Based One-Time Password, then why not use Emacs to generate them for you instead? Combine it with auth sources and GPG, and you can securely encrypt the master keys at the same time.
Emacs has long had a competent spell checker, and it's capable of distinguishing code from prose, which is useful to many. But Emacs 28 adds a compelling dictionary lookup feature that warrants a much closer look.
Learn how to take control of Emacs's roundabout window placement. There's method to its madness, but that does not mean you have to put up with it! In this article I'll demystify how Emacs's window manager works and how you -- with a bunch of templates and examples -- can build IDE-like paneling; prevent annoying popup windows; or promote tab-based workflows.
fzf is a popular tool among command line hackers. But if you're an Emacs user, it's hard to use as it requires an interactive terminal. What if you could use Emacs to do the fuzzy finding instead of fzf?
Keyboard macros are misunderstood: they are not just for text editing. You can record and play back nearly anything, so why not record your favorite window layouts and save them as a keyboard macro? Maybe open a shell and execute a few commands in it? And best of all, you can do all of this without knowing any elisp!
Minibuffer completion is one of the most-used features in Emacs. It touches on all aspects of what you do daily -- finding files, buffers, symbols, you name it -- and if you long ago switched to a non-standard completion framework, or abandoned any attempt to customize it, you'll have missed out on 10 years of improvements.
Thanks to the hard work of USAMI Kenta and AYANOKOJI Takesi you can now read Mastering Emacs in Japanese!
Emacs's buffers are so much more than their name implies. They're not just a vessel for you to read or write from. Buffers in Emacs host network processes, shells, and transient data. They're also a key part to understanding why Elisp is designed the way it is.
Emacs now has a builtin cheat sheet for a large swathe of common elisp functions. If you can't remember exactly how to do something, then this is a great place to look for it first.
Abbrev is one of Emacs's oldest (and simplest) text expander tools. Here's how you can use it to auto-correct typos and misspellings.
Hidden away in a dusty corner is Hippie Expand, a much superior text expansion tool to Dynamic Abbrev. Hippie can expand words and lines it has seen before; filenames and filepaths; and much more.
To celebrate the release of Emacs 28, I have updated my book to include features and changes I deem are relevant to readers of my book.
Learn what's new in Emacs 28.1
Most Emacs advice you'll find on the internet is largely good, and will improve your Emacs abilities, but people do occasionally share outright bad advice that harms your learning.
The input-method feature, usually reserved for inserting diacritics and symbols, can be repurposed to insert emoji.
I talk about tree sitter, CEDET, and Combobulate -- my "paredit-style" package that's designed to work with most programming languages.
I've released the third edition of my book, Mastering Emacs, with additional content and changes covering Emacs 27.
Emacs 27 adds -- and Emacs 28 refines -- Emacs's text shaping engine. Thanks to those advancement, Emacs is now capable of rendering color emoji and ligatures.
Emacs 27.1 is out and it brings with it a wealth of cool changes, including fast JSON; improved text shaping engine; and a lot of cool tweaks and additions to existing features.
Native compilation is ship-shape and Bristol fashion, and available in Emacs 28 and onwards. But what does that mean for you? A much faster Emacs experience! You'll have to compile Emacs yourself to benefit from this, and I'll show you how.
Multiple major modes in the same buffer is a real problem in Emacs, but polymode solves it elegantly. I show -- with a handful of lines of code -- how you can get SQL highlighting in Python strings.
After a long wait Emacs 26.1 is out and it's full of cool new features and tweaks.
Shell & Comint Secrets: History commands
A text adventure game; the game of life; tetris; and a psychoanalyst. They are just some of the fun and games in Emacs.
I talk about the latest version of Emacs 25 and what new features and changes it brings.
Good security hygiene is hard to come by, especially when the tools and systems are hard or cumbersome to use. But Emacs is capable of transparently encrypting and decrypting files so you can safely store and read encrypted data, knowing it's encrypted at rest, thanks to GPG. Here's how.
One year anniversary of my book Mastering Emacs
Learn about use-package, a declarative way of configuring packages that ensures you'll never go through ".emacs bankruptcy" ever again.
Spotlight on Flycheck, an excellent as-you-type syntax checker.
How to write a book in Emacs
I announce that I am working on a Mastering Emacs ebook
How to swap quote symbols by writing elisp code that uses Emacs's syntax tables and internal functions like syntax-ppss and parse-partial-sexp.
How to quickly switch directories like fish shell in Emacs's own shell wrapper.
Learn how to use Emacs's advanced process monitor, proced, and how it can replace both ps and top for all but the most esoteric of queries.
Dired comes with a powerful batch tool that replaces find and xargs with a far more powerful yet easier to use interface in Dired.
Rebinding keys in Emacs is very common, but I have only done it for a handful of the most essential keybindings. Here I explain what they are and why I have done it.
Discover what's new in Emacs 24.4 as I annotate most of the changes made to the new Emacs version.
Learn how to discover more of Emacs by using this popup system that unintrusively explains how to use various hidden corners of Emacs such as the registers, isearch and Dired.
Learn how to use Magit, an essential tool for any git-loving Emacs user. Magit supercharges your git workflow by removing the tedium of writing arcane commands and replacing them with a simple and ergonomic user interface.
This simple package jumps between symbols that match the ones point is on.
Dired buffers can be made editable, and both filenames and permission bits can be edited like plain text.
Comint is a low-level library that handles all process and network interactions in Emacs. Here's how you write your own from scratch, using Cassandra as the template program.
What's New in Emacs 24.3. I annotate the NEWS file and explain some of the changes made.
Search & Replace in Emacs is powerful enough with regular expressions, but you can also use LISP forms to augment the replace functionality, enabling advanced replacement like adding up numbers.
How to transposition text in Emacs by using Org-mode's table capturing functionality and regular expressions.
How to swap words in Emacs using regular expressions and Emacs's advanced sort-regexp-fields.
How to use Jedi, an advanced completion library for Python with a handy Emacs wrapper.
How to interactively edit the same symbol in both the local function and globally in a buffer using iedit.
Hiding and replacing modeline strings with clean-mode-line
Hwo to force Emacs to always use UTF-8 or other coding systems when you open files or interact with processes.
Whether you're compiling code, running unit tests or interacting with a program that you frequently need to rerun, the compile feature in Emacs is designed for this very purpose.
Emacs's symbolic calculator engine is very advanced, and here I show how you can use it to convert latitude and longitude to hours, minutes and seconds.
The usual shell completion mechanisms don't work in Emacs. That's a problem if you want TAB-completion in Emacs's EShell or Shell mode. Luckily, there's an Emacs-specific feature called PComplete that does just that. Here's how it works, and how to extend it.
Emacs 24 ships with a color distance function, but it is not exposed to the user. I show how to use thing-at-point to find the HTML hexadecimal color string at point.
Part two of my annotated NEWS file for Emacs 24
Part one of my annotated NEWS file for Emacs 24
If you regularly lose track of the current function your point is in, then give the Which Function mode a try.
How to use Emacs's increment register, query replace regexp and elisp forms in the regexp replace prompt to sum numbers
How to categorize and sort a directory of names and addresses using Org-mode and Org-mode's sorting function.
Instead of switching to your favorite shell to do some light command line-fu, why not ask Emacs to call out to your favorite shell programs instead? You can feed all or parts of your buffer through a program and capture the output in Emacs.
If you're not sure exactly what you are looking for, then help is at hand. Emacs's apropos system is a wide-ranging set of commands that wildcard searches everything Emacs knows about, from Info manuals to variables and commands.
Occur mode is the right tool for the job when you want to show all lines matching a certain regular expression. And if that's not enough, you can even edit the matching lines and commit the changes to the original buffer.
How to repeat the last executed command in Emacs and how to convert the last executed command in Emacs to a complex command you can store for later use.
How to sort text in Emacs using sort-fields, sort-numeric-fields and sort-regexp-fields --- all powerful and advanced sorting commands.
Even if you're a wizard at regular expressions, you may occasionally want a little help. Emacs's regexp builder highlights matches and capturing groups in a buffer of your choice, and it works with a range of regular expression flavors.
If you want to work on files across directories on the command line, you reach for find and xargs. But if you want to use Emacs, then you'll have to use Emacs's dired wrapper around find.
How to remove blank lines and leave just one blank line in a buffer.
What's new in Emacs 23.3
How to use Emacs's selection of commandline utilities, including: ifconfig, netstat, arp, traceroute, ping, dig and more
How to mark a buffer as "not modified"
Creating or altering key bindings in Emacs is an elusive task for new Emacs users, as you're forced to write elisp. Learn how to create key bindings from scratch, or simply use some of my ready-made templates to get you started.
How to use and augment Emacs's recentf recent files package with IDO mode to quickly find files you've visited before.
Quick trick to force all shell scripts to have the execute bit set on file save
There's a lot to learn in Emacs, and movement is just one of the many skills you must hone on your path to Emacs mastery. Movement is perhaps even more important than editing: most of us spend our time reading, analyzing and searching − so knowing how to do it effectively is all-important!
Make Emacs move deleted files to the trash instead of physically deleting them.
Making the mark commands more useful in Emacs by altering the behavior of push-mark and jump to mark
Emacs has a shell written entirely in Emacs Lisp. Here's how you master Eshell, a versatile and powerful shell capable of supplanting bash or zsh as your daily driver.
How to convert tabs to whitespaces, or a succession of whitespaces into tabs
You can't do much with Emacs Lisp if you can't evaluate the code you've written. Here I explain all the myriad ways of doing so: from evaluating one liners anywhere in Emacs, all the way up to a full-blown REPL.
How to get rid of annoying prompts in Emacs for a smoother, less intrusive experience.
Making CamelCase Readable with Glasses-Mode
One of Emacs's strongest capabilities is its ability to talk to external shells, like bash, or emulate an entire terminal. But this being Emacs, you have more than one choice to choose from − and which choice is right for you?
How to maximize Emacs on startup.
Make tooltips appear in Emacs's echo area instead of in a popup.
How to use input methods and unicode character insertion to insert unicode code points and diacritics.
How to highlight phrases, regular expressions and lines with highligh-phrase, highligh-regexp and highlight-lines-matching-regexp.
A thorough introduction to IDO mode, a flexible and very powerful completion package for Emacs.
Once you finish Emacs's tutorial, you're left with more questions than answers. In this beginners' tutorial to Emacs, I'll show you how to customize Emacs; how to get around and ask Emacs questions; and how to spot (and avoid) picking up bad habits.