Revisiting Emacs ---------------- date: 2022-11-15 14:09:59 EST ## In the Beginning As a Vim nerd, Emacs has been on my radar for as long as I've been nerding over text editor productivity (probably ~5yrs ago towards the end of college). In fact, my journey with Emacs starts much earlier. My second semester of college, we had a systems programming course where the first couple labs were on a VM. I remember SSHing in, sitting in my dorm hallway, and thinking to myself "now what"? That moment of hopelessness when you realize that all the files aren't on your local filesystem and you can't use whatever editor you are accustomed to (I must have been using Eclipse at the time, since Java was the intro language). A friendly neighbor said "oh just type 'emacs FILE' to get an editor". And so it was that I used emacs years before touching Vim. The subsequent labs ended up adding a graphical desktop to the VM with Sublime Text installed, so I didn't end up diving deep into Emacs, but it was there first. ## Over the Years I vaguely recall trying out Emacs around the same time I was getting very into Vim. It's sad to say that I very much fell for the tribal nature of the argument and swore affiliation to Vim before giving it an honest try. There were all sorts of politics involved too. Who was this RMS guy? Do I agree with his beliefs? (this predated the scandals, which are out of scope of this piece). At the time, and for the years to follow, I was sold on the fact that Vim was _efficient_. I bought into the "Emacs is the whole toolshed and Vim is a paring knife, much more efficient for surgical edits" saying. When I made it into industry, I was surprised to find that the majority of my team were Emacs enthusiasts. I resisted and became the Vim holdout (this has been the only team I've worked on with this situation--now it's much more a Vim holdout vs VSCode). Vim was already in my fingertips, and I knew all the power features (:tags, :jumps, etc).. why learn something new? I gave evil-mode a spin, but it felt a bit "off". All too often I'd pop into a buffer in another mode (like Magit) and find myself completely unable to switch back with vim-like window motions (and at a loss of how to proceed). To top it all off, I was convinced Emacs was very much against the UNIX philosophy--it didn't do one thing well! Who needs tetris in a text editor? I became interested in minimalist computing (suckless, cat-v, etc) where Emacs was the butt of many jokes. ## Coming Back Over the past few months (but really dating back years), I've become more and more interested in LISP, specifically Scheme, and it led me back to Emacs. Now, I think it's totally possible to write LISP in Vim. But there is a natural tendency for LISP lovers to find themselves using Emacs (and therefore the support is much better). I chalk this up to the fact that LISP isn't used much in industry, so Emacs is maybe one of the few chances these developers have to use the language in earnest. Maybe that's an over simplification. Mind you, it wasn't _really_ the promise of extensibility or customizeability *in the editor*. I had achieved "config equilibrium" with Vim; I had a small core set of plugins to be effective and knew the editor inside and out--my vimrc remained untouched for months at a time. The thought of _having_ to write hundreds of lines of elisp to customize an editor seemed wasteful. BUT, what I came to realize is that Emacs isn't about customizing *an editor*. It's about customizing a LISP platform for everyday productivity (beyond the scope of editing). Things like Email, IRC, gopher clients, web browsers, directory managers, and more are all written on Emacs *not* for the benefit of the editor, but because it's fundamentally a platform for applications (just like the browser has become a platform for web apps). The thought of a LISP platform, with a whole suite of discoverable, self-documenting, FOSS LISP apps is definitely appealing. Although I am still relatively partial to the "write one tool to do the job well" approach, I suppose you could argue that the elisp packages do one thing well on top of Emacs. I thus set out to give Emacs a fair shot. ## An Example Productivity Flow If we move beyond productivity during text editing, what does productivity look like? For me, the answer was usually shell scripts to automate redundant processes. A great example of this is my 'phlog' script described in [1] to start a new phlog entry: ``` die() { echo "$*" exit 1 } [ -z "$1" ] && die "usage: phlog TITLE" PHLOG=$(dirname "$(dirname "$(readlink -f "$0")")")/phlog i=1 nextfile() { file=$(printf "%03d.txt" $i) : $((i+=1)) } title="$*" underline="$(echo "$title" | sed 's/./-/g')" nextfile while [ -e "$PHLOG/$file" ]; do nextfile done echo "$title" >"$PHLOG/$file" echo "$underline" >>"$PHLOG/$file" date >>"$PHLOG/$file" ed "$PHLOG/index.gph" <1M LOC of LISP, but if the core is solid and makes a hackable platform, isn't that a properly designed platform/system? (note: didn't try to weed out test code, used David Wheeler's SLOCCount) In other words, Vim and NeoVim feel like they're gravitating towards Emacs, but with a fragmented community and a less capable extension language (even if they have a better core editor). I wonder if Emacs will have a revival? (but such a discussion needs to discuss the elephant in the room: VSCode, and that requires a whole other post!).