Emacs Lisp Programming
If you use GNU Emacs or any other similar Emacs text editor, you have probably heard of Emacs Lisp. Emacs Lisp is the programming language used to develop and code most of the editing capabilities of the GNU Emacs text editor. Emacs Lisp is also referred to as Elsip.
Essentially, Emacs Lisp is used to customize and extend the capabilities of the GNU Emacs text editor.
Brief History of Emacs Lisp
Emacs Lisp is a minimalist dialect of the LISP programming language used in the GNU Emacs and XEmacs text editors. LISP stands for "List Processor," and represents a family of programming languages dating back to 1958.
First released in 1985, GNU Emacs version 13 introduced the use of Emacs Lisp as its own extension language. Emacs Lisp was largely inspired by the Maclisp dialect of the LISP programming language.
The latest stable release of GNU Emacs is version 24.5, and it was released in April 2015.
Emacs Lisp is an integral part of the GNU Emacs and it runs on all platforms supported by GNU Emacs — GNU, GNU/Linux, FreeBSD, NetBSD, OpenBSD, Mac OS X, Microsoft Windows, and Solaris.
Both Emacs Lisp and GNU Emacs are open source and free. They are published under the GNU General Public License, and the source code is freely available for examination, modification, and redistribution.
Who Uses Emacs Lisp and GNU Emacs?
With today's modern Integrated Development Environments (IDEs), writing code in a specialized text editor like GNU Emacs can seem very odd at first glance.
However, for a seasoned user, GNU Emacs has many powerful code editing capabilities that most modern IDEs do not have.
GNU Emacs is described as an extensible, customizable, self-documenting, real-time display editor, and almost all of these powerful features come from its integrated Emacs Lisp interpreter.
Modern IDEs focus on GUI and visual elements, and are primarily mouse controlled. Unlike them, GNU Emacs focuses on keyboard input and powerful text editing features, so it is better suited for programmers writing pure code than most modern IDEs.
Every popular programming language is supported in GNU Emacs. What's more, Emacs Lisp kicks-in as a powerful tool for expanding and customizing GNU Emacs.
Emacs Lisp Features
Since the Emacs Lisp programming language was specifically designed to be used in an editor, it provides special features for parsing and scanning text, handling sub-processes, buffers, displays, files, and so on. Editing commands are functions that can be called from Emacs Lisp programs.
Emacs Lisp features show a close relation to the Maclisp dialect. Emacs Lisp uses a dynamic scope by default, with support for both imperative and functional programming methods, focusing on providing data structures and features specific to its use in a powerful text editor.
Static scope is available as an option as of version 24. It can be activated by setting the variable lexical-binding. Note that Emacs Lisp does not support tail-call optimization, so tail recursions can lead to stack overflow errors.
Emacs Lisp can also be used as a scripting language for GNU Emacs, called from the command line or from an executable file, with all editing functions available to the program.
The GNU Emacs user interface is not displayed when it is running in batch mode with Emacs Lisp used for scripting, so it behaves more like a standard Unix tool.
Your Development Environment
To start using Emacs Lisp, you will need to install the GNU Emacs text editor. It is a very simple process.
Just head over to the Gnu.org Emacs download page and follow the instructions on downloading and installing GNU Emacs on your system. GNU Emacs supports the following platforms: GNU, GNU/Linux, FreeBSD, NetBSD, OpenBSD, Mac OS X, Microsoft Windows, and Solaris.
Learning Emacs Lisp
Naturally, learning Emacs Lisp will be easier if you have previous programming experience, especially in some of the functional programming languages derived from LISP.
General programming experience is welcome as well, because veteran coders tend to know their text/code editors inside out.
Emacs Lisp Tutorials and Resources
Emacs Lisp is a minimalistic and easy-to-learn programming language, but due to its relatively limited, niche appeal, there aren't that many online resources. We chose a few tutorials and learning resources that should be useful if you are just getting started with Emacs Lisp:
An Introduction to Programming in Emacs Lisp from Gnu.org is aimed at new users with no previous programming experience.
GNU Emacs Lisp Reference Manual is a full description and reference of Emacs Lisp. This manual presumes that you are comfortable using Emacs for editing.
Elisp Cookbook contains lots of code examples demonstrating basic Emacs Lisp programming operations.
Emacs Lisp Wiki has links to good resources to get you started with Emacs Lisp programming.
Emacs Lisp Books
There are also a number of Emacs Lisp books out there. Some of them can be very useful, but we still suggest that you try online tutorials and resources free of charge. If you need more resources, you can buy a book or two.
An Introduction to Programming in Emacs Lisp by Robert J Chassell is an elementary tutorial for non-programmers to show them how to customize GNU Emacs using the Emacs Lisp programming language.
Emacs Lisp — An Introduction by Robert J Chassell is designed to get you started with Emacs Lisp and to guide you in learning the basic principles of programming.
Writing GNU Emacs Extensions: Editor Customizations and Creations with Lisp by Bob Glickstein will show you everything from simple customizations to extensive mods in Emacs Lisp with realistic examples.
GNU Emacs was designed as a text editor with support for customizations using Emacs Lisp.
However, GNU Emacs became an almost full-blown IDE thanks to the power and extensibility provided by the Emacs Lisp programming language.
It's a powerful, but highly specialized programming language. It's not something the average developer needs to master, but in some niche applications, Emacs Lisp is still widely used, and this is unlikely to change anytime soon.