emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/annotate 07c015b2ad 1/6: - modified the function called wh


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 07c015b2ad 1/6: - modified the function called when kill-emacs-hook runs
Date: Tue, 9 Aug 2022 04:58:29 -0400 (EDT)

branch: elpa/annotate
commit 07c015b2ad2278b74171e187317e664a80281f02
Author: cage <cage@invalid>
Commit: cage <cage@invalid>

    - modified the function called when kill-emacs-hook runs
    
      The  new function  ensures  all the  buffer  where annotate-mode  is
      active save the annotationos in  the database; also this function is
      registered in the global hooks list.
---
 annotate.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/annotate.el b/annotate.el
index c340359cb5..7d418f9a10 100644
--- a/annotate.el
+++ b/annotate.el
@@ -469,7 +469,7 @@ local version (i.e. a different database for each annotated 
file"
   (annotate--maybe-database-set-buffer-local)
   (annotate-load-annotations)
   (add-hook 'kill-buffer-hook                 #'annotate-save-annotations t t)
-  (add-hook 'kill-emacs-hook                  #'annotate-save-annotations t t)
+  (add-hook 'kill-emacs-hook                  
#'annotate-save-all-annotated-buffers t nil)
   ;; This hook  is needed to  reorganize the layout of  the annotation
   ;; text when a window vertically resized
   (add-hook 'window-size-change-functions     #'on-window-size-change t t)
@@ -488,7 +488,7 @@ local version (i.e. a different database for each annotated 
file"
   "Clear annotations and remove save and display hooks."
   (annotate-clear-annotations)
   (remove-hook 'kill-buffer-hook                 #'annotate-save-annotations t)
-  (remove-hook 'kill-emacs-hook                  #'annotate-save-annotations t)
+  (remove-hook 'kill-emacs-hook                  
#'annotate-save-all-annotated-buffers nil)
   (remove-hook 'window-size-change-functions     #'on-window-size-change t)
   (remove-hook 'before-change-functions          #'annotate-before-change-fn t)
   (remove-hook 'Info-selection-hook              #'annotate-info-select-fn   t)
@@ -1431,6 +1431,13 @@ essentially what you get from:
   (and (> (length annotation) 3)
        (nth 3 annotation)))
 
+(defun annotate-save-all-annotated-buffers ()
+  "Save the annotations for all buffer where annotate-mode is active"
+  (let ((all-annotated-buffers (annotate-buffers-annotate-mode )))
+    (cl-loop for annotated-buffer in all-annotated-buffers do
+             (with-current-buffer annotated-buffer
+               (annotate-save-annotations)))))
+
 (defun annotate-save-annotations ()
   "Save all annotations to disk."
   (interactive)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]