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

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

[nongnu] elpa/annotate 74699a2a70 102/372: - making loading multiple tim


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 74699a2a70 102/372: - making loading multiple time this mode with no effect on the buffer
Date: Fri, 4 Feb 2022 16:58:22 -0500 (EST)

branch: elpa/annotate
commit 74699a2a70d9a9de5ab8eb9a6befc5fec0b3354c
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - making loading multiple time this mode with no effect on the buffer
    
      Sometimes annotate mode is applyed  to a buffer multiple time (like,
      for example,  when desktop-mode is  used), in this  case annotations
      was loaded (and  displayed) as many times as  annotate was reloaded.
      This  patch  prevent  multiple  loading  of  annotation  (note:  not
      multiple loading of annotation-mode).
---
 annotate.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/annotate.el b/annotate.el
index 5c6967e136..dc91676870 100644
--- a/annotate.el
+++ b/annotate.el
@@ -142,6 +142,10 @@ major mode is a member of this list (space separated 
entries)."
 (defconst annotate-ellipse-text-marker "..."
   "The string used when a string is truncated with an ellipse")
 
+(defun annotate-annotations-exist-p ()
+  (find-if 'annotationp
+           (overlays-in 0 (buffer-size))))
+
 (defun annotate-initialize-maybe ()
   "Initialize annotate mode only if buffer's major mode is not in the 
blacklist (see:
 'annotate-blacklist-major-mode'"
@@ -151,10 +155,11 @@ major mode is a member of this list (space separated 
entries)."
      ((not annotate-allowed-p)
       (annotate-shutdown)
       (setq annotate-mode nil))
-    (annotate-mode
-     (annotate-initialize))
-    (t
-     (annotate-shutdown)))))
+     (annotate-mode
+      (when (not (annotate-annotations-exist-p))
+        (annotate-initialize)))
+     (t
+      (annotate-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]