This post is about GNU Emacs. There are so many articles written for beginners, but I'm often dissatisfied and frustrated by their selection of materials. I believe, to use Emacs, you don't have to be a genius. Getting started with Emacs should be as easy as using Notepad!

What can I learn from this article?

  • Despite all the myths, what is Emacs, actually?
  • How to get started with Emacs, without writing a single line of Emacs Lisp?

What's Emacs?

Emacs is an editor. It's not a word processor like Microsoft Office Word, or LibreOffice Writer. It excels at editing plain text and some other formats. In this regard, Emacs is no different from Vim, Sublime Text, Atom, Visual Studio Code, Notepad, and Notepad++.

Emacs is particularly interesting to programmers. However, if you are not but do a lot of plain text editing like writing LaTeX documents, Emacs is also a good fit.

It's also worth noting that Emacs has limited support for rich-format text, which many of its rivals fail to support.

Is Emacs right for me?

In general, if you don't have any special requirements against Emacs, it should be a safe choice for you. It's just an editor, anyways.

Specifically, you will likely fall in love with Emacs, if

  • you are interested in some applications written for Emacs, e.g. Org Mode.
  • you are tired of using a mouse;
  • you use many programming languages at the same time, but your favorite IDE fails to support all of them;
  • you hate it when you constantly switch between windows, and your window manager is bad at this job;
  • you want to tweak your editor to your special needs;
  • you want a stable working environment that lasts for decades.

However, you could stop reading this article now, if

  • you can't read English;
  • you are already accustomed to some other editor, and are satisfied with it;
  • you are primarily programming in some language which has perfect IDE support and you want to have the same experience in Emacs;
  • you are using a computer from the '80s which is not capable of running modern Emacs, (but feel free to use Emacs from the '80s).

I know there are myths saying that Vim and Emacs are the only decent editors. Don't believe them! Vim and Emacs are just editors. If you can get your job done, who cares what editor you use?

How do I get started?

Glad that you want to try Emacs! There are many tutorials written for beginners on the Internet, but believe me, mine is different. Emacs developers have tried hard to make Emacs easy to pick up, why let them down? :-)

Emacs is an old piece of software, and has different terms and ways of doing things (like shortcuts) which might come as a cultural shock. Don't panic! You can master these differences in less than 10 minutes.

View website and install Emacs

Official website: https://www.gnu.org/software/emacs/

Here you should get a rough idea of what Emacs can do and learn how to install Emacs.

After this step, you should be able to see Emacs, and you should be able to use Emacs as a more advanced Notepad (by using the menubar and the toolbar).

Emacs main window

Try using Emacs like notepad for a while

Familiarize yourself with the Emacs jargon:

  1. "Buffer" means Document
  2. "Window" means Pane
  3. "Frame" means Window
  4. "Kill" means Cut (for text), or Close (for buffers and other things)
  5. "Yank" means Paste
  6. "Mode" means a bunch of functions for a specific purpose, e.g. for editing HTML files, etc.

Familiarize yourself with the toolbar.

  1. New file
  2. Open file
  3. Open directory (this doesn't do what VSCode does)
  4. Save file
  5. Close file
  6. Undo
  7. Cut
  8. Copy
  9. Paste
  10. Search

Try the menubar, where you can get access to many features easily.

After this step, you should be able to use Emacs for basic text editing. You are now an Emacs user, congratulations!

Learn how to customize

You might have already tried the "Options" menu. Warn you, they are just 1/1000 of all possible customizations!

Note, if you are happy with your Emacs, you can skip to the next section for now, but don't forget to go back here!

Use CUA keys

You want Ctrl-C / Ctrl-X / Ctrl-V? No problem. Click "Options → Use CUA Keys".

Change the default font

Click "Options → Set Default Font".

You might've noticed "default" here. Yes, Emacs can use many different fonts for different purposes, even in the same buffer! (Recall that "buffer" means document.) This is an advanced feature so I won't explain it here.

Exercise: use a font you like.

(What do I mean by advanced features? They are interesting, sometimes very useful and important features like fill-paragraph, recursive editing, etc. However, to beginners, they are less frequently used and less significant than the most basic functions.)

Save customizations

Customizations made so far are temporary. You must use "Options → Save Options" to make them permanent.

Easy Customization

To view and change other options, use "Options → Customize Emacs → Top-level Customization Group". The interface is very intuitive so I won't say much on it. Use "Exit" button on the toolbar to go back to the upper level.

Most options will show there, so don't spend too much time on it because that will take you a lot of time. Learn to use the search bar, though.

Exercise: suppose you don't like the default cursor type, i.e. filled box, and would like a more traditional vertical bar. How do you change it? Remember to make your change permanent.

Learn how to install external packages

Say you are using Emacs for writing LaTeX documents, and you know AUCTeX for Emacs does a good job. How can you install it?

Click "Options → Manage Emacs Packages", and a buffer named *Packages* should show up. Here, search for auctex (using the toolbar), and you can find a link named auctex. Click it. On the window just opened (recall that in Emacs "window" means pane) find the Install button, and click it. That's all.

The character-based interface may be awkward and unimpressive to many. However, Emacs is right. Using familiar text editing tools (you already did: using isearch to search for a string) for not only editing text can significantly reduce your time spent on learning new tools. (Linux users, did you google it when for the first time you wanted to search for a package? Did it take you 10 seconds to learn to do the same thing in Emacs?)

Get some themes!

Many themes are available as a package. You should be able to search for theme in *Packages*, and install what you like. Unfortunately, theme packages doesn't have pictures in the README. (I don't know why, cuz Emacs supports inline images!) You can click on the Homepage line and see pictures there though.

To activate them, use "Options → Customize Emacs → Custom Themes".

Exercise: get and activate the Dracula theme. Delete it if you don't like it.

Read the Tutorial and the Guided Tour

At this point, you can already do many things. Want to edit TOML files with highlighting? Just install a package for that. (Hint: it's called toml-mode. Remember what a mode is?) It's very easy.

That's not enough and not efficient! To make the most of Emacs, you must do things in the Emacs way and learn the keychords (shortcut keys in Emacs jargon).

Disable CUA keys now, as they conflict with other Emacs keys. This is recommended, but if you like them, you can continue to use them.

To read the tutorial, there are three ways,

  1. click on the menu, "Help → Emacs Tutorial".
  2. click "Emacs Tutorial" on the greeting page.
  3. use the shortcut, C-h t (don't panic if you don't know what it is, the tutorial will tell you).

On the website, there is a guided tour of Emacs, which is better-looking with pictures, and covers more advanced features of Emacs, but you don't have to memorize all of them now.

After this step, you should be able to use the most basic keychords (for access to files, navigation, etc.). And, of course, you should know how to use M-x. It's time to replace the use of the menubar with the corresponding commands and keychords. Feel the efficiency!

Learn how to help yourself

Emacs describes itself as a self-documenting editor, which basically means you can learn whatever you want to learn.

Try using "Describe" under the "Help" menu bar! It's really impressive.

Exercises:

  1. what does keychord M-m do?
  2. what does function fill-paragraph do?

And do try "Search Documentation".

Exercise: find a command to sort lines.

It's worth noting that describe-char (not shown in the menubar) can show really useful information about the current character at point. Try it on 𝒹ℴ 𝓎ℴ𝓊 𝓀𝓃ℴ𝓌 𝓌𝒽ℯ𝓇ℯ 𝓉𝒽ℯ𝓈ℯ 𝒸𝒽𝒶𝓇𝒶𝒸𝓉ℯ𝓇𝓈 𝒸ℴ𝓂ℯ (hint: they are mathematical).

Final words and further reading

Congratulations, you are now a qualified Emacs user! I hope this tutorial didn't take you more than 30 minutes and you didn't write a single line of Emacs Lisp, nor learned the existence of .emacs.

The purpose of writing this tutorial is to prove that getting started with modern Emacs is easy, no more difficult than Sublime Text, Atom, Visual Studio Code, and Notepad! The defaults are different, but they are easy to remember and (if you don't like them) easy to change. The package system is as easy to use as Atom's and Visual Studio Code's. One thing Emacs is better at is its self-documenting nature. It's super easy to learn and tweak Emacs.

To learn more, read the Info documents (C-h i)

  • The Emacs manual: covers most functions provided by Emacs by default.
  • Emacs Lisp Intro, or Introduction to Programming in Emacs Lisp: an easy-to-read introduction to Emacs Lisp; requires no prior experience in programming!
  • Emacs Lisp Reference Manual: must-have when writing Emacs Lisp.

These manuals are very easy-to-read. If you read one chapter every day, and use the advanced features whenever and wherever possible, it will take you less than a few days to be productive, and a few weeks proficient.

Good luck! And hope you enjoy Emacs!