branch: elpa/adoc-mode
commit 506ce90f956d55609bc747c462c2818ede0b0075
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Skip reserved text in adoc-kwf-std instead of advancing by one char
When a font-lock match is rejected because it overlaps reserved text,
the retry loop previously advanced by just one character, causing
character-by-character scanning over large reserved regions. Now skip
past contiguous reserved text before retrying.
---
adoc-mode.el | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/adoc-mode.el b/adoc-mode.el
index c810ce6df6..36c4aca236 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -1614,7 +1614,12 @@ text having adoc-reserved set to symbol `block-del'."
'adoc-reserved
'block-del)))
no-block-del-groups))))
(when (and found prevented (<= (point) end))
- (goto-char (1+ (match-beginning 0)))))
+ (let ((next (1+ (match-beginning 0))))
+ ;; Skip past contiguous reserved text to avoid re-matching it
+ (while (and (< next end) (get-text-property next 'adoc-reserved))
+ (setq next (or (next-single-property-change next 'adoc-reserved
nil end)
+ end)))
+ (goto-char next))))
(and found (not prevented))))
(defun adoc-kwf-attribute-list (end)