Using (Multiple) Emacs Daemons (Windows)
- Published on Dec 30, 2020 (updated 2021-02-06)
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)
[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] WantedBy=default.target
Starting and enabling daemon named
systemctl enable --now firstname.lastname@example.org --user and
systemctl enable --now email@example.com --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
runemacs --daemon=personal --chdir=%HOME% runemacs --daemon=work --chdir=%HOME%
runemacs.exe (and all the other executables) are in your PATH, and set
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)'"
Here are links to my dotfiles and Emacs configuration.
You may view or reply if you have an account anywhere in the Fediverse.
Recent posts from blogs I read Generated by openring
I got captions to flow from my phone to Node to Emacs to OBS to Twitch. There’s some delay, but it’s a good starting point that might come in handy for live captioning my own stuff. I added autocategorization to Emacs News. I tried out pretty-hydra. I wro…via sacha chua :: living an awesome life February 21, 2021
This is not always true, but in my experience, it tends to hold up. We often build or evaluate tools which aim to replace something kludgy^Wvenerable. Common examples include shells, programming languages, system utilities, and so on. Rust, Zig, etc, are tak…via Drew DeVault's blog February 21, 2021