Get started with GNU Emacs

Getting started with Emacs text editor

Pull to open here
Image by :

Subscribe now

Get the highlights in your inbox every week.

The GNU Emacs text editor has been around since 1976 and remains a popular choice among software developers and writers. Its main focus is extensible, customizable, self-documenting, and real-time display, and it boasts the functionality of an operating system. (Yes, for me it's an operating system.)

While the core of Emacs is written in C, many functions which extend Emacs' basic capabilities are written in elisp, a dialect of the lisp programming language or something like that. Basically, plugins are in lisp, but with Emacs, a lot of the functionality comes from plugins.

Emacs splash screen

The Emacs splash screen on startup.

I came across Emacs as a university student where my research involved Python-based physics simulations. Many of my colleagues were using VIM. I tried it, but quickly found myself wanting something simpler. I saw that a few Linux kernel developers used Emacs and decided to give it a try. It was simple, yet highly customizable. After configuring it for Python and learning the appropriate keystrokes, I became very comfortable using it without a mouse.

With Emacs, users can respond to emails, read news, chat, browse files and directories, run commands, blog, and play music—it's all built in. I've even used it to program my Raspberry Pi and Arduino/ATmega32 microcontrollers.

Emacs readily supports all major programming languages. Syntax highlighting, auto completion, and help/documentation are just some of the features available to developers. It also supports third-party plugins (extensions), which can be added using package-install. Emacs binds with the system so well that one hardly needs to open a terminal to run commands. Once configured, it can be an ideal IDE for developers.

For non-technical tasks like note taking, keeping an agenda, and blogging, Emacs provides a killer feature known as Org Mode. I manage all my notes and to-dos in it. I recently used Artist Mode with ditaa for block diagrams and was surprised with the results. An org file can be exported as HTML, LaTeX, ODT, and Markdown.


Emacs Artist Mode on the left with a finished image converted using ditaa on right.

For those who are new to Emacs, treat it just like any other editor. Use your mouse and the menu bar. Try its built-in tutorial. After spending some time on it, try to learn the keystrokes and avoid using the mouse. After a while, you won't need a mouse unless you're using Artist Mode. Emacs doesn't impose all the complexity at once, but the functionality is always there if you need it.

Cool Emacs extensions:

  • magit: A Git Porcelain inside Emacs. Using magit one can handle Git repository within Emacs.
  • git-timemachine: Browse through archived versions of a git-controlled file.
  • yasnippet: Emacs template system.
  • Jedi: Python auto-completion library.
  • Multiple cursos: Multiple cursors for Emacs.
  • hidepw: Emacs minor mode for hiding passwords (anti-shoulder-surfing).
  • Company: A text completion framework for Emacs which can auto-complete nearly any type of text.

Git commit logs in Emacs magit

The magit-log buffer showing Git commit logs.

Emacs thought leaders:

There's so much more to Emacs than text editing, and I'd recommend it for new users and core developers alike.

About the author

Sachin Patil - Sachin works at Red Hat and is passionate about Free and Open source software. He is avid GNU Emacs user and likes to talk and write about open source, GNU/Linux, Git, and Python. He is a developer working on Red Hat Insights and previously worked on OpenStack & ManageIQ/CloudForms. He also likes to explore Swift Object Storage in his spare time. He can be reached on IRC as psachin@{Freenode, OFTC, gnome}. Read more about him at http://...