Open xuning97 opened 4 years ago
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.
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)))
So next time, when the file is reopened, those overlay still exists.