Getting started with Emacs text editor

1 reader likes this.
Pull to open here

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.

Sachin 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 has previously worked on OpenStack, ManageIQ/CloudForms & Red Hat Insights. He also likes to explore Swift Object Storage in his spare time. He can be reached on IRC as psachin@{Libera.Chat, Freenode, OFTC, gnome}.


Wold be nice to have a little in deep explanation about how to install those shiny cool Emacs extensions, though..

> 1. Now restart Emacs
Pardon, while resembling an OS in its power, emacs is not windows.
Its completely sufficient to just do 'Alt-x eval-buffer'
(or mark the lines added and do 'Alt-x eval-region')

In reply to by psachin

Sure this can be done. Restarting is less confusing for people new to Emacs

In reply to by Stefan (not verified)

EMACS is a text editor the same way that Oracle makes a nice flat file database. Emacs is an Environment. Too bad it needs an OS to make it run. Emacs is the 40# multi-tool for doing everything one can think of doing. Email, ftp, gopher(?), Edit/compile/debug, source control, web browser, shell tool, emulator, screen multiplexer, etc. Saying that it is an editor is like buying a sanp-on tool chest full of tools because you like the phillips #2 screw driver.

I tried emacs for a while but quickly abandoned it. Whenever I used it to edit code, Emacs insisted on reformatting my code in ways I didn't like. Rather than going to the trouble of learning elisp, hunting down the configuration files, and reprogramming Emacs to leave my formatting alone, it was far easier to move to an editor that only did what I told it to do. So now I mostly use gedit.

Software that insists on forcing unwanted "help" on the user is worse than useless. It gets in the way and keeps you from getting your job done. Unfortunately, many software developers have yet to realize this simple fact.

Hi Brian,

I understand sometimes providing access functionality is inconvenient for users.

The 'electric-indent-local-mode' was introduced in Emacs 24.4. All you have to do is disable the mode by inserting

(electric-indent-local-mode -1)

in your Emacs config file.

In reply to by BrianB (not verified)

I've been using using Unix and then Linux for nearly 30 years. I've never understood the whole Emacs vs Vi fight. Emacs is an environment. I can do so much in it. It's much, much more than a text editor. With that said, I understand why people love Vi(m) but I wish the two would stop being compared. They are nowhere near the same.

I agree with you Chad. Having said that, I take the "fight" in a positive way...both the editors has got plenty of plugins/extensions from this fight

In reply to by Chad McCullough

Thanks for this great article. I have translated it into Arabic here:

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.