Screenshot of Emacs

Learning to use Emacs was the one of the things that 2020 pandemic gave me the time to really get to grips with. I had been trying on and off for a few years with Emacs, but I was put off by having to learn elisp just to configure it. This year I have come round to accepting as an elisp interpreter, that lets me work with text.

When I had seen it as being just a text editor, it always annoyed me that I had to copy a wall of elisp from somewhere on the internet to make some minor change to the way it worked. I think to a certain degree, it is true what they say about Emacs being a great operating system, but lacking a good editor. When you are starting out, it is hard to get your head around how deep a rabbit hole it really is, because you mistake it for being a mere text editor. There is a built in newsreader, email, Tetris, and a million other things out of the box that I haven’t discovered yet.

I don’t do a lot of programming, so there was no pressing need for me to commit to a text editor, I always ended up using whatever came to hand. I had been spending more time in Jupyter Notebooks anyway. I lost a few notes I had on the Notes app on iOS and that got me worried about moving some of those notes to plaintext somewhere that I could sync. Looking at some of the options like Bear and Evernote, I never found a satisfying option that could work between my Mac and Debian systems that was worth putting in the effort.

It was during this search about two years ago that I came across this video by Harry Schwartz on getting started with org-mode. I was sold on org-mode after I had see the video, and when I saw that it could be configured to look pretty amazing, I was all in. I started with a really helpful video series on YouTube by Mike Zamansky. Mike’s videos helped me to see how someone uses Emacs in their workflow, understand its package ecosystem and learn how to configure it. I used the first version of my init file for a little with me for a little while but I forgot all of the shortcuts quickly. I focussed too much on installing packages and it never really stuck with my workflow.

What got me inspired to start fresh and try again was seeing some of Protesilaos Stavrou’s videos on YouTube. This guy is the definition of a wizard, his video on the core principles of Emacs above is a really good place to start. Watching him use Emacs made me want to learn more about the tool and make use of its built-in self documentation. I managed to stick with it, using it as my main email client with mu4e has forced me to open it everyday and use everyday. Disabling the arrow keys in the init file really helped too, I hated it at first but it forced me todo things the ‘Emacs’ way. I find it uncomfortable when I have to take my hands of the keyboard in other apps, but accidentaly pressing C-y everywhere is starting to get annoying.

I also started to learn a bit of elisp so that I can configure it to behave the way I want. Every time I have tweaked the editor, domesticating it to do exactly how I want it to do something, I’ve felt it becoming more and more like it’s my tool. It’s hard to use something else once you have passed that point.

For instance, inspired by this, I put this together a function to flash spelling mistakes found by flyspell when you jump between errors using C-, which has really sped up my editing in Emacs:

(defun pulse-momentary-highlight-word (point &optional face)
  "Highlight the word at start of point.
Optional argument FACE specifies the face to do the highlighting."
  (save-excursion
    ;; flyspell-goto-next-error always takes you to start of word
    (let ((start (goto-char point))
	  (end (save-excursion
		 (forward-word)
		 (point))))
      (pulse-momentary-highlight-region start end face))))

(defun pulse-word (&rest _)
  "Pulse the current word."
  (pulse-momentary-highlight-word (point)))

(advice-add 'flyspell-goto-next-error
	    :after
	    'pulse-word)

Check out my init file on gitlab.