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

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

[nongnu] elpa/annotate 4bd488a5ca 2/7: - added command 'annotate-toggle-


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 4bd488a5ca 2/7: - added command 'annotate-toggle-all-annotations-text';
Date: Fri, 10 Mar 2023 10:00:43 -0500 (EST)

branch: elpa/annotate
commit 4bd488a5ca0b8a5a862acf3fc41fdfa74d491d82
Author: cage <cage>
Commit: cage <cage@invalid>

    - added command 'annotate-toggle-all-annotations-text';
    
    - removed customizable variable 'annotate-hide-annotations-text'.
---
 annotate.el | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/annotate.el b/annotate.el
index 2b9ccbd465..683ff2efe1 100644
--- a/annotate.el
+++ b/annotate.el
@@ -248,11 +248,6 @@ of lines. The center of the region is the position of the
 annotation as defined in the database."
   :type 'number)
 
-(defcustom annotate-hide-annotations-text nil
-  "Whether the text shuld not be rendered in the buffer, default
-is nil"
-  :type 'boolean)
-
 (defconst annotate-prop-chain-position
   'position)
 
@@ -829,13 +824,22 @@ specified by `FROM' and `TO'."
                         (annotate-annotate)))))))))))))))
 
 (defun annotate-toggle-annotation-text ()
+  "Hide annotation's text at current cursor's point, if such annotation exists"
+  (interactive)
+  (when-let* ((chain     (annotate-chain-at (point)))
+              (last-ring (car (last chain))))
+    (if (annotate-tail-overlay-hide-text-p last-ring)
+        (annotate-chain-show-text chain)
+      (annotate-chain-hide-text chain))
+    (font-lock-flush)))
+
+(defun annotate-toggle-all-annotations-text ()
   (interactive)
-  (setf annotate-hide-annotations-text (not annotate-hide-annotations-text))
   (let ((chains (annotate-annotations-chain-in-range 0 (buffer-size))))
     (dolist (chain chains)
-      (if annotate-hide-annotations-text
-          (annotate-chain-hide-text chain)
-          (annotate-chain-show-text chain))))
+      (if (annotate-tail-overlay-hide-text-p (car (last chain)))
+          (annotate-chain-show-text chain)
+        (annotate-chain-hide-text chain))))
   (font-lock-flush))
 
 (cl-defun annotate-goto-next-annotation (&key (startingp t))
@@ -2033,11 +2037,11 @@ in a chain of annotations as last."
   (annotate-find-chain (annotate-annotation-at pos)))
 
 (defun annotate-chain-hide-text (chain)
-  (let ((last-ring (annotate-chain-last (cl-first chain))))
+  (let ((last-ring (car (last chain))))
     (overlay-put last-ring 'hide-text t)))
 
 (defun annotate-chain-show-text (chain)
-  (let ((last-ring (annotate-chain-last (cl-first chain))))
+  (let ((last-ring (car (last chain))))
     (overlay-put last-ring 'hide-text nil)))
 
 (defun annotate-chain-hide-text-p (chain)



reply via email to

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