↓ Skip to main content

Emacs Survival Guide

2- User Input & Text Navigation (Emacs Survival Guide)

·9 mins· loading · loading
Introduction With the terminology covered and your configuration ready from Part 1, it's time now to build your muscle memory. Navigating Emacs entirely by keyboard has no real shortcuts; it just requires patience, consistency, and a lot of practice. I can't promise you that you will memorize all of the keybindings in this guide, but I can assure you that you will be able to know the commands you need, how to invoke them, and how to recall their keybindings in case you forget them. Once your muscle memory is built, editing in Emacs will feel like playing an instrument. You will never be using your mouse or arrow keys, and you will be pressing keys without even thinking about it. Note: I found it extremely rewarding to invest in an ergonomic split keyboard. Also, if you're not typing properly on keyboard using touch typing, you may consider practicing it more as making typing mistakes in Emacs could be very inefficient.

1- Emacs Terminology (Emacs Survival Guide)

·6 mins· loading · loading
Introduction I still remember very well the first time I downloaded and ran Emacs back in 2008. I'm certain I said something along the lines of, "Meh, this definitely isn't my type of text editor." Out of the box, Emacs is plain and confusing for newcomers; it also has a steep learning curve. However, there is a good reason so many developers stick with it and treat it almost as a way of life, there simply is no other tool that offers what Emacs provides. This guide's purpose is to show you how you can survive in Emacs and how you can complete your daily tasks within Emacs and keep improving over time. On the left is a customized Emacs setup; on the right is vanilla Emacs without any customizations. I would like to first try to explain what Emacs is because many people confuse it with a text editor. Actually calling Emacs simply a text editor is like calling Windows a text editor just because it happens to ship with Notepad. Emacs consists of a C engine and an interactive Emacs Lisp (Elisp) environment running on top of it. On top of this runtime environment, an entire set of applications is built: a text editor, web browser, calculator, calendar, mail and news reader, RSS reader, IRC client, Tetris game, and countless other utilities. While all of these tools come built into Emacs out of the box, the community has also created thousands of third-party packages using that very same environment. Emacs is best described as an extensible, self-documenting, and primarily keyboard-driven computing environment: Extensible: Almost all built-in tools, workflows, and core components can be customized or entirely replaced. Self-documenting: All the help and reference material you need is available inside Emacs. You can explore and learn Emacs using its own introspection tools. Keyboard-driven: While mouse support is available, Emacs is designed to be driven entirely by the keyboard. Investing in a good ergonomic split keyboard and learning touch typing is very rewarding. Diagram of the Emacs architecture: built-in and third-party tools layered over the Elisp runtime and core C engine This section might seem boring at first, but understanding Emacs terminology is essential. It clarifies how Emacs is structured and makes reading documentations and tutorials far easier. Emacs was developed in the 1970s that's almost a decade before modern desktops like Windows or Mac show up. Emacs actually invented the GUI terminology before modern operating systems standardize it, this makes an Emacs window different from what you expect a window to be. This guide maps Emacs terms to their counterparts in VSCode. Note: These comparisons help you understand the terminology, but you should adopt native Emacs terminology by calling components by their proper names which will make manuals, commands, and community tutorials much easier to follow and understand. Frame An Emacs Frame is a VSCode window. Just as you can open multiple VSCode windows (instances), you can spawn multiple Emacs Frames. Window An Emacs Window is a VSCode pane. Just as you can split your VSCode editor into vertical or horizontal panes, you can split an Emacs Frame into multiple Windows. Buffer A Buffer is an in-memory object containing text or binary data (like images). You can think of it as an open file/tab inside VSCode. Emacs buffers may be one of the hardest concepts to grasp, they could be: File Associated: Associated with persistent files on disk, such as source code files and notes. Process Buffers: Driven by system processes, such as terminal emulators and compilation outputs. Internal Buffers: Utilities maintained by Emacs, typically named with surrounding asterisks (such as *scratch* and *Messages*). Mode Line A Mode Line is a VSCode status bar. It reports diagnostics such as modification state, current line number, and file encoding. Unlike VSCode's single global bar, every active window in Emacs has its own dedicated Mode Line. Echo Area The Echo Area is an output display at the bottom of the Emacs Frame. It displays short status updates, error alerts, and function output. I can't find a similar concept in VSCode; you can think of it as the last line printed in the debug panel output. Minibuffer The Minibuffer is an interactive prompt at the bottom of the frame; it shares the same space with the Echo Area and it's activated/expanded when Emacs needs user input. It's similar to VSCode's Command Palette used to prompt for commands, file names, or search queries. Major Mode A Major Mode defines certain behaviors for each Buffer type like syntax highlighting, indentation rules, and it can also add its own keybindings. It's similar to VSCode's set language command, but it's actually more powerful. It's worth noting that every buffer in Emacs has exactly one Major Mode active at a time. Minor Mode A Minor Mode is an optional feature that can be toggled on Emacs buffers. Examples include: showing line numbers, spell checking, and word wrapping. Recap Emacs can have many frames open. Each frame has 1 or more windows, 1 echo area, and 1 minibuffer. Each window has 1 buffer and 1 mode line. Each buffer has data/content, one active major mode, and as many active minor modes. Image shows an Emacs frame with 3 windows, 3 mode lines, and 2 buffers.