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

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

[nongnu] elpa/annotate 12ad966a9d 278/372: - wrapped 'annotate-wrap-anno


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 12ad966a9d 278/372: - wrapped 'annotate-wrap-annotation-in-box' with 'save-match-data.
Date: Fri, 4 Feb 2022 16:59:07 -0500 (EST)

branch: elpa/annotate
commit 12ad966a9de9f3953305aecf80b52e20e692b431
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - wrapped 'annotate-wrap-annotation-in-box' with 'save-match-data.
---
 annotate.el | 49 +++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/annotate.el b/annotate.el
index 2e7ce2b8a0..24e63bdb23 100644
--- a/annotate.el
+++ b/annotate.el
@@ -1051,30 +1051,31 @@ aaa      aaa
 aa   ->  aa*
 a        a**
 "
-  (let ((annotation-text (overlay-get annotation-overlay 'annotation)))
-    (cl-labels ((boxify-multiline ()
-                  (let* ((lines         (annotate--split-lines 
annotation-text))
-                         (lines-widths  (mapcar 'string-width lines))
-                         (max-width     (cl-reduce (lambda (a b) (if (> a b)
-                                                                     a
-                                                                   b))
-                                                   lines-widths
-                                                   :initial-value -1))
-                         (padding-sizes (mapcar (lambda (a) (max (- max-width
-                                                                    
(string-width a)
-                                                                    1)
-                                                                 0))
-                                                lines))
-                         (paddings      (mapcar (lambda (a) (make-string a ? ))
-                                                padding-sizes))
-                         (box-lines     (cl-mapcar (lambda (a b) (concat a b))
-                                                   lines paddings)))
-                    (cl-reduce (lambda (a b) (concat a "\n" b))
-                               box-lines))))
-
-      (if annotation-on-is-own-line-p
-          (list (boxify-multiline))
-        (save-match-data
+  (save-match-data
+    (let ((annotation-text (overlay-get annotation-overlay 'annotation)))
+      (cl-labels ((boxify-multiline ()
+                    (let* ((lines         (annotate--split-lines 
annotation-text))
+                           (lines-widths  (mapcar 'string-width lines))
+                           (max-width     (cl-reduce (lambda (a b) (if (> a b)
+                                                                       a
+                                                                     b))
+                                                     lines-widths
+                                                     :initial-value -1))
+                           (padding-sizes (mapcar (lambda (a) (max (- max-width
+                                                                      
(string-width a)
+                                                                      1)
+                                                                   0))
+                                                  lines))
+                           (paddings      (mapcar (lambda (a) (make-string a ? 
))
+                                                  padding-sizes))
+                           (box-lines     (cl-mapcar (lambda (a b) (concat a 
b))
+                                                     lines paddings)))
+                      (cl-reduce (lambda (a b) (concat a "\n" b))
+                                 box-lines))))
+
+        (if annotation-on-is-own-line-p
+            (list (boxify-multiline))
+
           (annotate--split-lines (annotate-lineate annotation-text
                                                    (- end-of-line 
begin-of-line))))))))
 



reply via email to

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