branch: externals/org-remark commit 57bd3ab8472941474303c8dfe766b518b47eea91 Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
add: tracking-save to local kill-buffer-hook --- org-marginalia.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/org-marginalia.el b/org-marginalia.el index 39c6a785cc..aea9fd3ca0 100644 --- a/org-marginalia.el +++ b/org-marginalia.el @@ -253,7 +253,8 @@ the mode, `toggle' toggles the state. (org-marginalia-mode ;; Activate (org-marginalia-load) - (add-hook 'after-save-hook #'org-marginalia-save nil t)) + (add-hook 'after-save-hook #'org-marginalia-save nil t) + (add-hook 'kill-buffer-hook #'org-marginalia-tracking-save nil t)) (t ;; Deactivate (when org-marginalia-highlights @@ -261,7 +262,8 @@ the mode, `toggle' toggles the state. (delete-overlay highlight))) (setq org-marginalia-highlights nil) (setq org-marginalia-loaded nil) - (remove-hook 'after-save-hook #'org-marginalia-save t)))) + (remove-hook 'after-save-hook #'org-marginalia-save t) + (remove-hook 'kill-buffer-hook #'org-marginalia-tracking-save t)))) ;;;###autoload (defun org-marginalia-mark (beg end &optional id) @@ -678,6 +680,8 @@ notes of the entry." (defun org-marginalia-housekeep () "Housekeep the internal variable `org-marginalia-highlights'. +This is a private function; housekeep is automatically done on +save. Case 1. Both start and end of an overlay are identical @@ -689,8 +693,6 @@ Case 2. The overlay points to no buffer This case happens when overlay is deleted by `overlay-delete' but the variable not cleared." - - (interactive) (dolist (ov org-marginalia-highlights) ;; Both start and end of an overlay are indentical; this should not happen ;; when you manually mark a text region. A typical cause of this case is