Using (Multiple) Emacs Daemons (Windows)

GNU Emacs’ performance on Windows at times feels a bit sluggish/ slow. It still randomly crashes sometimes when I use the menu bar but I haven’t figured out why. Of course, the daemon/ server-mode can be used, however, you can also run multiple daemon(s?)!


  • Separation (if you have a clear separation between types of buffers/ things you have open)
  • Emacs processes/ packages that frequently block input/ do not respond.
  • (on windows, if one daemon crashes I -could- quickly switch to another one lol)


On my GNU/Linux laptop, this was easy: just create a user systemd file.

Make sure it starts after boot instead of after login: sudo loginctl enable-linger $(whoami)

In ~/.config/systemd/user/emacs@.service:

[Unit] Description=Emacs daemon [Service] Type=forking ExecStart=emacs --daemon=%i --chdir %h ExecStop=emacsclient --server-file=hud --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))" Restart=always TimeoutStartSec=0 [Install]
Code language: JavaScript (javascript)

Starting and enabling daemon named personal and work: systemctl enable --now emacs@personal.service --user and systemctl enable --now emacs@work.service --user.


On Windows, I struggled to find a way to launch the daemons on login – Task Scheduler didn’t seem to work.

My solution was creating start-emacs-daemons.bat in C:\Users\earne\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup:

runemacs --daemon=personal --chdir=%HOME% runemacs --daemon=work --chdir=%HOME%

Make sure runemacs.exe (and all the other executables) are in your PATH, and set %HOME% to C:\Users\YourUsername. Then just click the file to start the daemons for the first time, although after this they should automatically launch on login.


I placed these in my ~/.bashrc (I use Git Bash on windows and just regular bash on GNU/Linux, so this works fine)

## personal Emacs Daemon alias pe="emacsclient --server-file=personal" alias pew="emacsclient --server-file=personal --create-frame --no-wait" alias pk="emacsclient --server-file=personal -e '(kill-emacs)'" ## work Emacs Daemon alias we="emacsclient --server-file=work" alias wew="emacsclient --server-file=work --create-frame --no-wait" alias wk="emacsclient --server-file=work -e '(kill-emacs)'"
Code language: PHP (php)

More Reading

Here are links to my dotfiles and Emacs configuration.