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

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

[nongnu] elpa/idle-highlight-mode 305e9d4aa0 26/59: Cleanup: remove inte


From: ELPA Syncer
Subject: [nongnu] elpa/idle-highlight-mode 305e9d4aa0 26/59: Cleanup: remove intermediate symbol type variable
Date: Thu, 7 Jul 2022 12:00:30 -0400 (EDT)

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

    Cleanup: remove intermediate symbol type variable
    
    Use bounds-of-thing-at-point to get the bounds instead.
    Allows for greater flexibility in the future too.
    (such as removing highlighting for the current symbol).
---
 idle-highlight-mode.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/idle-highlight-mode.el b/idle-highlight-mode.el
index b78ece1a88..cada2c62d7 100755
--- a/idle-highlight-mode.el
+++ b/idle-highlight-mode.el
@@ -105,16 +105,17 @@
   "Highlight the word under the point."
   (when (bound-and-true-p idle-highlight-mode)
     (idle-highlight--unhighlight)
-    (let ((target-symbol (symbol-at-point)))
+    (let ((target-range (bounds-of-thing-at-point 'symbol)))
       (when
         (and
-          target-symbol (not (idle-highlight--ignore-context))
+          target-range (not (idle-highlight--ignore-context))
           ;; 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)))))))
+        (pcase-let* ((`(,beg . ,end) target-range))
+          (let ((target (buffer-substring-no-properties beg end)))
+            (when (not (member target idle-highlight-exceptions))
+              (setq idle-highlight--regexp (concat "\\<" (regexp-quote target) 
"\\>"))
+              (highlight-regexp idle-highlight--regexp 'idle-highlight))))))))
 
 
 ;; ---------------------------------------------------------------------------



reply via email to

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