This is a series of brief articles aimed at teaching Emacs to computer professionals who are unfamiliar with it. I do not dwell on the basics of the user interface, which can be learned from the built-in tutorial. Instead, each article in this series will distill one very specific command line (CLI) tool or technique that Linux/UNIX users often use, and describe an equivalent function or technique in Emacs. The tool or technique discussed will be specific enough that the whole article can explain the concept in around 1000 words, and will provide examples, or specific actions to be taken. The goal is to have a list of recipes that Linux users can search and find quickly, and read through in just a few minutes, to learn the most useful ways of using Emacs to solve day-to-day problems.
The best way to learn Emacs — not part of the "for pros" series, but is my advice to beginners on how to study and learn Emacs.
find— using Emacs instead of Bash as your shell.
Batch file renaming:
sed— using regular expressions to rename a large batch of many files all at once.
In the year 2022 and beyond, there is no shortage of
professionals who are quite skilled at using computers to do their
jobs. Among this demographic, a plurality are fluent in using Linux
(or a UNIX like Mac OS X). They can use the interactive command line
tools for these OSs, like Vim and Tmux, and the shell scripting with
tools like the GNU Coreutils
grep) within CLI shell
languages Bash, Zsh, Fish. Most have written short scripts or
programs with languages like Python, and have tried using (or have
at least heard of) the Lisp programming language before.
It seems clear to me that people with this level of knowledge,
the people who I am calling
could benefit a great deal from learning about Emacs, and how Emacs
is capable of performing all of the functions that the other Linux
interactive command line tools provide. I also think that many of
the small, one-time-use scripts that could be written in Python
could be written as well in a language like Emacs Lisp, and
professionals could benefit from this knowledge as well.
And yet, in my experience, there is not nearly enough educational material about Emacs created with this group of professionals in mind as the target audience. Most Emacs-related content found on the Internet falls into two categories: (1) the fundamentals of how to use Emacs key bindings to edit text, aimed at absolute beginners who have never tried using Emacs before, and (2) discussion for seasoned Emacs users about tools and techniques that they might try out for themselves to complement their existing Emacs workflow.
To be sure, there is good material out there aimed at professionals. But the nuggets of useful information are often just one element of a larger topic discussed at great depth that might take some 30 minutes or more to read completely. Not that this is bad, but somtimes a more concise recipe-like document is really what I want to read. (See also: a list of my favorite Emacs educators in this article.)
This was frustrating for me when I first wanted to learn about Emacs. I have earned my masters degree in computer science, and had worked as a software engineer for 10 years (when I switched to Emacs). Until then, the whole time I had been using Bash, Vim, and GNU Screen for doing much of my work. But I had a hard time finding learning material about Emacs that wasn't for complete beginners, or that wasn't a string of jargon indecipherable to someone who had no experience using Emacs beyond simply editing text.
A conscious decision to switch
I had tried learning Emacs on multiple occasions as a graduate
student, and was always frustrated with the user experience. It
to navigate the user manual, and there were seemingly better
tmux are a
powerful combination, and have very good manual pages.
I eventually made a decision to learn Emacs because I knew that it follows the principles of functional programming better than ordinary shell scripting. In functional programming you have two key ingredients: functions, and a means to compose functions together to build larger functions that solve a particular problem. Without using Emacs, your functions are the Linux CLI tools, and you can compose these tools with shell pipes to solve problems. But Emacs provides better ways of composing CLI tools because it is programmed in Lisp, which is a functional programming language. Emacs also provides a better framework for constructing views over your data than something like Ncurses and the ANSI terminal protocol. Once I had made this realization, it was obvious to me why Emacs was the best toolkit to use in my day-to-day work, and I consciously put in the effort to overcome frustration and finally learn Emacs as a skill.
As I got better at using Emacs, I started to see how I did not usually need to consciously compose the Emacs functions together, function composition often happened naturally because of the way the Emacs user interface is setup, and also because most Emacs functions compose together over a very versatile data structure: the text buffer. But also, Emacs has encoded the techniques of Linux and UNIX users and Lisp programmers accumulated over it's half-century long existence, and these techniques are just there waiting to be discovered.
So I write this series in the hopes that other professionals like myself might come to the same realization that I did about Emacs being a more useful toolkit than what they may currently be using now, while quickly learning the techniques necessary to replace their existing workflow with an equivalent Emacs-based workflow, and forgoing the tedious prerequisite lessons on cursor navigation, or the basics of Lisp programming.