branch: elpa/idle-highlight-mode commit f9091c907d41e7b12d99d108a194229b8dbfc5ae Author: Campbell Barton <ideasma...@gmail.com> Commit: Campbell Barton <ideasma...@gmail.com>
Fix missing save-match-data --- changelog.rst | 5 +++++ idle-highlight-mode.el | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/changelog.rst b/changelog.rst index 7fc39ba3fa..c9ed0a4111 100644 --- a/changelog.rst +++ b/changelog.rst @@ -1,3 +1,8 @@ + +- In development. + + - Fix missing call to ``save-match-data``. + - Version 1.1.4 (2023-01-10) - Rename ``global-idle-highlight-mode`` to ``idle-highlight-global-mode`` and diff --git a/idle-highlight-mode.el b/idle-highlight-mode.el index 4223f6007f..92ba7009ab 100755 --- a/idle-highlight-mode.el +++ b/idle-highlight-mode.el @@ -227,18 +227,19 @@ Where RANGES is an unordered list of (min . max) cons cells." Argument VISIBLE-RANGES is a list of (min . max) ranges to highlight." (idle-highlight--unhighlight) (save-excursion - (let ((target-regexp (concat "\\_<" (regexp-quote target) "\\_>"))) - (pcase-dolist (`(,beg . ,end) visible-ranges) - (goto-char beg) - (while (re-search-forward target-regexp end t) - (let ((match-beg (match-beginning 0)) - (match-end (match-end 0))) - (unless (and idle-highlight-exclude-point - (eq target-beg match-beg) - (eq target-end match-end)) - (let ((ov (make-overlay match-beg match-end))) - (overlay-put ov 'face 'idle-highlight) - (push ov idle-highlight--overlays))))))))) + (save-match-data + (let ((target-regexp (concat "\\_<" (regexp-quote target) "\\_>"))) + (pcase-dolist (`(,beg . ,end) visible-ranges) + (goto-char beg) + (while (re-search-forward target-regexp end t) + (let ((match-beg (match-beginning 0)) + (match-end (match-end 0))) + (unless (and idle-highlight-exclude-point + (eq target-beg match-beg) + (eq target-end match-end)) + (let ((ov (make-overlay match-beg match-end))) + (overlay-put ov 'face 'idle-highlight) + (push ov idle-highlight--overlays)))))))))) (defun idle-highlight--word-at-point-args () "Return arguments for `idle-highlight--highlight'."