Andrew Wong <[email protected]> skribis: > Greetings! > > Recently I’ve been trying to have an Emacs daemon start in the background on > login. On Guix, I’ve found some interesting behavior in that an Emacs started > with no args and then the command “server-start” will then be available to > subsequent emacsclient calls, but an “emacs —daemon” is inaccessible, even if > I call the command from my WM startup. > > 1. Does anyone understand why Guix’s design results in this behavior? > 2. How can I set up a service in my configure-home.scm to start emacs —daemon > (and have it be available) on login? I found a post from 2019 about it, but it > must be outdated as it doesn’t mention the Guix home feature. > > Thank you for your assistance, > Andrew
Hi.
In my Guix home configuration, I use the following service to start an
Emacs server:
--8<---------------cut here---------------start------------->8---
(define (emacs-server-shepherd-service config)
(list (shepherd-service
(documentation "Emacs server.")
(provision '(emacs-server))
(start #~(make-forkexec-constructor
(list #$(file-append emacs "/bin/emacs")
"--fg-daemon")))
(stop #~(make-kill-destructor)))))
(define home-emacs-server-service-type
(service-type
(name 'home-emacs-server)
(extensions (list (service-extension home-shepherd-service-type
emacs-server-shepherd-service)))
(default-value #f)
(description "Run Emacs in server mode.")))
(home-environment
...
(services
(list ...
(service home-emacs-server-service-type)
...)))
--8<---------------cut here---------------end--------------->8---
Then, using "emacsclient -n -c some-file" works.
signature.asc
Description: PGP signature
