Cool Emacs

Multiprocess Emacs environment

The more you move into Emacs, the happier you may become. But at the same time, Emacs is not a real shell, but a text editor. This means there is no real way to manage functionality similarly one would manage applications. It’s all a buffer - the file you opened, each IRC channel, email list, and so on. There are ways to manage it, like dedicated “workspace” plugins1 or simple tabs. But all those don’t fit my mental model. I am “Editing a file” or “chatting” or “writing a web page”. Those are separate concerns, so I want to have dedicated spaces for them.

At the same time I want them in Emacs, as it gives me a unified interface. I don’t need to think how to change IRC channel, how to spell check, or how to actually write in my selected keybindings.

Dedicated Emacs instances

This led me to use multiple, dedicated Emacs instances. This way, I’ve a got a dedicated IRC client, Code editor, Notepad, Email client, and so on. I have unified interface, but at the same time it’s still akin to dedicated programs.

This has the added benefit of fault protection. Tramp session hanging entire Emacs doesn’t disconnect me from IRC, as those are separate processes.

Therefore, I have functions which I call ultimate modes2 to configure Emacs for given use case.

A simple ultimate mode for IRC would look like:

(defun mms-irc-mode()
  "use this instance of Emacs for IRC"
  (interactive)

  (load-theme 'ef-bio)

  (erc-tls :server "irc.tilde.chat" :port "6697"
           :nick "mms" :full-name "https://michal.sapka.me")
  (erc-tls :server "irc.libera.chat" :port "6697"
       :nick "mms" :full-name "https://michal.sapka.me")
  )

This simple function:

  • Loads a dedicated theme, so I won’t get lost. IRC is a happy place, therefore green.
  • Connects me to my servers

ERC is configured elsewhere, so all auto-joins are there, just redacted, but nothing limits the number of things the ultimate mode setup up. Want to defer loading of bigger package? Want to reconfigure Ispell language? Or maybe you want to load parts of Emacs configurations only when they make sense? Shy is the limit!

Now, I can either run Emacs and call mms-irc-mode or have a dedicated OS level key binding to run Emacs in this mode via:

emacs --eval='(mms-irc-mode)'

This method could easily be expanded to run dedicated emacs servers and connected clients, but I wanted a simpler way.


  1. Like perspective.el ↩︎

  2. Yes, it breaks the musical theory naming scheme. I could have used “tonic” there to run the erc and pla play with the wordplay, but I decided against it. Dammit Jim, I’m an engineer, not a musician! Also, diatonic modes don’t fit the “larger than major” mode. ↩︎


Previous: Emacs as a Shell, Next: Input Completiton, Up: Cool Emacs