So, you want to live in emacs

April 7, 2020

M-x context RET

The year is 2020, you’ve run out of toilet paper, and you decide the time has finally come to learn emacs

You knew this day was approaching however you didn’t think you’d give in this easily

Welcome, my friend; allow me to enlighten you on the way of the holy editor GNU Emacs

C-h a intro RET

This isn’t a post where I gloat and show off my configuration (though that post is in the works) but, rather, a piece to give a gentle introduction as to what emacs is and why it may be relevant to you

Emacs has a rich history and has evolved over the years but I’ll let you read the Wikipedia article yourself. As for the question of what it is today, you’ll hear a lot of things depending on who you ask: A text editor? A symbol of free software? A way of life?

In order to better understand what emacs is and why all these different answers coexist, it’d be best to see where emacs fits within the larger picture of text editors

M-: (eval (differences))

IDEs (Integrated Development Environments)

When you’re picking up programming for the first time [whether it’s in a classroom or in an online course], you’ll likely install an IDE that, with one quick click, gets your environment spun right up

As you start going clickety clackety on your keyboard and write your first couple lines of code, the program won’t just show what you’re typing; it’ll color certain words that are important (syntax highlighting) and there may be a box at where you’re typing with suggestions as to what to type next (autocomplete). All in all, your IDE is a magical piece of software that, despite being a black box, gives you superpowers for writing software

Eventually, at a point, you may decide to learn a second language or work with multiple languages in the same project (ie writing a JavaScript application that gets served from a Python backend). If you’re fortunate, the IDE you’re using may have support for these new languages but you could still reach a point where you want to continue trying new things but are getting stifled by the editor you use

Extendable editors

While IDEs tend to cater to specific languages (ie NetBeans for Java), there are text editors that aren’t made for any particular framework, but feature a motley of available plugins that would enable you to write in multiple languages all with the same editor

In this category, the flow for getting started is installing the editor of your choice (ie VS Code) then installing the relevant extensions. Doing Go development? There’s an extension for that. Want to play around with Elixir? There’s an extension for that as well. The significant element of this is that you’re free to write in anything you like and have no limits on where you can go

It is also in this category that you can start tweaking with your editor beyond just the code you write. Want to change the visual aesthetic of your editor? Try out a new theme! Think your cursor is too boring? Try out power mode! Do you simply think your coding experience would be better with a nyan cat in the status bar? There’s an extension for that also

The reason you can go further to write in numerous languages and customize your editor to your own liking is because of the plugin ecosystem that exists. Extensibility is the crucial element that truly makes software powerful. Although, if you’ve spent enough time writing code in your editor, you’ll eventually see that it really is an editor and nothing more. There are a few failing points that you might come to see:

First, editing your code probably doesn’t go much further than moving using arrow keys or clicking around with your mouse. Surely this could be more efficient?

Second, making your own extension or introducing your own quirks isn’t always a simple process (for VS Code it involves an entire project). If you have a defined change in mind, you should be able to swiftly add it into your environment.

Lastly, you’re spending all this time in your editor yet the only thing coming out of it in the real world is the code you’ve written. Given the capacity of software, shouldn’t you be able to do more from within your editor?

Editors for life

Once you’ve prepared your mind and body, we can now proceed to the next tier of editors, the ones that last a lifetime. While you could technically build your own text editor and call it a day, it tends to be nice to work with something currently existing and maintained

The two contendors when it comes to “editors for life” are vim and emacs but, vim is purely an efficient text editor whereas emacs by default has the capability to be more than just a text editor (yes, there are nuances to be scrubbed out and that is deserving of a post of its own but I still stand by my statement)

Emacs, much like general purpose text editors, doesn’t have a specific language that it’s built for editing but boasts an expansive package ecosystem where you can customize your theme as well as introduce nyan cat to your status bar

However, one of the ways emacs really shines is in its potential use cases. Whereas IDEs and text editors only have applications in writing code, emacs can be utilized for writing, as a personal CRM, and even as a video editor. For most of the reasons people use computers, there is a good likelihood that someone out there has already built a package for it in emacs

What is the benefit of that? With efficient keybinds and simple configurability/hack-ability, you’ll eventually fall in love with writing code in emacs. When someone uses a software that has an elegant experience, they will start wanting to see a consistent experience in their other applications (every chat platform looks like Slack, every productivity tool wants to be the “Superhuman for X”, and the general startup ecosystem seems to be driven by whatever design trends are popular at the time)

As one last snippet about setting up your environment in emacs, everything is defined in a single init file. It’s because of this that you can have your configuration defined somewhere (I have mine on GitHub!) and then, with a single fetch, have your emacs set up just the way you like it. This almost ephemeral aesthetic can be beneficial if you’re regularly SSH’ing into machines or are severely distro-hopping (emacs is available in pretty much every distro’s package repositories)

My personal finds

Hopefully the previous rambles have given you some info about what emacs is and why it may be of appeal. In this section, I’ll share a few tricks I’ve come across from using emacs that may either interest you further or give you ideas for what to do with your current emacs setup!

Facebook Messenger

This, for better or worse, is probably the only thing people are most impressed by when I show my emacs setup. If you’re looking for the quick synopsis of how it works, here it is using arrows:

MQTT -> Bitlbee -> IRC -> erc -> Voila! You have Messenger in emacs

As a more expansive explanation, let’s backtrack to the early days of Facebook Messenger. Facebook, back in 2011, acquired a messaging company called Beluga to get their IP and so that the team could work on a new messaging application. After about half a year, they were able to release the first version of Facebook Messenger. What was noted by Lucy (one of founders of Beluga) is that, with the purpose of scalability, Messenger was based on a protocol called MQTT

Skipping the specifities of MQTT, all that’s needed to be known is that it’s a different protocol for communication between devices like HTTP or SMTP. However, in the space of open source messaging protocols, there is a wonderful project called Bitlbee that acts as a gateway between various protocols and IRC. And, there’s a plugin for Bitlbee that works with Facebook’s MQTT setup which effectively gives us a way to interact with Messenger over IRC

Then, as the last piece, you can use one of the various irc clients for emacs to have the final accomplishment of Facebook Messenger in emacs!

That’s not to say this is the only approach for Messenger in emacs; you could work with Facebook’s mobile site albeit that wouldn’t give you real time activity (it’d have a similar feel to email). Or, for the people who have nothing better to do caffeinated hackers, you could work with MQTT and emacs directly


Regardless if you do as much as you can in emacs or not, there are things that just can’t be done in emacs but, there is still hope. Allow me to introduce you to to exwm, Emacs X Window Manager!

Calling exwm a “window manager” may be a bit of a stretch considering it works by having emacs as the only running application modifying buffers with other applications nested in them. But, nonetheless, it can be really nice with a package like switch-window so, instead of Alt-Tab’ing in a generic window manager or taking bunny hops with a tiling window manager, you’re no further than four keystrokes from an application on your screen

emacs movements -> terminal

Have you ever encountered a situation where you’re typing out a bash command and you accidentally screw up somewhere?

$ git ebase origin/master

You’ve already typed so much and don’t feel like pressing the left-arrow key 19 times but you also don’t feel like typing it all over again. Luckily for you, the default input mode for most modern shells is emacs! What that means is you can use some emacs movements and press Alt-b 3 times to get to the start of “ebase” and fix your error in a jiffy

What’s nice about this is that the move keybinds work and, for searching through history, you can use C-r (which is isearch-backward in emacs) to find whatever previously entered command you’re looking for


I hope you learned at least one new thing from this blog post and this is actually my first one so hopefully I’m not setting the bar too low for ones in the future :)

Feel free to give me a follow on Twitter