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

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

[nongnu] elpa/annotate 0f4ffd5c1c 6/6: Merge pull request #133 from cage


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 0f4ffd5c1c 6/6: Merge pull request #133 from cage2/fix-run-hook-when-emacs-killed
Date: Tue, 9 Aug 2022 04:58:32 -0400 (EDT)

branch: elpa/annotate
commit 0f4ffd5c1c9f92fea6961699287f3dd124b88aad
Merge: 4c697e70e8 553662a181
Author: cage2 <1257703+cage2@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #133 from cage2/fix-run-hook-when-emacs-killed
    
    Fix run hook when emacs killed
---
 Changelog   | 12 ++++++++++++
 NEWS.org    |  5 +++++
 annotate.el | 15 +++++++++++----
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index e5411f2ffd..a91703ba22 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,15 @@
+2022-08-02 cage
+
+        * NEWS.org,
+        * annotate.el:
+
+        - modified the function called when kill-emacs-hook runs
+          The  new function  ensures  all the  buffers,  where annotate-mode  
is
+          active, save the annotationos in  the database; also this function is
+          registered in the global hooks list.
+        - increased version number.
+        - updated NEWS.org.
+
 2022-06-23 cage
 
         * annotate.el:
diff --git a/NEWS.org b/NEWS.org
index 1cb8668f40..d13166088f 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,8 @@
+- 2022-08-02 v1.7.1 cage ::
+
+  This version fix  a bug that prevented saving  some annotations when
+  Emacs was closed.
+
 - 2022-05-26 v1.7.0 cage ::
 
   This  version no  more sets  the buffer  as modified  when the  only
diff --git a/annotate.el b/annotate.el
index c340359cb5..895a3ca18c 100644
--- a/annotate.el
+++ b/annotate.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Bastian Bechtold <bastibe.dev@mailbox.org>, cage 
<cage-dev@twistfold.it>
 ;; URL: https://github.com/bastibe/annotate.el
 ;; Created: 2015-06-10
-;; Version: 1.7.0
+;; Version: 1.7.1
 
 ;; This file is NOT part of GNU Emacs.
 
@@ -58,7 +58,7 @@
 ;;;###autoload
 (defgroup annotate nil
   "Annotate files without changing them."
-  :version "1.7.0"
+  :version "1.7.1"
   :group 'text)
 
 (defvar annotate-mode-map
@@ -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]