Emacs

4 min read

What is Emacs?

Emacs is just an editor. Or is it an operating system? Well, for many coders it is a religion. there were times when people used to live in it. It has everything a OS has. Games, compiler, IDE, Email client, a web browser and what not. But times has changed, there are better web browsers now and games too. So, you won't prefer to live in it, but yes, you'll sure want to use it for all your coding.

Why Emacs and not other editors?

It's been a long time that I have started coding. I'm an embedded developer and I mostly work in C and on Linux. I started with VI/VIM. I used it for 8 months, and at that time I didn't even know that there is any other editor and I was working on very limited no. of lines.

Eventually, someone introduce me to ATOM. Well, it was very attractive as it has a great GUI. Fancy colors, file bar, git support and all. But soon I realized that it is hard to modify. For everything you have to find a suitable plugin and biggest disadvantage was the over use of mouse which was actually slowing me down. After using it for 6 months, I wanted to move on to something better which I can use for long time instead, which is extendable and have no bounds.

As I understood that a editor is very important when you're working on large code bases and it directly affects your performance. I started looking for better one. As I was searching, I came across Emacs.

"Hard to learn", "very steep curve of learning", "too vast", sort of comments I read. But many good programmers use it. Once you learn it, your life will be easier.

Is it really worth to spend a lot of time to understand just an editor? What does it offer? Well, I'll put it very simply. It is modular and you can write your own modules(plugins), if you get stuck at some point.

To be honest, it is very old and there are lot of plugins already. Whatever you see in other editors, it is already there. They may have copied it from Emacs(highly likely). You just name it, it is already there.

Git support, Auto-complete, email client, c-scope support, support for all languages, you can open a terminal from inside and run a script or just add a shortcut button for all this. A directory tree like atom, and much more.

How to start?

After installing Emacs, you will see that it is just an editor. I suggest you to install GUI version as it will be hard starting with terminal version and I don't want you to give up at very early stage. Cut yourself some slack and be easy on yourself, install GUI version.

Use this command to install on linux

sudo apt-get install emacs

Now, it is configurable editor and you can make it an OS if you want to configure it like that. To configure it, you have to create a .emacs file in your home directory. Believe me, you will not even be able to copy text with CTRL + C. It is completely different. So press CTRL + H and follow the manual to learn basics. It takes time to fathom each and every shortcut. At first, it'll be hard to learn, but eventually you'll get used to it and you'll start feeling the power of shortcuts.

How to configure?

.emacs is configuration file, it is loaded on every startup of Emacs, but it understand e-lisp only. Emacs version of lisp language. But worry not, you're not writing much into it. A little understanding will be enough to start. Add your custom shortcuts, plugins to load and every, default directory, colors to display, indentation and everything.

Example for .emacs is at the following link.

Does it work in windows?

Well, it does as same as it works for Linux. A small change may be needed in .emacs file. On windows, I tried eclipse and visual studio code. Eclipse is meant for java and doesn't have much support for C. Visual studio code is cool, but again, it is not much configurable and overuse of mouse will always slow you down.

Example .emacs file

Here's the link to the *.emacs *file that I use currently. Hope this helps. Create a .emacs file in your home directory and copy following contents.

https://github.com/mahathug/emacs_linux/blob/main/.emacs

Enjoyed this article?

Subscribe to get the latest deep dives on Linux and Security delivered to your inbox.

Subscribe to Newsletter

Get the latest articles on Linux, cryptography, and security delivered to your inbox.

No spam, unsubscribe anytime.

Comments Coming Soon

We are building a privacy-focused, secure commenting system. Stay tuned!