Hacker News new | ask | show | jobs
by Jtsummers 1635 days ago
My initial motivation for using daemon mode was start up speed as my config had ballooned. I got it under control later, but emacs also got faster later so it was mostly moot in the end. Speed is no longer a motivator for me.

There are a few uses, for me, of daemon mode that have kept me using it.

First, like tmux and mosh, emacs daemon is persistent. Should I accidentally close it but not really intend to close it, everything is still there. Useful if you use emacs for more than just editing (like an IRC client). In that instance, all my buffers are still present and anything that needs ongoing execution will continue to happen.

Second, I never got used to using emacs as my shell. So I drop back to the shell for most of my filesystem navigation and running various CLI tools. With the daemon running in the background, this means I can close the client, navigate or run programs, and reload the client with everything in place or while opening a new file.

Third, I often use multiple daemons, one for each project/language. I use the shell to go to the project root and launch a new (named) daemon. Then when navigating around the project in the shell, I can open a file for editing using the appropriate client incantation. This lets me keep a full emacs daemon running but with only the appropriate buffers and subprograms (useful when dealing with interactive languages like Lisp or Erlang, where I may also have a project-specific REPL running).

Fourth, I use magit and tmux. So I usually split my window into two panes with editing/navigation/CLI activities on the left and magit on the right. The magit instance gets to share the same kill ring and buffers as the editing instances on the left. I know I could do the same by splitting the frame left and right the same way, but this has become my preferred interaction. Plus, since I don't use emacs' shell mode I often further subdivide the panes anyways, like editor in the top left, magit on the right, and shell in the lower left with fswatch running tests continuously.

I suppose that if I just did everything in emacs (including the shell and file system navigation) then it would be less useful. But I don't, so it's very useful.

1 comments

Thanks for this great explanation! These do sound like useful reasons for daemon mode. My workflow is pretty different, so some of these wouldn't apply to me, but it does give me a lot to think about plus some potential workflow tweaks.

The multiple daemon approach is intriguing. I don't think I've run across anyone discussing that before, although a quick search turns up a few posts/threads that I've missed.