What are you trying to do?
i am trying to save the variable evil-markers-alist
when calling doom/save-session
(which is
basically a wrapper for desktop-save
). so that when i call doom/load-session
(wrapper for
desktop-read
) all global marks are restored.
the issue might be, that evil stores marks in the variable evil-markers-alist
as markers an elisp
datatype that can’t trivially be serialized and restored later.
in a similar post:
hendrik proposes the solution: “we have to swap out those markers with (path . pos)
cons cells,
where path is a string and pos is an integer.”
my attempt at solving the problem
(after! desktop
(add-to-list 'desktop-globals-to-save 'evil-markers-alist) ;; alternatively maybe use: `desktop-locals-to-save` ?
(add-hook! 'desktop-locals-to-save
(kill-local-variable 'evil-markers-alist)
(dolist (entry evil-markers-alist)
(when (markerp (cdr entry))
(setcdr entry (cons (file-truename (buffer-file-name (marker-buffer (cdr entry))))
(marker-position (cdr entry))))))))
results
this attempt does correctly serializes the variable, however after doing the following:
- opening a file
- setting a global mark with
m M
- calling
doom/quicksave-session
- restarting emacs
- calling
doom/quickload-session
- accessing the mark:
' M
i get the message that the mark is not set (even though it should have been restored).