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

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

[nongnu] elpa/annotate ec0ed147a2 170/372: - fixed error for regexp sear


From: ELPA Syncer
Subject: [nongnu] elpa/annotate ec0ed147a2 170/372: - fixed error for regexp search in 'annotate--font-lock-matcher'
Date: Fri, 4 Feb 2022 16:58:56 -0500 (EST)

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

    - fixed error for regexp search in 'annotate--font-lock-matcher'
    
      Sometimes some modes/package puts overlay  on the last character of a
      buffer  (notably  SLIME when  the  parenthesis  of  a form  are  not
      balanced). This will make  're-search-forward' in the aforementioned
      function  fails  and font  lock  becomes  a  mess (e.g.  text  color
      disappears).
---
 annotate.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/annotate.el b/annotate.el
index b34091d8af..b90f575667 100644
--- a/annotate.el
+++ b/annotate.el
@@ -638,16 +638,17 @@ annotation plus the newline."
   (if (>= (point) limit)
       nil ; no match found before limit
     (progn
-      ;; go to the end of the longest overlay under point
-      (let ((overlays (sort (overlays-at (point))
+      ;; go to the end of the longest annotation under point
+      (let ((overlays (sort (cl-remove-if-not 'annotationp
+                                              (overlays-at (point)))
                             (lambda (x y)
                               (> (overlay-end x) (overlay-end y))))))
-        (if overlays
-            (goto-char (overlay-end (car overlays)))))
-      ;; capture the area from the overlay to EOL for the modification guard
-      ;; and the newline itself for the annotation.
-      (re-search-forward "\\(.*\\(\n\\)\\)")
-      t)))
+        (when overlays
+          (goto-char (overlay-end (car overlays)))))
+      ;; capture the  area from the  overlay to EOL (regexp  match #1)
+      ;; for  the modification  guard and  the newline  itself (regexp
+      ;; match #2) for the annotation.
+      (re-search-forward "\\(.*\\(\n\\)\\)" limit t))))
 
 (cl-defstruct annotate-group
   words



reply via email to

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