[Unit] Description=Emacs: the extensible, self-documenting text editor [Service] Type=forking ExecStart=/usr/bin/emacs --daemon ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))" Restart=always User=%1 [Install] WantedBy=multi-user.target
That should be
User=%i
instead of
User=%1
You're welcome.
]]>While you look for a proper solution, you might be best off using
emacsclient -c -a ""
by binding it to something in your wm/de, or by making an alias for it in your .bashrc. It will start an emacs daemon if one isn't already running, then proceed to create a client window. (or emacsclient -t -a "" for in terminal)
What is the output of ps -aux | grep emacs ?
$ ps aux | grep emacs
ian 729 0.0 0.0 12112 1108 tty1 S+ 13:21 0:00 grep emacs
My output:
<username>.service - Emacs: the extensible, self-documenting text editor Loaded: loaded (/etc/systemd/system/emacs@.service; enabled) Active: active (running) since Tue, 2013-01-01 14:07:07 EST; 7min ago Process: 4822 ExecStart=/usr/bin/emacs --daemon (code=exited, status=0/SUCCESS) Main PID: 4823 (emacs) CGroup: name=systemd:/system/emacs@.service/<username> |-4823 /usr/bin/emacs --daemon `-4833 /usr/bin/aspell -a -m -B --encoding=utf-8 --sug-mode=ultra
Have you tried running it with the default .emacs.d & init.el?
Same result: failed, status=217/USER.
]]>
<username>.service - Emacs: the extensible, self-documenting text editor
Loaded: loaded (/etc/systemd/system/emacs@.service; enabled)
Active: active (running) since Tue, 2013-01-01 14:07:07 EST; 7min ago
Process: 4822 ExecStart=/usr/bin/emacs --daemon (code=exited, status=0/SUCCESS)
Main PID: 4823 (emacs)
CGroup: name=systemd:/system/emacs@.service/<username>
|-4823 /usr/bin/emacs --daemon
`-4833 /usr/bin/aspell -a -m -B --encoding=utf-8 --sug-mode=ultra
Have you tried running it with the default .emacs.d & init.el?
]]>You're not actually typing <username> are you?
Goodness, no. I'm putting my actual username there. I also did run "sudo systemctl enable emacs@<username>".
]]>[Unit]
Description=Emacs: the extensible, self-documenting text editor
[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Restart=always
User=%1
[Install]
WantedBy=multi-user.target
When I run "systemctl start emacs@<username>", it fails:
$ sudo systemctl status emacs@<username>.service
emacs@<username>.service - Emacs: the extensible, self-documenting text editor
Loaded: loaded (/etc/system/emacs@.service; enabled)
Active: failed (Result: start-limit) since Tue, 2013-01-01 09:19:09 AST; 4min 25s ago
Process: 5621 ExecStart=/user/bin/emacs --daemon (code=exited, status=217/USER)
CGroup: name=systemd:/system/emacs@.service/<username>
Any ideas why the exact same service file might start on one computer and fail on another? If I just run "emacs --daemon" manually (or in ~/.xinitrc) it starts just fine.
Thanks.
]]>