In my previous blog post (my first one ever, yay!), I described the setup I use to manage e-mails in Emacs using a packaged called mu4e. In that post I assumed the reader knew what Emacs was. Now, that’s a pretty big assumption to make. I wouldn’t be surprised if many of you (I will assume there is at least someone reading) at the mention of Emacs would react along the lines of: “wait a sec, what the actual f*ck is Emacs?”.

Since I want to spread the knowledge of Emacs, I’ve decided to write a small beginners introduction to the world of Emacs. It will be composed of three separate blog posts. The first blog post (this one) will focus on describing the way I use Emacs in order to showcase some of the potential benefits you can gain by deciding to learn Emacs. In the second blog post I will cover more in detail the basic concepts, terminology and keybinds needed to know to start using Emacs. Then, in the third and final blog post, I will introduce some of the more advanced features offered by Emacs, so that you may hopefully continue to learn it on your own. Ok, without further ado, let’s get started.

P.S. The links to the other two blog posts are reported below:

## What is Emacs?⌗

When looking at it for the first time one can reasonably guess that Emacs is a text editor. After all the usage of Emacs mainly involves text editing, and in the offical site itself it is described as “An extensible, customazible, free/libre text editor…”. So it is correct to think of Emacs as an actual text editor. Yet, one has to be aware that thinking of Emacs as just a text editor completely misses the point of Emacs. That is because, at its core, Emacs is not just a text editor. A better description would be that Emacs is an interpreter for a specific dialect of the Lisp programming language, called Emacs-Lisp, also known as elisp, with built-in facilities that allow the basic editing of text. Yes, at this point it’s normal to have no idea what I am talking about, so don’t worry and keep reading!

The term Emacs stands for “Editing MACroS” and refers to a family of text editors characterized by the ability to be extended by interpreting a programming language. The specific Emacs I use is called GNU Emacs. It was written by Richard Stallman as the first program released by the GNU project, with the initial public release (version 13) made on March 20, 1985. It’s extremely fascinating to see such old software still thriving. The history of Emacs is complex and interesting, and might deserve an entire blog post to explore it (I will think about it).

The code of GNU Emacs–which can be freely explored in the following github mirror–is made up of two big parts: a small but powerful core written in C which implements the elisp interpreter and the basic capabilities of the editor, and a huge collection of elisp code, which extends the basic editor with a lot of other functionalities, such as (to mention a few) a mail client called gnus, a file system explorer called dired, a powerful markup language called org-mode, and, lo and behold, a playable version of tetris. Yes, that’s right, you can actually play tetris in Emacs.

NOTE WELL : For the sake of brevity, instead of using the correct name of GNU Emacs, I will always refer to it as simply Emacs. It is important however to keep in mind that the specific “istance” of Emacs I am referring to is GNU Emacs, although the concepts I will talk in these introductory blog posts are general enough that they will probably apply to some degree to all the other Emacsen.

In a paper1 written by Richard Stallman in 1981, he describes that the key characteristic of Emacs is the ability to be extended by interpreting new elisp functions. This is a crucial point, because it means that the users are not limited by the decisions made by the original Emacs implementors. If a user so desires, he/she can write a different implemention for an existing feature, or implement a completely new feature. This makes Emacs extremely flexible.

In the following section I will showcase the flexibility offered by Emacs by describing the various ways I use it. Before starting though I want to make clear that I am by no means an expert at using Emacs. I have a lot to learn about it, and many things which could be done in Emacs I still do by other means.

Let us now finally begin our journey in discovering one of the oldest software that is still being maintained and developed to this day.

## How I use Emacs⌗

This section is divided into three parts. In the first part I will describe how Emacs helps me in general day-to-day activities. The second part instead will focus on the way I write code using Emacs. To finish off, in the third section I will describe the power of org-mode, which is one of the biggest killer feature of Emacs.

### General usage⌗

As far as general usage I do the following in Emacs:

• Local bookmarks

Whenever I want to save a local file so that I can access it quickly later I use the bookmarks feature.

• Terminal emulator

Whenever I need to use the command line I use term-mode, which is a terminal emulator written in elisp. Emacs also offers other shells like shell-mode, which is a dumb terminal to a subshell and eshell, which is a shell written directly in elisp.

There are many advantages of using the terminal inside Emacs, such as the ability to use Emacs keybinds and in general the shared work environment.

In case I need to connect to a remote machine using ssh I use the tramp-term package, which allows me to transparently access remote files.

• E-mails

To manage emails I use mu4e. There is not much to say here, as I already wrote an entire blog post describing my e-mails workflow.

For RSS feeds I use a package called elfeed. I still haven’t configured it out completely, but its a good way to keep up with the news while still being inside Emacs.

• Git repositories

To interact with git repositories I use a packaged called magit. It offers a fast and intuitive interface to the git software, as well as a lot of other useful features, like the ability to commit selected chunks of data.

• Dired

If I need to do some activities involving files I use dired.

### Programming environments⌗

One of the greatest advantages offered by emacs is its ability to be a great IDE for multiple programming environments. So far I still haven’t met a programming language that did not have a dedicated mode in Emacs. Here I will list only the programming environments that I’ve been using in the past few months, for otherwise the list would be way too long.

• LaTeX

To write and compile LaTeX code I use a package called AUCTeX, while to view the PDF produced by the compilation process I use a package called pdf-tools.

• Python

To write python code I use a package called elpy, which has lots of features such as on-the-fly syntax checking, interactive execution, code navigation, code completion, and much more.

• R

For writing statistical applications Emacs has a package called ess. I’m still ignorant of a lot of features offered, but it enables the writing and the execution of R code.

• C/C++

Recently for a university project I’m starting to look into creating a development environment for writing C/C++ code. Without installing extra packages however I’ve discovered that Emacs comes with a mode that allows the compilation of .c and .cpp files in such a way that, in case of compilation errors, the user can interactively jump the portion of the code that caused the error.

• Graphviz

One day I needed to create some graph images using the DOT language offered by graphviz. I immediately went looking for a package that could let me do that in Emacs. I was not surprised to find out that such package existed. I tried it and it was good. The package is called graphviz-dot-mode and its useful when dealing with .dot files.

### Org mode⌗

So far I’ve listed already a bunch of packages. Yet, none of them compares to the power of org-mode.

Org mode initially started as an Emacs mode, but then grew in size and became a powerful markup language. The use cases of org-mode are so vast that it would be impossible to explain all of them in such a short space. I will thus limit myself to describe the ways in which I have found a use for it, and point to the official documentation for further clarification.

I use org-mode for various things, such as:

• Personal agenda and planner.

I write all my stuff, personal and work related in org mode.

• Authoring and publication tool.

I heavily use org mode to publish the lecture notes I take during my studying process at university.

For those interested, they are available in here.

Another example of publishing done in org mode is this very blog. All my blog posts are written in a single .org file. I then use a packaged called ox-hugo which enables me to export the org file into the .md file which is then read and processed by hugo to obtain the final .html result.

• Able to work seamlessy with blocks of source code of various languages.

We can for example execute a block of C code, then a block of python code, and then a block of elisp code in the same document. It is also possible to process the output of those blocks, store it in some variables and so on. The possibilities are really endless when it comes to org-mode.

So that was all. I hope it was captivating enough to make you want to at least try Emacs out. I understand if this may initially seem overwhelming, but once you start getting used to it you will understand that tools like Emacs are never really completely configured. There will be always tweaks you can add here and there to make it even more comfortable and efficient. Indeed, the beautiful thing about Emacs is that the more you invest in it and the more it gives back.

In the next blog post we will start from scratch and learn the basics needed to start using Emacs. Before that though I want to talk about what could be considered a bit of a controversial topic. That is, the nature of the One True Editor.

## The Editor Wars and the One True Editor⌗

I believe that conflicts are an intrinsic part of the human spirit, for there cannot be real growth without them. Yet, it is also true that they tend to degenerate, losing all possible benefits they could potentially generate. While most animals fight for really important stuff, like the survival of their own lives, we humans with our ability to think in abstract terms end up fighting for the most absurd things. It is no wonder then that there are also fights over which is the best text editor, also known as the One True Editor.

Nowadays there are many text editors. There are many good text editors. The conflict I’m referring to however is old, and its about two of the very best text editors. On the one side we have Emacs, the text editor I use, which is more of a elisp interpreter than just a text editor. On the other side we have Vim, a lightweight and fast modal text editor.

Many things have been said about these two creations of human endeavor. I’ve heard people say that Emacs is bloated and does not respect the Unix philosophy. There is even a running meme as old as Emacs is, which states that “Emacs is an OS that lacks a decent text editor”. Now, I cannot speak too much about Vim, as I still have to learn it well (but one day I will). What I will say however is that before jumping to conclusions about which is the best one, it is important to know what the other has to offer. I believe that with enough investment, everyone can find in both Emacs and Vim something useful. It’s really just a matter of how much one wants (if possible) invest in learning something new. Some people will obviously prefer one over the other, and I myself right now prefer Emacs simply for the fact that I am very productive with it, as opposed to Vim, which I still have to learn. However, I will not say that Emacs is better than Vim only because I prefer Emacs right now. One day I might change opinion and prefer Vim over Emacs. So, even though I deeply like Emacs, I do not believe that Emacs is the One True Editor. I do not believe such a concept could even possibly exist in a world so flawed as our own. But then again, I don’t need the One True Editor. For now I’m perfectly fine using Emacs.

NOTE: It’s worth mentioning an Emacs mode called evil-mode which transforms Emacs into a modal editor, essentially bringing the text editor capabilities offered by Vim into Emacs. Another good example of Emacs extreme flexibility.

In the next blog post we will start looking in depth at the basics of Emacs in order to actually start using it.