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

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

[nongnu] elpa/annotate ef82c4313b 3/7: - wrapped raw chain manipulation


From: ELPA Syncer
Subject: [nongnu] elpa/annotate ef82c4313b 3/7: - wrapped raw chain manipulation with 'annotate-chain-last-ring' to get the last segment of a chain.
Date: Fri, 10 Mar 2023 10:00:44 -0500 (EST)

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

    - wrapped raw chain manipulation with 'annotate-chain-last-ring' to get the 
last segment of a chain.
---
 annotate.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/annotate.el b/annotate.el
index 683ff2efe1..60373a118b 100644
--- a/annotate.el
+++ b/annotate.el
@@ -432,6 +432,10 @@ annotated text?
 See: `ANNOTATE-ANNOTATION-POSITION-POLICY'."
   (overlay-get annotation 'force-newline-policy))
 
+(defun annotate-chain-last-ring (chain)
+  "Get the last ring of `CHAIN'"
+  (car (last chain)))
+
 (defun annotate--remap-chain-pos (annotations)
   "Remap `ANNOTATIONS' as an annotation 'chain'.
 
@@ -827,7 +831,7 @@ specified by `FROM' and `TO'."
   "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))))
+              (last-ring (annotate-chain-last-ring chain)))
     (if (annotate-tail-overlay-hide-text-p last-ring)
         (annotate-chain-show-text chain)
       (annotate-chain-hide-text chain))
@@ -837,7 +841,7 @@ specified by `FROM' and `TO'."
   (interactive)
   (let ((chains (annotate-annotations-chain-in-range 0 (buffer-size))))
     (dolist (chain chains)
-      (if (annotate-tail-overlay-hide-text-p (car (last chain)))
+      (if (annotate-tail-overlay-hide-text-p (annotate-chain-last-ring chain))
           (annotate-chain-show-text chain)
         (annotate-chain-hide-text chain))))
   (font-lock-flush))
@@ -2037,11 +2041,11 @@ in a chain of annotations as last."
   (annotate-find-chain (annotate-annotation-at pos)))
 
 (defun annotate-chain-hide-text (chain)
-  (let ((last-ring (car (last chain))))
+  (let ((last-ring (annotate-chain-last-ring chain)))
     (overlay-put last-ring 'hide-text t)))
 
 (defun annotate-chain-show-text (chain)
-  (let ((last-ring (car (last chain))))
+  (let ((last-ring (annotate-chain-last-ring 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]