Unlocking Extraordinary Productivity - The Magic of GNU Emacs
On my personal experience with GNU Emacs.
This article tells a story about my experiences with the GNU Emacs text editor. Now, mind the rough or lacking edges, as I am not a programmer. This thing is told entirely from perspective of a non-technical (all right, maybe semi-technical) user. More specifically, from the point of view of general writing and productivity.
The GNU Emacs manual describes it as “the advanced, self-documenting, customizable, extensible editor.” However, just because it goes by the label editor, does not mean it is restricted to it. I would rather call GNU Emacs as a “complete ecosystem of personal productivity.”
First Steps
I had heard of GNU Emacs almost a decade ago, and heard of something called Lisp, and that Emacs was extensible with the Lisp language. But to me they were something far away, something mysterious, something which my brain probably couldn’t even begin to understand.
I had always been on a trajectory towards it though, since I was using various GNU Linux systems on and off all the way from 2004. It wasn’t however until 2011 when I began to seriously consider it as a full-time system.
It was thanks to my best friend who convinced me to use it as my main system (at least temporarily). And so what started was several years of “distro-hopping”, of trying out different systems to find “the one.”
Since 2017, I had already settled on a nice GNU Linux system called Solus, but something inside me still stirred. It wasn’t the one. So I moved on to try the Arch Linux distribution. It was everything I could hope for, the “sweet spot” between total atomic tinkering, and everything being handed down to you on a silver platter.
However, I took an interest after trying (and failing) to learn several different programming languages to the Lisp family of languages. It sparked something inside me. I was excited, excited in the same way I was all those years ago when trying out new distros.
And so, after some research and mere “chance”, in the winter of 2021, I happened to come across simultaneously the long elusive GNU Emacs, as well as an entire system written in Lisp, called GNU Guix (my current main system). I was in love.
A Noob’s Journey
Now, if the reader is wondering what kind of system this GNU Guix is, I have another article where I break down some of its features.
As I began to unravel the intriguing, albeit very rough start of installing and configuring GNU Guix to a usable system, at the same time I started to use GNU Emacs. My first problem, was deciding whether to create my own custom configuration for it, or go with a ready-made package such as Doom Emacs or Spacemacs.
As I like to tinker sometimes thoroughly and out of enthusiasm, I chose to do it from scratch. And for this purpose I found and had amazing help from a community called System Crafters among some others. I recommend anyone reading this to check out their website as well as YouTube channel.
Crafting a Configuration
It would take me more than couple of years to find the ideal configuration with every package I’d need. I would still find new interesting packages to this day I try out, but it’s all there for the most part in a neatly packaged Org file. Now to explain what all this means, a little bit background is in order:
GNU Emacs is configured using Emacs Lisp, a member of the Lisp family of programming languages. Lisp itself is around 70 years old, making it the second oldest high level programming language still in use today. Without deviating too much from the topic, let’s start with describing what I initially did with my configuration. (If I can remember this…)
My first order of business was to create more sane defaults, so that Emacs does not get its panties in a bunch when doing certain things. As an example, setting up a better default font, and theme.
There are two ways to do this, one is writing the actual code in init.el or .emacs configuration file, whatever scheme one fancies. The other is going to the Top-level Customization option from the main menu of Emacs.
Here’s a simple example of how to set up the font and theme in Emacs using Emacs Lisp, just to show a sneek peak of the language:
;; This is a comment indicating what the blow code does (sets font
;; and theme)
(custom-set-variables
'(custom-enabled-themes '(doom-plain-dark)))
(custom-set-faces
'(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal
:weight normal :height 180 :width normal)))))
After setting up various defaults to more adequate ones, (such as setting up margins for writing, and other QoL changes), my next task was to install a bunch of packages to make the experience more bearable. Now, what’s a package in this context? A package is a piece of software that extends the functionality of Emacs.
Some of the preliminary packages included circe for Internet Relay Chatting, emms for music and audio, and doom-modeline for a nicer modeline, to name a few. The mode line is is the area on the bottom that shows what’s going on in the current buffer. That’s right! There are buffers in Emacs!
As time went on, I added functionality I never dreamed would be possible in Emacs, such as ways to work much more efficiently, with packages like magit, which-key, ivy, helm, and projectile. The first is an absolute game changer for git.
Let it be mentioned that even without all these cool gadgets, GNU Emacs comes with a plethora of functionality right out of the box, such as the ability to browse the web, read news, read and send email, IRC, and of course, you guessed it, text editing. It even has a psychotherapist built in (M-x doctor)!
I would go so far as to claim that there is nothing you can’t do in Emacs, in so far as computing activities go. I have yet to see a single activity I usually do that I wasn’t able to do inside Emacs. And this “living inside Emacs” has become somewhat of a meme in the internet community over the years. But there’s a good reason for it.
After some trial and error with all the different packages and setting up my configuration, I went a little further with Emacs and made it my entire desktop. There’s a lovely package called EXWM which is a window manager built around it. And once again, SC community didn’t disappoint. I was able to get it running in record time, albeit adjusting the steps a little.
Now, with all this going on, the transition didn’t happen instantly, as if I was already settling in completely to write on Emacs. No, I used various different programs still, such as LibreOffice and ghostwriter.
However, I felt like the formatting of the first was a PITA. Something else had to come along. And that’s when I discovered Org Mode (and almost simultaneously, LaTeX) in Emacs.
First Contact With Org
Org Mode is a major mode (it simply means a set of definitions that alter the basic behaviour of the text or file being edited) for quote: “keeping notes, authoring documents, computational notebooks, literate programming, maintaining to-do lists, planning projects, and more — in a fast and effective plain text system.”–Org Mode website
In its bare essentials, it is purely a plain text editing system, which can also be extended in various life-giving ways. You can customize its look, and core functionality (yay Lisp) if you like.
What I didn’t know at the time of starting with it, just how far you can go with it in organizing your life. From note-taking, journalling, TODO-lists, schedules and literate programming, (my main Emacs config is written now in Org, remember?) to mindmapping, personal wikiying, project management, and of course, writing one’s stories or even books.
One can export Org files (that end in the format .org) to HTML, docx, commonmark, ODT, LaTeX, texinfo, and other popular formats. This is made possible by a package called pandoc (emacs-ox-pandoc), which handles input and produces output to various formats.
By this time I was getting ready to write not only my blog posts, but my short stories, novelettes, novels, and of course my philosophical work using Org. But something was missing. Until now, I was using a program called TeXStudio to handle my LaTeX output. And while it worked perfectly, I wished there was a faster way. Enter AUCTeX for Emacs.
Adding LaTeX
AUCTeX was the missing piece of the puzzle. It enabled me to take Org files, turn them into LaTeX files using pandoc and then insert commands and parameters quickly until compiling them into PDFs and view them instantly using pdf-tools for Emacs. The added bonus is of course that now I didn’t need an external program aside from Emacs for my workflow.
Some of the features of AUCTeX include:
Editing
Inserting macros, environments and headings with a simple key stroke or via a menu entry.
Using keyboard shortcuts for inserting mathematical formulae.
Sophisticated “fontification” and indentation of macros and environments.
Fold macros and environments and display their content or a pre-defined string instead. Temporarily reveal the original text again for editing.
Compiling
Running multiple TeX or LaTeX interpreters and related programs (BibTeX or makeindex) from within Emacs.
Viewing errors of the compiler running and jumping to the respective place in the TeX or LaTeX source.
Viewing
Starting viewers for PostScript, DVI and PDF output from within Emacs. (Woo-hoo!)
Generating WYSIWYG inline previews of mathematics, figures, and other constructs.
Extensibility
Supports many packages for TeX and LaTeX via style files.
Can be taken even further by writing one’s own styles.
Easily adapted to the Emacs workflow making it more personal.
Here’s an example of a LaTeX file created using AUCTeX from an Org file:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\author{Luminous Nine}
\date{\today}
\title{\LaTeX{} Example}
\begin{document}
\maketitle
\section{This is a Heading}
\subsection{This is a subheading}
This is a small paragraph of text. Blah blah blah, \LaTeX{}.
\emph{This is an emphasized paragraph of text. Cool!}
\textbf{This is a bold paragraph of text. Yikes!}
This is a bullet list:
\begin{itemize}
\item First
\item Second
\item Third
\end{itemize}
And this is a numbered list:
\begin{enumerate}
\item First
\item Second
\item Third
\end{enumerate}
\end{document}
And here is the output as expected:
Writing, writing, writing…
My workflow usually consists of starting up an empty Org file, filling it with the title, section titles if needed, and then I start outlining. Sometimes I don’t outline if I have a clear cut idea on what to write. But novels for example, demand it.
I tend to use one Org file per chapter when it comes to stories. It makes it convenient to keep them organized and separate. I then will later combine them into a master LaTeX file, but what will still be composed of multiple different files. That’s just how LaTeX works.
Now, I tend to keep it quite simple when it comes to writing my stories. It goes from Org -> LaTeX -> PDF. For editing I have to resort to external tools such as LanguageTool but it’s decent for my purposes since I lack the resources to hire an actual human editor at this time.
There are also nifty packages for Emacs and Org that help you make the aesthetics of Org look much better. org-beautify and org-bullets come to mind specifically. It might also be a good idea to minimize one’s distractions while writing, and for this purpose I can recommend couple of tools: writeroom-mode and olivetti. They minimalize the area on which you do the writing, and make one’s Emacs distraction-free.
Now, all of those Org files I’m writing are surely starting take some serious space on my hard drive, right? Well, maybe not in file size, but I mean clutter. So a way to organize them all is paramount. Behold, Org Roam!
Oh My Organization
Roam makes it easy to keep notes and files managable in a neat non-hierarchical way so you don’t lose the contexts you’ve built up. Think of it as organized or “networked thought.” It supports org-ref for citation management, and can be leveraged together with org-capture. It can even take advantage of Org’s LaTeX and source block evaluation!
To keep this more brief than I’d like, I’m mentioning Roam only in passing, mainly because I just started to get to know it. But it’s already taken my interest by a storm.
Another way to keep yourself organized is journalling within Emacs. And for this I chose the org-journal package. It makes it quick and easy with little configuration to add dated journal entries and keep them all in one place.
Special mentions to org-brain and org-books for mindmapping and book management capabilities. These are just few of the myriads of great tools out there, so I highly recommend checking some of them out. Where as many Emacs users tend to go for minimalism, I’m kind of in between that and extreme mountain of packages. I’m always open to new and exciting ways people extend this amazing environment.
Caveats of Usage
All right. Let it not be said that I didn’t take any consideration as to the possible downsides with GNU Emacs. One obvious downside with it is that I can’t find the time to do anything else besides using it. I’m kidding!
Learning Curve
It is no secret that Emacs isn’t a one day deal. It has a reputation for being difficult to learn, especially for those who are new to text editors or programming. They even make jokes within the community, that even after using Emacs for 40 years, they still don’t know which way is up.
The key bindings and commands can be non-intuitive and require time to master. Which brings me to another point: possible conflicts with key bindings. Let me tell you, there are more key bindings in Emacs than stars in the night sky. (Oh come on!) So, getting few mixed up is just another Tuesday for me.
Performance
Because Emacs is highly extensible and runs on an interpreter, it can sometimes be slower than other text editors, particularly when handling very large files or running complex scripts. And that is because Emacs is single-threaded.
I’ve had my share of crashes, but funnily enough they happened almost all the while I was on EXWM. So, who knows. It may be that my older configs were causing it, but it’s hard to tell now that I’m not on it.
Inconsistency Across Platforms
While Emacs is cross-platform, users may experience inconsistencies in appearance and behavior across different operating systems, requiring extra configuration efforts.
And I’m looking at especially one system that I won’t mention here. But in order to get it working like it works on my Guix, I have to rebuild the entire thing in a different way almost from scratch.
Well anyway, if people want to read more about the possible hurdles with Emacs, there are plenty of whiners out there for the reader to look into. This article is about how magical Emacs really is. So, moving on.
My Goals
My short-term goals for Emacs would be to get to know Roam and in any case, Org better. It may sound like I know something about it, but I assure you, I don’t. It’s fricken gigantic in scope in terms of major modes, with, as the meme says: “endless possibilities.”
My long-term goals include things like finishing some of my bigger book projects, and shedding TeXStudio completely in favour of AUCTeX, although it must be granted that it has great options and tools.
Another thing I’d like to do some day, is that when I get a better computer, I’d get back into EXWM on it. It turned out that it wasn’t quite there yet. Either that or it’s a skill issue on my part for making it crash almost on a bi-daily basis.
Be that as it may, I have no regrets about this quest of mine. I may not understand Lisp that much, or the inner workings of GNU Emacs, but it has been to me the best tool I have ever had the priviledge of working with.
Summary
So, to summarize: GNU Emacs, the “text editor”, is pure magic. And while I feel like I’ve only scratched the surface with it, the countless tools and extensions it has have become almost part of me.
Ten years ago, if someone said to me, yeah, one day you’re going to be working with Emacs full-time while writing your books, I would’ve laughed right in their face. I didn’t know anything about it back then. And I still don’t know.
But I know enough to make it work for me, instead of against me. And I hope someone out there, will get affected by my sincere excitement and awe, as I look upon this masterpiece of a software.
L.
P.S. I’ve never done as technical article such as this, so forgive me if it’s “bad”, “horrible”, “lacking”, “an insult”, or just “shit”. I think I managed to make a decent job of it, considering I’ve barely done any real coding in my life.