Emacs - Two years later
It has now been over two years since I started to seriously learn Emacs. When I started, I struggled a lot, always fighting against my vim muscle memory. Today, I want to do a small retrospective - after two years of usage, I feel more able to pass fair judgement than after a week ... no surprise here, huh?
For your convenience, you can find my old article here:
Coming from vim
As I wrote in the old article, I once was a passionate user of vim. I own the second edition of Practical Vim, I read it twice and I did as much in vim as I could. Since I was working in Java at the time, there still was a lot that I could not do (comfortably) in vim, but everything else, I did in vim: Using git, doing searches over the whole project (and postprocessing the results), editing scripts - everything.
As a new Emacs user, I struggled with the rather primitive appearing text editing (ever heard the joke that Emacs is a great operating system, missing a good text editor?). Vim allows editing at the speed of thought, as the previously mentioned book tells you: Copy a line, jump to the next quote and replace the quoted text with the copied line - all in very few key strokes representing commands that compose very well. In Emacs? I still feel that these operations would require a greater mental load and more key strokes, but packages like avy or expand-region help tremendously.
I guess that there is a reason why many users swear by evil, the incredibly well done emulation of vim inside of Emacs (which I do not use).
Today, a lot has changed. I do whatever I did in vim in Emacs now. Thus, I banished most deeper vim knowledge from my active memory. I am sure I could easily relearn it (most things in vim just make sense), but currently I feel very awkward when using vim. The same effect I had when switching to Emacs occurs in the reversed direction whenever I have to edit text with vi or vim now: I try to execute Emacs commands and have to force myself to remember how things were in vim land. I have not used the terminal emulation in vim at all in the last two years and am very certain I would struggle a lot with it - and I used it every working day for years!
So, even a die-hard user of vim can totally be assimilated by Emacs, if so desired. And I am happier for it and miss vim only for sentimentality reasons - and very rarely.
And just a few days ago, I did the unthinkable and uninstalled vim from my OpenBSD notebook.
Being an Emacs user
Of course, Emacs is more than just "not vim". It is a very special little program that, like in the joke mentioned above, often feels more like an operating system.
Learning a new text editor or even an IDE is not much more than learning some new keyboard shortcuts or maybe some advanced configuration options. Switching from Eclipse to Visual Studio cost me almost no time and energy, since both environments are quite similar. I used Notepad++ and Sublime Text in the past, I can use Visual Studio Code without any cognitive effort - as long as I try to ignore how much I hate Electron. But learning Emacs is a different beast - even more than learning vim was!
Being an Emacs user takes a certain attitude. I believe that if you like Emacs, then you are bound to prefer plain text over other formats, prefer mastering your tools over just learning enough functionality to do your job (forfeiting efficiency), and prefer adapting your tools to your individual needs over using the same tools with the same configuration for the sake of uniformity.
By preferring plain text, you stay in the domain of what Emacs does best. Emacs has lots of cool tools for editing text - some built in, some as packages. I mentioned occur and wgrep in my first article: Both are ways of not only searching very efficiently through text files, but also for editing the results and the corresponding files, which is awesome for renaming variables, constants or functions. Nowadays I am using the ripgrep package "rg", which also allows editing directly from the search results - I can warmly recommend it. I will tell you more about plain text in the section about Org Mode below.
By preferring to master your tools, you will not be satisfied by knowing just how to search, copy and paste. If you think that this is all an editor needs, even Windows notepad will work for you. Instead, you want to learn how to reduce toil by finding the most ergonomic ways of solving your tasks. In Emacs, this might be by using keyboard macros, or by writing some elisp functions (or even a new Emacs mode). It might be by learning the included diff tools or the more advanced search functions, like using query-replace-regexp combined with calling an elisp function for each hit. Most importantly, it might be by learning to combine multiple parts of Emacs in a way you never did before. I feel that everything in this editor has so much potential for synergy that just lies their, waiting for you to notice it!
By preferring to adapt your tools to your needs, you acknowledge that everyone thinks and works differently. I come from a team where we even shared the same Eclipse configuration via git - and this configuration could neither be diffed nor merged easily. I often felt this was holding me back, as if we were reducing everyone's potential to the least common denominator. Please do not misunderstand me here: There were highly efficient individuals in my team that did not feel this way, but I suspect that this might be because the shared configuration was more to their liking. To me, being able to configure Emacs to do whatever I need it to do in the way I want it to be done is just so much more valuable. And this means I am happier for it, which always is a very subjective thing.
That said, I must warn you: There is a certain siren's call which invites you to write just one more function or tinker with just one more package. This often is a productive use of your time, but it can easily be not so if you are not careful.
Living in Emacs - Org Mode Let me now tell you about one of my
favorite packages: Org Mode. Like Emacs itself, learning Org Mode takes some time. At first, I did not really see the use. I remember how a former colleague showed me, back in 2010, how he manages his tasks in Org Mode and I did not see the point: Okay, it is a task list in a text file ... hardly world shaking!
Part of my lack of appreciation comes from me not taking much notes back then. The more experienced I get, the more I like having lots of detailed notes about my work, and I like them in plain text files, searchable and diffable.
So, nowadays I manage my tasks in Org Mode. I take notes, I archive all knowledge that might be useful should I ever have to find out what I have done after years have gone by. And I can do so using my favorite text editor - is that it? Sounds like Org Mode is similar to just writing a markdown file, right?
No, Org Mode is more than that - and I am sure I am using only the figurative visible part of the iceberg. Org Mode contains, for example, support for textual tables that not only are always automatically aligned, but also can calculate cell values using formulas, like you might do in Excel or Libreoffice Calc. Org Mode also supports clickable links (that of course can also be used without moving your mouse) that open files or web pages, both inside Emacs or using external programs, or that execute any elisp function you want.
I have two use cases for combining Org-Mode tables and links that I am especially proud of and that I want to describe briefly.
The first one is a private document I am using as my video watchlist. I like to watch youtube videos, but I cannot keep up with them as they are released. This is no problem for me, I can watch them in my own tempo. I also often do not have time to watch the whole video at once. And finally, I really prefer not having to watch them in the browser - I want to use vlc instead.
For this, I have a table where I can paste links in the first column. The next columns are automatically calculated via formulas. Column two uses yt-dlp and retrieves the video's title. The third column however is the most cool one: Its formula generates a clickable link with text "PLAY" that can execute an elisp function that takes the corresponding URL and plays the video in vlc, using my preferred video format. I have also added some more manual columns that contain notes or at what point of time I want to resume the video the next time.
My second use case is similar: At work, we have multiple test executables written with Google Test. I want to have more comfort executing them and I want to sometimes only want to execute tests matching a filter.
I created a document containing a table with three columns: The name of the test executable, the filter string (if any) and a third column calculated via a formula. This formula, like the one before, generates a clickable link that executes the correct executable and optionally passes the filter string via the command line. For even more comfort, I also remember the last combination executed via this table. I have a global keyboard shortcut configured for repeating the last test execution without having to switch to my test document and selecting the right link.
These two cases are examples where I took a small amount of time to create a system that not only makes me more efficient, but I am also happier while using it. In my eyes, Emacs and Org Mode are a very flexible GUI toolkit with great support for RAD (rapid application development). It reminds me of my times with Visual Basic 6 and Delphi ... they do not make them like they used to!
The rabbit hole of using Emacs is deep and I am still there, exploring it. I certainly tried, but I actually have no words to express how great this editor has been and how satisfied I am with my decision to learn it and keep using it.
If you have read this far, there is a good chance that you are shaking your head. Either you are an Emacs user yourself and wonder how I could leave out mentioning the "real" best feature (whatever this might be in your eyes), or maybe you prefer other tools like IDEs or maybe Visual Studio Code and just think that I am having my priorities backwards by using an old, hard to learn tool instead of something more modern.
If any of these cases is true: That is okay. Like I said, Emacs is about individuality, and my way is definitely different from your ways.
I hope you still liked reading about my love for this little program. I will keep using it and I will try writing some smaller articles about specific features or customizing in the future.