[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idle-highlight-mode 1e0b38c09f 02/59: [Refactor] Save the
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idle-highlight-mode 1e0b38c09f 02/59: [Refactor] Save the last highlighted regexp in a variable for easier unhighlighting. |
Date: |
Thu, 7 Jul 2022 12:00:28 -0400 (EDT) |
branch: elpa/idle-highlight-mode
commit 1e0b38c09f4616e31217a4493dd3e45ea07a3874
Author: Cornelius Mika <cornelius.mika@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
[Refactor] Save the last highlighted regexp in a variable for easier
unhighlighting.
---
idle-highlight.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/idle-highlight.el b/idle-highlight.el
index 9cdd700db8..6f67fe7bbb 100755
--- a/idle-highlight.el
+++ b/idle-highlight.el
@@ -62,7 +62,7 @@
"Face used to highlight other occurrences of the word at point."
:group 'idle-highlight)
-(defvar idle-highlight-last-word nil "Last word to be idle-highlighted.")
+(defvar idle-highlight-last-regexp nil "Last regexp to be idle-highlighted.")
(defvar idle-highlight-timer nil "Timer to activate re-highlighting.")
@@ -72,15 +72,15 @@
(
(target-symbol (symbol-at-point))
(target (symbol-name target-symbol)))
- (when idle-highlight-last-word
- (unhighlight-regexp (concat "\\<" (regexp-quote
idle-highlight-last-word) "\\>")))
+ (if idle-highlight-last-regexp
+ (unhighlight-regexp idle-highlight-last-regexp))
(when
(and
idle-highlight-timer target target-symbol
;; TODO: no need to highlight keywords like if
(not (in-string-p)) (not (equal target "end")))
- (highlight-regexp (concat "\\<" (regexp-quote target) "\\>")
'idle-highlight)
- (setq idle-highlight-last-word target))))
+ (setq idle-highlight-last-regexp (concat "\\<" (regexp-quote target)
"\\>"))
+ (highlight-regexp idle-highlight-last-regexp 'idle-highlight))))
;;;###autoload
(defun idle-highlight (&optional arg)
@@ -90,7 +90,7 @@
(progn
(cancel-timer idle-highlight-timer)
(setq idle-highlight-timer nil))
- (set (make-local-variable 'idle-highlight-last-word) nil)
+ (set (make-local-variable 'idle-highlight-last-regexp) nil)
(set
(make-local-variable 'idle-highlight-timer)
(run-with-idle-timer 0.5 :repeat 'idle-highlight-word-at-point))))
- [nongnu] branch elpa/idle-highlight-mode created (now 5418252a11), ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 1e0b38c09f 02/59: [Refactor] Save the last highlighted regexp in a variable for easier unhighlighting.,
ELPA Syncer <=
- [nongnu] elpa/idle-highlight-mode 64d6522636 10/59: Fix documentation, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 902df81b5a 18/59: Cleanup: deprecation warning using `in-string-p`, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode c4be332ecb 34/59: readme: move hints into their own section, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode aa4c7a7ada 40/59: readme: update description, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 4714dcafcc 36/59: readme: add default values for settings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 2b627d5d45 24/59: Cleanup: be explicit that this mode isn't global, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 20a0fb798c 27/59: Disable the repeating idle timer when the minor mode isn't active, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 082ce4f5fc 48/59: Fix highlighting visible ranges, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 0423fc2b38 55/59: Fix #2 Substrings of identifiers are highlighted, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 7401286a4b 01/59: Version 1.0. Initial Commit., ELPA Syncer, 2022/07/07