Emacs in daemon mode is awesome, when it properly loads your init config

1024px-EmacsIcon.svg

I’ve recently made the switch to using Emacs in Daemon mode.

The primary benefit (for me) is super quick boot up time — and it’s been wonderful, except I ran into the problem today of having a large set of my configuration not working. A bunch of my trusty keybinds were gone, some packages weren’t loaded, and this led to sessions started with emacsclient -t not feeling quite like home.

Here are a few tips in case you run into issues with init config loading for you:

  • Make sure your init file is properly named (generally ~/.emacs or ~/.emacs.d/emacs.el are looked for on startup (Because the documentation said so)
  • Simple attempts at triggering --debug-init so I devolved to print-statement debugging (the message elisp function is your friend). Find out quickly whether your init file is being read at all by putting in some statements, and checking the *Messages* buffer once Emacs has started up.
  • If you want your Emacs to start a server in case there isn’t one already running, alias some command (like “emax”) to emacsclient -t -a ''
  • Often, the reasons that later parts of your Emacs init file won’t load are due to faulty requires, and possibly functions that assume there is a default frame (for example, I had a little bit of init code that opened and closed sr-speedbar, and it subtly erroring)
  • Remember to pkill emacs between bug fixing iterations
While somewhat painful, after getting all the problems fixed, you’ll have a wonderfully fast emacs launch speed, and probably a better grasp on elisp.