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