The Emacs Way
Starting out with Emacs¶
Like any other person who uses Linux I too started out by using vim as
my default text editor. This was a time when I did not know the
amazing world of vim plugins. It was a good journey for a while and
over time my vim config grew up to a point where it was the perfect
setup.
Then, I discovered Emacs and I moved to Emacs. In the previous
sentence using the work "discovered" is wrong because I did not
"discover" it in the strictest sense of the word. I started using
Emacs because someone (this person is an Emacs and Scheme veteran
(actually a LISP)) told me that the best IDE for learning Scheme is to
use Emacs. Over time I found Emacs to be the most perfect piece of
software that you could possibly want.
What is Emacs ?¶
Emacs is
marketed as a Text Editor which is a huge oversimplification of what
Emacs actually is.
Let me tell you what Emacs really is. The standard version of Emacs
without any extra plugins comes with a text-editor, an interpreter
(for Emacs-Lisp), a package manager (for Emacs), a Planner (org-mode),
a Calendar, a File manager, and a mail/news reader all rolled into one
eco-system. At a fundamental level Emacs is an interpreter for
Emacs-Lisp, all of these goodness comes from the awesomeness of LISP
(or eLISP in this case).
I am unable to form sentences about stuff I wanna say and I really
like lists. So, I will list out stuff and go on explaining them.
This is a list of the reasons why I like Emacs:
-
Config : The Emacs config is just a eLisp script. This enables
it to be loaded dynamically and the changes also reflect dynamically
without having to restart the application. A configuration written
in eLisp means that you do not have to learn some weird brain-dead
language just to configure a text editor (I'm looking
at
Vim script). -
Literate Programming :
By default the Emacs configuration file init.el to store the Emacs
config. This becomes messy as after some time you end up with a
mess. Thus I decided that it would be a good idea to store the user
config is a separate file and have Emacs generate the actual
configuration from it . So I write my config in an Org-mode file and
I let Emacs handle the
rest. This is where I
have uploaded my Emacs config. The file init.el is the default
Emacs config file. I write my config in the config.org file and
Emacs generates the file config.el -
Evil : This mode allows me
to use vim key-bindings. Thus I did not have to retrain the muscle
memory to learn Emacs -
Magit : Used to manage git repos. Magit is
a Git porcelain. It exposes a lot of gits high level functionality
through a very easy to use interface. The best thing that magit did
for me was that it got in the habit of staging only certain files or
sometimes even parts of a file really easily. Also magit logs are so
much better than git log -
Org-mode : This mode is just
phenomenal. It is a mode where Emacs does incredibly amazing things
with just text files. Before using org-mode I had struggled a lot
with to-do lists. The first thing that org-mode did for me was to
remove that problem from my life. After using it for sometime I
wanted to configure org-mode for myself and it was very easy to do
so. So at this point I have a configure-able to-do list
application. But there are other uses more fascinating than the
to-do list thingy. Org-mode files being just text files are
incredibly easy to read even if you do not have Emacs. Thus you are
not dependent on Emacs. -
Open-ness : The documentation part of Emacs is like the Cherry on
top. Emacs is like the truly Free and Open Source software. Since
it is written in LISP which is not compiled, we can view every
source code that is used in Emacs. In-fact most of the plugins that
are installed are just big elisp files. Thus, technically it is very
much possible for a user to change the code of Emacs while it is
running. In-fact this is exactly what we do when we change the config
file and load it. -
Documentation : Emacs embraces documentation like a boss. With
Emacs you have complete transparency. Using the help menu you can
see anything you want about emacs' internals. This includes
variables that are defined within Emacs, definition/descriptions of
proceudres (yes!! you can type a procedure name and Emacs would pull
up the procedure description, if you want then you could visit the
file where the procedure is defined and change it and the changes
would be reflected dynamically (you would still have to eval the
file(s) that you have changed)). Apart from that you can also query
keybindgins and Emacs will tell you which functions is that key
bound to. This is particularly very useful when you want to figure
out what a key-binding is doing (look at the procedure definiton and
so on!!). IMHO no other editor even comes close to this
feature. This self-documenting feature was a life saver for me when
I was starting out with Emacs. -
Writing Documents : I really hate using a word-processor and
honestly sometimes using LibreOffice is not so much fun. With
org-mode I can just write a file in org-mode and then export it to
any desired format. And this export is not a shitty export. Org-Mode
actually creates a hierarchical index based on the highlights in
org-mode. Moreover Org-mode can export the three main formats that I
need the most - odt, pdf, md (the markdown looks beautiful) -
Dired : The Emacs file manager. Dired is the file manager that
comes with Emacs. Now how many of you have tried to install a file
browser in vim because that makes it easier to navigate the source
code directory ?... Yeah.. Emacs has that built-in. Which means that
it was much well integrated with the rest of the stuff and also that
you do not have to put yourself through the agony of installing a
new plugin -
Package System : Emacs has its own package manager and its own
repositories. This means that installing a new package is as simple
as 'M-x package-installpackage-name '. Emacs will find
the package, download it, compile it and do the necessary things on
its own. Configuring the packages requires some more work but that
is also taken care of by the configuration system -
Helm-mode : This is a
framework that enables you to quickly access anything within
Emacs. This means that with its fuzzy matching, it can fish for
commands even before you have finished typing your command. Thus you
can look for Emacs commands and files very fast. It uses an async
library in the back-end that makes it this fast. -
LISP : Emacs is the best possible IDE for learning
LISP. With Geiser I can now run a
scheme REPL inside Emacs while I write code and then execute them
from the file itself. This is just seamless and amazing. -
Server mode :
Emacs is quite heavy, so it takes some time to startup. This means
that the typical workflow which I used to have with vim would never
work here. With vim i would just open a new instance of vim wherever
I needed it. Vim is small and fast. But with Emacs it doesn't make
sense to open a new instance of Emacs for editing a new file. The
solution is to us the Emacs Server Mode. In this mode Emacs runs a
server daemon and we can use the program 'emacsclient' to connect to
the server. Emacsclient does not create a new instance of Emacs,
instead it connects to the Emacs server and merely opens a new frame
or it sends that file to the already opened frame. After editing the
file we can close that file and it will be saved normally. Thus now
I can edit a file from anywhere I want within this system. Also
editing the desktop entry to Emacs enabled me to add a code snippet
that will call emacsclient whenever I try to open any text file from
the File Manager.
Other Cool stuff¶
Here are some other interesting things that you can do with Emacs that
I want to try out.
- elfeed : This is a client
that reads RSS and ATOM feeds. - mail client : Some of my friends use Emacs as their email client. I
haven't gotten around to doing it yet. - EXWM : This is a window manager that uses Emacs. Its called Emacs
Window Manager. I have used it briefly but I have not switched to it
yet.
Conclusion¶
Emacs is great!
Vim is great too. (I also use vim when I am working on a server)
Emacs is a religion.