↓ Skip to main content

Emacs

Traditional text editors (like Vim, Nano, or VSCode) are designed to edit text files. They provide a fixed set of features and extensions that allow you to write code or modify configuration files efficiently.

Emacs is an advanced computing environment that happens to ship with a text editor. it uses a single unified programming language (Emacs Lisp) to declare and manage everything in the system, from basic cursor movements to entire user interfaces like email clients, file managers, and task organizers.

RECENT

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.

Emacs Vanilla vs Flavors (Spacemacs and Doom Emacs)

·6 mins· loading · loading
The Batteries-Included Flavors Even though I am not a big fan of the batteries-included flavors anymore, I still believe they are great starter kits for package discovery and understanding how far Emacs can be customized. I personally thought that Emacs was just a simple text editor like gedit until I tried the Emacs distribution Spacemacs which comes opinionated, pre-configured, and ready to use out of the box. However, this convenience comes at a cost as it reduces your visibility into the underlying components and how Emacs works. When something breaks or you need to alter a certain behavior, you find yourself unable to diagnose the problem or even know if it's a built-in behavior, a custom package, or some custom code you introduced. In fact, as an ex-user of these distributions, I wasn't aware of what Emacs packages I was using which is very funny to me now that I am thinking about it. The two most popular Emacs distributions are: Spacemacs Spacemacs provides excellent Vim emulation out-of-the-box which makes it a very good option for someone who is used to Vim's keybindings. It's extremely well documented and has a large friendly community supporting it which makes it easy to find help. However, Spacemacs's only problem from my point of view (a lot of people consider it an advantage) is its layers system. Spacemacs's layers add a massive amount of abstraction on top of Emacs; it makes it very easy to toggle features on and off by simply changing one line of code. My problem with the layers concept is that you will invest so much time learning it and then realize that all the knowledge you gained wasn't useful at all when you eventually decide to move to Vanilla Emacs. Doom Emacs Doom Emacs takes a different philosophical approach. It still offers a beautiful interface, excellent Vim emulation, and a great experience out-of-the-box. However, the major difference between it and Spacemacs is that it doesn't add as much abstraction on top of Emacs. Learning how to configure and tweak Doom Emacs is going to be much closer to configuring Vanilla Emacs. Also Doom Emacs utilizes macros and lazy loading efficiently which make it boot incredibly fast compared to other distributions.