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

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

[nongnu] elpa/idle-highlight-mode 93a498516e 19/59: Cleanup: slightly mo


From: ELPA Syncer
Subject: [nongnu] elpa/idle-highlight-mode 93a498516e 19/59: Cleanup: slightly more efficient checks, postpone calling symbol-name
Date: Thu, 7 Jul 2022 12:00:29 -0400 (EDT)

branch: elpa/idle-highlight-mode
commit 93a498516e5abc7f10060319a231199df47845e6
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Cleanup: slightly more efficient checks, postpone calling symbol-name
---
 idle-highlight-mode.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/idle-highlight-mode.el b/idle-highlight-mode.el
index 0f4dcd4d5e..98d633753c 100755
--- a/idle-highlight-mode.el
+++ b/idle-highlight-mode.el
@@ -84,19 +84,18 @@
 
 (defun idle-highlight--word-at-point ()
   "Highlight the word under the point."
-  (if idle-highlight-mode
-    (let*
-      (
-        (target-symbol (symbol-at-point))
-        (target (symbol-name target-symbol)))
-      (idle-highlight--unhighlight)
+  (when idle-highlight-mode
+    (idle-highlight--unhighlight)
+    (let ((target-symbol (symbol-at-point)))
       (when
         (and
           target-symbol (not (idle-highlight--ignore-context))
-          (looking-at-p "\\s_\\|\\sw") ;; Symbol characters
-          (not (member target idle-highlight-exceptions)))
-        (setq idle-highlight--regexp (concat "\\<" (regexp-quote target) 
"\\>"))
-        (highlight-regexp idle-highlight--regexp 'idle-highlight)))))
+          ;; Symbol characters.
+          (looking-at-p "\\s_\\|\\sw"))
+        (let ((target (symbol-name target-symbol)))
+          (when (not (member target idle-highlight-exceptions))
+            (setq idle-highlight--regexp (concat "\\<" (regexp-quote target) 
"\\>"))
+            (highlight-regexp idle-highlight--regexp 'idle-highlight)))))))
 
 (defsubst idle-highlight--unhighlight ()
   "Clear current highlight."



reply via email to

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