keepcalculator

06 Numbers and Powers

Emacs Text Editor: What It Is and How to Use It

Card No. 06·85922 · Updated · Standard formula, shown below

Emacs is a free, open-source, extensible text editor that has been in continuous development since the mid-1970s. You use it by typing text into a buffer, then invoking commands with keyboard shortcuts or by writing small programs in a dialect of Lisp called Emacs Lisp. It is not just an editor; many people use it as an email client, file manager, news reader, and even a personal information manager.

What Emacs Actually Is

Emacs is a family of editors, the most popular being GNU Emacs, created by Richard Stallman in 1984. It runs on virtually every operating system—Windows, macOS, Linux, and even on a terminal. The core idea is that everything you do is a command: opening a file, saving, moving the cursor, replacing text—all are functions you can call. You can bind any command to any key, or write new commands in Emacs Lisp.

Unlike many modern editors that use a graphical menu system, Emacs was designed for keyboard efficiency. Beginners often find the key chords (like C-x C-s to save) intimidating, but once learned, they allow you to edit without ever moving your hands away from the home row.

How Emacs Works

Emacs is built around a few core concepts:

  • Buffers – each open file (or new text) lives in a buffer. You can have many buffers open at once.
  • Windows – the screen is divided into windows, each showing a buffer. You can split horizontally or vertically.
  • Frames – a frame is a graphical window (like a separate OS window) that contains one or more Emacs windows.
  • Modes – major modes define behavior for a specific file type (e.g., Python mode, Markdown mode). Minor modes add features like spell-checking or line numbers.
  • Commands – every action is a command. You invoke them with key bindings or by typing M-x command-name.

You start Emacs by typing emacs in a terminal or clicking the icon. The default screen shows a welcome buffer with a tutorial link. Press C-h t (Ctrl+h then t) to open the built-in tutorial—it takes about 30 minutes and teaches the basics.

Why People Choose Emacs

Emacs has a steep learning curve, but it offers advantages that keep a loyal user base:

  • Extensibility – you can change almost any behavior without recompiling. Need a new command? Write 10 lines of Lisp and bind it to a key.
  • Org-mode – a plain-text outlining and note-taking system that many consider the best ever made. It handles to-do lists, tables, and even exports to HTML or PDF.
  • All-in-one – you can read email (Gnus), browse files (dired), run a shell (M-x shell), and write code without leaving the editor.
  • Portability – your configuration file (usually ~/.emacs or ~/.emacs.d/init.el) can be copied to any machine, giving you the same environment everywhere.
  • Community and age – decades of documentation, packages, and answers on Stack Overflow.

It is not the fastest editor, nor the prettiest out of the box, but it is arguably the most powerful in terms of what you can make it do.

Common Problems and Misconceptions

New users often hit the same walls:

  • “How do I exit?” – Press C-x C-c (Ctrl+x then Ctrl+c). If you have unsaved changes, it will ask you to save or discard.
  • “The keys don’t work on my keyboard” – On Windows, the Ctrl key works as expected. On macOS, you may need to remap the Command key to Ctrl in your terminal or use the built-in ns-win bindings.
  • “It’s too old and ugly” – With the melpa package repository, you can install themes, a modeline, and even a modern UI like doom-modeline. It can look as modern as any editor.
  • “Emacs is not a real IDE” – For many languages, Emacs with LSP (Language Server Protocol) provides autocomplete, goto-definition, and refactoring, matching modern IDEs.
  • “I can’t remember all those keybindings” – You don’t have to. Start with the tutorial, then learn a few per day. Use C-h k to see what a key does.

One common misconception is that Emacs is only for programmers. While it is popular among developers, its org-mode and plain-text editing make it excellent for writers, researchers, and anyone who works with text.

Emacs vs. Vim vs. VS Code

The eternal debate is Emacs vs. Vim. Both are powerful, keyboard-driven, and extensible. Vim uses a modal editor (insert vs. normal mode) and is lighter and faster to start. Emacs uses chords and is heavier but has a more unified Lisp environment. Many people end up using “evil-mode” in Emacs to get Vim keybindings, which gives you the best of both.

VS Code is a modern graphical editor with a huge marketplace, built-in debugger, and easy setup. It is easier for beginners, but it is not as deeply programmable. If you want a full operating system inside your editor, choose Emacs; if you want a quick, familiar editor, choose VS Code.

There is no “best” – it depends on your workflow. Try the built-in tutorial, then try Vim’s vimtutor, and see which feels more natural.

How to Get Started

To install Emacs:

  • Windows – download the installer from the GNU FTP site or use a package manager like Chocolatey (choco install emacs).
  • macOS – brew install --cask emacs or download the .dmg.
  • Linux – use your package manager: sudo apt install emacs (Debian/Ubuntu), sudo dnf install emacs (Fedora), or sudo pacman -S emacs (Arch).

After installation, run emacs and press C-h t to start the tutorial. Then, if you want to customize, create a file at ~/.emacs.d/init.el and add lines like:

(setq inhibit-startup-screen t)
(global-display-line-numbers-mode 1)

This disables the welcome screen and shows line numbers. You’ll need to restart Emacs or evaluate the buffer with M-x eval-buffer.

Costs, Safety, and Limitations

Emacs is completely free and open-source (GPL licensed). There is no paid version, no ads, and no telemetry. It is safe to download from official sources (GNU, your Linux repo, or Homebrew).

Limitations: it uses more memory than Vim or nano, and the default keybindings can cause “Emacs pinky” (pain from pressing Ctrl too often). You can mitigate this by using M-x instead of chords, or by rebinding keys. Also, the built-in help system is extensive but can be overwhelming; use C-h ? to see help options.

Frequently Asked Questions

Is Emacs hard to learn?

Yes, the first week is tough because the keybindings are non-standard. But the built-in tutorial and the fact that you can use the mouse in graphical mode help. Most users become comfortable within a few weeks of daily use.

Can I use Emacs for writing, not just code?

Absolutely. Many authors use Emacs for novels, articles, and notes. Org-mode is excellent for outlining and exporting to PDF or HTML. You can also use M-x text-mode for plain writing.

What is the difference between GNU Emacs and XEmacs?

XEmacs was a fork from the 1990s that had a different GUI and some features. It is now largely unmaintained. GNU Emacs is the active, standard version, and it has absorbed most useful XEmacs features.

How do I install packages in Emacs?

Add MELPA to your init.el with a few lines, then use M-x package-refresh-contents and M-x package-install. For example, to install use-package, type M-x package-install RET use-package.

Does Emacs have a graphical interface?

Yes, when you run emacs from a GUI environment, it opens a graphical window with menus, toolbars, and scrollbars. You can also run it in a terminal with emacs -nw for a text-only interface.

Why do people say “Emacs is a great operating system, lacking only a decent editor”?

That is a joke about Emacs’s extensibility and the fact that you can do almost anything inside it. It highlights that Emacs is more than an editor, but it also pokes fun at the learning curve and the fact that it can be slow to start.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →