Doing Everything with Emacs
These days, almost every production tool-chain of mine is entirely in Emacs, an “extensible, customizable, self-documenting real-time display editor” (Stallman, 2019). Yet, it had not been the case four years ago when I started experimenting with it on Windows:
- Emacs was just one of the curiosities I had;
- It promised to be taxing on my time, especially learning it;
- I was not comfortable with a number of keystrokes I had to hit to accomplish something1.
Starting in 2017, I had been won over by how I saw my productivity jump after trying it a few times. It is a powerful machine in its own right, one that creates its own environment and eases tasks for whoever works with it.
In this post, I will be sharing some tips on how one can do everything in Emacs, not just text- or word-processing that initially attracted me to it in the first place.
Emacs in Brief
Emacs is supposed to be a text editor which is extensible and self-documenting. Right?
Sure it is that. Its name, according to Stallman (1981) originally meant “editing macros”.
It is said to be extensible as it is “a real-time display editor which can be extended by the user while it is running.” (Stallman, 1981).
While Emacs can do basic text editing, its extensible nature is seen when, through a number of packages, it can be made to do a lot of other stuff related to displaying of text on the screen. For example, you can use it to read your email, browse the web, play music, tweet, read ebooks and of course write your assignments.
Thus, it is possible to only work in Emacs throughout your computer session if you just add it to your startup programs.
A Lisp Machine
Emacs uses the Lisp-Variant known as Emacs Lisp. Emacs itself is written in C and Lisp which makes it possible for you as the end-user to inspect its internals.
So, while a few functions were only written in C as a way to speed execution of code, most of the code base is in Lisp (Chassell, 2009).
This has some practical benefits to the user:
- Ability to study source code
- one is able to study the source code of each function he or she
runs. Simply pressing
Ctrl-H Fbrings up a Help window that describes how that function is written and the parameters that the function expects. In fact, this is also true for variables, keybindings and other pieces of the program. Hence the self-documenting property in the tagline.
- Once you understand how functions run, you are able to change its
behaviour by sending the parameters that affect its functionality.
So while with many programs, we have got settings to customise how
the application works, in Emacs, you often change its functionality
by touching its source code. Its initialisation file2, which
.emacs.d/init.el, is in Lisp. This is where you can have a foretaste of how to program in Lisp.
- Installation of extra packages
- In Emacs, you can also install other mini-programs that give power to your default program. A community of Emacs users contribute these mini-programs (officially known as packages) using some central repositories. You can browse through these packages and install those ones you wish. This way, even if you do not yet care about Lisp programming, you can simply get already packaged code and add it to your Emacs application using provided instructions.
Because Emacs uses the Lisp interpreter, while most of its code is also written in its Lisp dialect, it can be considered a Lisp Machine. (See this entry on Emacs wiki for more on this subject.)
Using Emacs as your operating system?
Hmm. Now we are able to see how it can be tempting to see Emacs as an operating system: if it can host other programs (packages) that are dedicated to accomplishing certain tasks, it means you can control it as an operating system.
However, as Hansen (1973) shows, one important requirement of an operating system is that it has to facilitate interaction between other programs and the hardware—something that Emacs can not do yet.
Emacs is able to work with as many packages and faces because of “modes”.A mode alters Emacs' behaviour at any time(See Stallman, 2019, Ch. 23).
There are two types of modes: the major and the minor mode. A major mode sets what type of file is to be opened. In other words, it redefines the default action by Emacs at the time. As a result, there can only be one major mode at a time.
On the other hand, a minor mode can be turned on or off to facilitate display of text. For instance, minor modes like spell-checking, abbrev mode, fonts can be turned on in a number of other major modes. You can have more than one minor mode turned on at any time.
Now this is what makes Emacs tick as each installed package can provide a mode that you can use.
Packages that make me work exclusively in Emacs
These are some of the packages that I use on a daily basis to the extent that I rarely get out of Emacs unless I have to.
|Functionality||Program outside Emacs||Program inside Emacs|
|Screen-reading||ORCA||Emacspeak or SpeechDel|
|PDF reader||Docviewer||PDF Tools|
|Web Browsing||Firefox||Eww or W3M|
|LaTeX processing||command-line||Auctex (with Reftex)|
|File management||Nautilus Files||Dired|
While one can do almost everything in Emacs for daily work, we have to admit that it is not an easy program to begin with. However, if you dedicate enough time to learning its keystrokes, going through its manual (which is detailed anyway) and a lot of practice, you will wonder how you were able to operate without it.
Personally, I find working in Emacs to my liking mostly because I will be dealing with text most of the time. For that reason, I have few accessibility issues to talk of. Using Org-mode and Auctex means that document processing is done after I have completed working on a draft in plain text.
In future posts, I will go through some basics of editing in Emacs and getting started with Emacs Lisp—which is essential if you want to customise your program to your heart’s content.
Chassell, R.J., 2009. An introduction to programming in emacs lisp. 3rd ed. Boston, MA: Free Software Foundation.
Hansen, P.B., 1973. Operating system principles. Prentice-Hall, Inc.
Stallman, R.M., 1981. EMACS: The extensible, customizable display editor. GNU.
Stallman, R.M., 2019. The gnu emacs manual for version 26.2. 17th ed. Boston, MA: Free Software Foundation.