Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is that possible to persist overlay information? #63

Open
xuning97 opened this issue Aug 17, 2020 · 2 comments
Open

Is that possible to persist overlay information? #63

xuning97 opened this issue Aug 17, 2020 · 2 comments

Comments

@xuning97
Copy link

So next time, when the file is reopened, those overlay still exists.

@purcell
Copy link
Collaborator

purcell commented Aug 17, 2020

Not currently possible, but if you can make symbol-overlay-keywords-alist persist somehow, then that should do the trick. I'm not aware of any packages for persisting buffer-specific variables over time, but I imagine such a thing exists.

@florommel
Copy link

Built-in desktop provides functions to save and restore sessions. It has a desktop-locals-to-save list.
Do something like this to restore the overlays when loading a session:

(defun desktop-after-read-restore-symbol-overlay ()
    (require 'symbol-overlay)
    (run-with-idle-timer
     0 nil
     (lambda ()
       (dolist (buf (buffer-list))
         (with-current-buffer buf (symbol-overlay-after-revert))))))
  (eval-after-load "desktop"
    (progn (add-to-list 'desktop-locals-to-save 'symbol-overlay-keywords-alist)
           (add-hook 'desktop-after-read-hook #'desktop-after-read-restore-symbol-overlay)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants