I've been learning to use the text editor Emacs. In this article, I explain why I think this is a good investment of my time.
I Initially Bounced Off Emacs
Several months ago, I decided that I wanted to revisit C++. While reading and watching videos, I noticed that people were either using Visual Studio (if they were working with Microsoft's tool-chain), or Emacs (if they were using open source tools). Ok, there were other IDEs too, but there were a significant number of Emacs users.
I'd tried Emacs before. For about an hour, after which I gave up on it and moved on with my life. I was happy using an IDE where you install it and get a text editor and a compiler bound together in one easy to use package. That was about 5 years ago, and in the mean time getting set up with Linux and command line tools has become much more natural to me. It seemed like a good time to give it another shot and try to understand the benefits. If Emacs is the tool that the community I'm watching is using, all the more reason to learn it.
At this point, I've gotten over the worst of the initial learning curve. I've finished a small personal project using Emacs (a bot for the Entelect 100k Challenge), and I'm still using it. I want to write down some of the reasons why it's working for me.
Language Agnostic Text Editing
Take a look at the IDEs offered by programming tools company JetBrains. Something you'll notice is that it's a different IDE for each programming language. This is how I used to do things. For C++ in university, I used CodeBlocks. For Java I used Eclipse. For C# I used Visual Studio. For languages that I didn't have a dedicated IDE for, like Markdown or Lilypond, I used Sublime Text.
The problem with this is that each time I wanted to try out something new, it would mean finding and learning an entirely new tool.
Emacs can handle all of these languages. The idea is that with extensions, you can add support for any language you happen to use. Anything common, like navigating around in files (or between files), setting up templates, actually typing, you only need to learn once.
Beginner Friendly vs Expert Friendly
I'm sure at some point, you've been making something, and stopped to think about who your target market is. Have you ever reversed that and thought about what sort of target market you want to be in?
Generally speaking, if you're choosing a tool, you can go for something that's beginner friendly, or expert friendly. Duct tape is beginner friendly. Give someone a piece of duct tape, they fairly quickly figure out the sticky side and the non-sticky side, and can make some stuff hold together. Welding is expert friendly. You're probably spending a long time making terrible welds and learning to use the tool, but an expertly welded joint is going to hold much better than one held together with duct tape.
Emacs is not beginner friendly. This is the reason I initially dismissed it. It's a perfectly valid reason, except...
I open a text editor almost every day. I program in my job. I have pet programming projects at home. I'm writing this blog right now. I spend enough time typing that using an expert friendly tool makes sense. You need to come in with the mindset of being willing to spend time to get efficient at it. At first, Emacs is difficult!
I use Linux where I can. Having the tool be open source means that it's
much more likely to be in the official package repositories. It's
convenient when setting up a new system to be able to just
pacman -S emacs.
How many tabs or spaces do you think should be used and where should they be? Your ideas on this are going to be different from mine, and that's OK. My tools on the other hand, need to keep up with my current preference.
Emacs takes customization to an extreme that you don't quite realize when you first start using it. That letter key you pressed? That's a function you can override. By default, it's calling the 'insert that character' function.
That's all well and good, but I'm a bit lazy. I don't want to develop my own IDE. Luckily, Emacs has a wide variety of open source extensions. Most of them have settings that you can tweak, like how many spaces to insert, without needing to rewrite the whole extension. You still spend a fair amount of time getting the settings and which extensions you want to use just right, but it's faster than writing your own extensions.
The point where I felt I could finally be productive with Emacs, rather than just learning Emacs for its own sake, was when I started bringing my favourite features from other IDEs into Emacs using extensions.
Emacs is great for some people. Specifically, people who spend a lot of time in a text editor, tend to jump between different programming languages, and don't mind putting in the effort to get things set up the way they want it. I think I'm one of those people, so I'm going to stick with it.