Writes to saveplace are not persisting after the emacs daemon stops.
Saveplace is configured in my init file as:
;; saveplace remembers your location in a file when saving files
(use-package saveplace
:config
(setq save-place-file (expand-file-name "saveplace" savefile-dir))
;; activate it for all buffers
(save-place-mode t))
I'm using systemd for the emacs daemon:
[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
[Service]
Type=simple
ExecStart=/usr/bin/emacs --fg-daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure
[Install]
WantedBy=default.target
When I run kill-emacs
or save-buffers-kill-emacs
and then query the contents of saveplace, its contents accurately reflect the last cursor position in each buffer. However, if I then run $ systemctl --user restart emacs
, the file reverts to the contents it had before the last emacs session. If I open saveplace in vim and write the file contents before restarting, they persist past the daemon restart. So, I thought it might be an issue with the buffers not flushing, but if I run $ sync saveplace
and then restart the daemon, the correct contents do not persist.
What's going wrong here and how do I fix it?