Full list of Tips, Tutorials and Articles

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.

Keyboard Shortcuts every Command Line Hacker should know about GNU Readline

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.

Securely Generating TOTP tokens with Emacs

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.

Wordsmithing in Emacs

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.

Demystifying Emacs's Window Manager

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.

Fuzzy Finding with Emacs Instead of fzf

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

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!

Understanding Minibuffer Completion

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.

Mastering Emacs is now available in Japanese

Thanks to the hard work of USAMI Kenta and AYANOKOJI Takesi you can now read Mastering Emacs in Japanese!

Why Emacs has Buffers

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's Builtin Elisp Cheat Sheet

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.

Correcting Typos and Misspellings with Abbrev

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.

Text Expansion with Hippie Expand

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.

The Emacs 28 Edition of Mastering Emacs is out now

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.

What's New in Emacs 28.1?

Learn what's new in Emacs 28.1

Bad Emacs Advice

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.

Inserting Emoji with Input Methods

The input-method feature, usually reserved for inserting diacritics and symbols, can be repurposed to insert emoji.

Tree Sitter and the Complications of Parsing Languages

I talk about tree sitter, CEDET, and Combobulate -- my "paredit-style" package that's designed to work with most programming languages.

The Emacs 27 Edition of Mastering Emacs is out now

I've released the third edition of my book, Mastering Emacs, with additional content and changes covering Emacs 27.

Unicode, Ligatures and Color Emoji

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.

What's New in Emacs 27.1?

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.

Speed up Emacs with libjansson and native elisp compilation

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.

Polymode: Multiple Major Modes and How to Use SQL and Python in one Buffer

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.

What's New in Emacs 26.1

After a long wait Emacs 26.1 is out and it's full of cool new features and tweaks.

Shell & Comint Secrets: History commands

Shell & Comint Secrets: History commands

Fun and Games in Emacs

A text adventure game; the game of life; tetris; and a psychoanalyst. They are just some of the fun and games in Emacs.

What's New in Emacs 25.1

I talk about the latest version of Emacs 25 and what new features and changes it brings.

Keeping Secrets in Emacs with GnuPG and Auth Sources

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

One year anniversary of my book Mastering Emacs

Spotlight: use-package, a declarative configuration tool

Learn about use-package, a declarative way of configuring packages that ensures you'll never go through ".emacs bankruptcy" ever again.

Spotlight: Flycheck, a Flymake replacement

Spotlight on Flycheck, an excellent as-you-type syntax checker.

How to write a book in Emacs

How to write a book in Emacs

Announcing my new Mastering Emacs book

I announce that I am working on a Mastering Emacs ebook

Swapping quote symbols in Emacs with parse-partial-sexp

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.

dirswitch.el: a fish shell-style directory switcher for shell-mode

How to quickly switch directories like fish shell in Emacs's own shell wrapper.

Displaying and Interacting with processes using Proced

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 Shell Commands: The find & xargs replacement

Dired comes with a powerful batch tool that replaces find and xargs with a far more powerful yet easier to use interface in Dired.

My Emacs keybindings

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.

What's New In Emacs 24.4

Discover what's new in Emacs 24.4 as I annotate most of the changes made to the new Emacs version.

discover.el: discover more of Emacs using context menus

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.

An introduction to Magit, an Emacs mode for Git

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.

Smart Scan: Jump between symbols in a buffer

This simple package jumps between symbols that match the ones point is on.

WDired: Editable Dired Buffers

Dired buffers can be made editable, and both filenames and permission bits can be edited like plain text.

Comint: Writing your own Command Interpreter

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

What's New in Emacs 24.3. I annotate the NEWS file and explain some of the changes made.

Evaluating Lisp Forms in Regular Expressions

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.

Fun with Vimgolf 4: Transpositioning text with Tables

How to transposition text in Emacs by using Org-mode's table capturing functionality and regular expressions.

Fun with Vimgolf 3: Swapping Words by Sorting

How to swap words in Emacs using regular expressions and Emacs's advanced sort-regexp-fields.

Jedi: A completion library for Python

How to use Jedi, an advanced completion library for Python with a handy Emacs wrapper.

IEdit: Interactive, multi-occurrence editing in your buffer

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

Hiding and replacing modeline strings with clean-mode-line

Working with Coding Systems and Unicode in Emacs

Hwo to force Emacs to always use UTF-8 or other coding systems when you open files or interact with processes.

Compiling and running scripts in Emacs

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.

Fun with Emacs Calc

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.

PComplete: Context-Sensitive Completion in Emacs

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.

Find nearest colors in Emacs 24

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.

What's New in Emacs 24 (part 2)

Part two of my annotated NEWS file for Emacs 24

What's New In Emacs 24 (part 1)

Part one of my annotated NEWS file for Emacs 24

Which Function Mode

If you regularly lose track of the current function your point is in, then give the Which Function mode a try.

Fun with Vimgolf 2: Sum your vimgolf rank

How to use Emacs's increment register, query replace regexp and elisp forms in the regexp replace prompt to sum numbers

Fun with Vimgolf 1: Alphabetize the Directory

How to categorize and sort a directory of names and addresses using Org-mode and Org-mode's sorting function.

Executing Shell Commands in Emacs

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.

Full text searching in Info mode with Apropos

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.

Searching and Editing in Buffers with Occur Mode

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.

Repeating Commands in Emacs

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.

Sorting Text by Line, Field and Regexp in Emacs

How to sort text in Emacs using sort-fields, sort-numeric-fields and sort-regexp-fields --- all powerful and advanced sorting commands.

re-builder: the Interactive regexp builder

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.

Working with multiple files in dired

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.

Removing blank lines in a buffer

How to remove blank lines and leave just one blank line in a buffer.

What's New in Emacs 23.3

What's new in Emacs 23.3

Using the commandline network utilities from Emacs

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"

How to mark a buffer as "not modified"

Mastering Key Bindings in Emacs

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.

Find files faster with the recent files package

How to use and augment Emacs's recentf recent files package with IDO mode to quickly find files you've visited before.

Make script files executable automatically

Quick trick to force all shell scripts to have the execute bit set on file save

Effective Editing I: Movement

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!

Making deleted files go to the trash can

Make Emacs move deleted files to the trash instead of physically deleting them.

Fixing the mark commands in transient mark mode

Making the mark commands more useful in Emacs by altering the behavior of push-mark and jump to mark

Mastering Eshell

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.

Converting between tabs and whitespace

How to convert tabs to whitespaces, or a succession of whitespaces into tabs

Evaluating Elisp in Emacs

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.

Disabling Prompts in Emacs

How to get rid of annoying prompts in Emacs for a smoother, less intrusive experience.

Making CamelCase Readable with Glasses-Mode

Making CamelCase Readable with Glasses-Mode

Running Shells and Terminal Emulators in Emacs

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?

Maximizing Emacs on startup

How to maximize Emacs on startup.

Making tooltips appear in the echo area

Make tooltips appear in Emacs's echo area instead of in a popup.

Olé! Diacritics in Emacs

How to use input methods and unicode character insertion to insert unicode code points and diacritics.

Highlighting by Word, Line and Regexp

How to highlight phrases, regular expressions and lines with highligh-phrase, highligh-regexp and highlight-lines-matching-regexp.

Introduction to Ido Mode

A thorough introduction to IDO mode, a flexible and very powerful completion package for Emacs.

An Emacs Tutorial: Beginner's Guide to 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.