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

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

[nongnu] elpa/annotate 649c63b4f3 2/4: - fixed procedures to have a clea


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 649c63b4f3 2/4: - fixed procedures to have a clean exit from this mode.
Date: Fri, 3 Feb 2023 12:58:23 -0500 (EST)

branch: elpa/annotate
commit 649c63b4f371faf421cbe8b2da1df3cded291570
Author: cage <cage@invalid>
Commit: cage <cage@invalid>

    - fixed procedures to have a clean exit from this mode.
    
      Toggling annotate-mode (M-x annotate-mode  in a buffer with annotate
      mode active), was not removing the annotation's text.
---
 annotate.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/annotate.el b/annotate.el
index 66e2c53e96..a171d6213e 100644
--- a/annotate.el
+++ b/annotate.el
@@ -381,17 +381,20 @@ annotation as defined in the database."
 (defun annotate-initialize-maybe ()
   "Initialize annotate mode only if buffer's major mode is not in the 
blacklist.
 See `annotate-blacklist-major-mode'."
-  (let ((annotate-allowed-p (with-current-buffer (current-buffer)
-                              (not (apply #'derived-mode-p 
annotate-blacklist-major-mode)))))
-    (cond
-     ((not annotate-allowed-p)
-      (annotate-shutdown)
-      (setq annotate-mode nil))
-     (annotate-mode
-      (when (not (annotate-annotations-exist-p))
-        (annotate-initialize)))
-     (t
-      (annotate-shutdown)))))
+  (cl-flet ((shutdown ()
+              (setq annotate-mode t)
+              (annotate-shutdown)
+              (setq annotate-mode nil)))
+    (let ((annotate-allowed-p (with-current-buffer (current-buffer)
+                                (not (apply #'derived-mode-p 
annotate-blacklist-major-mode)))))
+      (cond
+       ((not annotate-allowed-p)
+        (shutdown))
+       (annotate-mode
+        (when (not (annotate-annotations-exist-p))
+          (annotate-initialize)))
+       (t
+        (shutdown))))))
 
 (cl-defun annotate-buffer-checksum (&optional (object (current-buffer)))
   "Calculate an hash for the argument `OBJECT'."



reply via email to

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