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

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

[nongnu] elpa/idle-highlight-mode 7f81263388 11/59: Add configurations f


From: ELPA Syncer
Subject: [nongnu] elpa/idle-highlight-mode 7f81263388 11/59: Add configurations for excepted words and what idle time to use.
Date: Thu, 7 Jul 2022 12:00:29 -0400 (EDT)

branch: elpa/idle-highlight-mode
commit 7f812633883ac2af72dc3c36cf75c699afa2efd3
Author: Cornelius Mika <cornelius.mika@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Add configurations for excepted words and what idle time to use.
    
    (Proposed by Thomas Järvstrand)
---
 idle-highlight-mode.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/idle-highlight-mode.el b/idle-highlight-mode.el
index 238da35433..550c20b5ee 100755
--- a/idle-highlight-mode.el
+++ b/idle-highlight-mode.el
@@ -66,6 +66,16 @@
 
 (defvar idle-highlight-global-timer nil "Timer to trigger highlighting.")
 
+(defcustom idle-highlight-exceptions '("end")
+  "List of words to be excepted from highlighting."
+  :group 'idle-highlight
+  :type '(repeat string))
+
+(defcustom idle-highlight-idle-time 0.5
+  "Time after which to highlight the word at point."
+  :group 'idle-highlight
+  :type 'float)
+
 (defun idle-highlight-word-at-point ()
   "Highlight the word under the point."
   (if idle-highlight-mode
@@ -78,8 +88,7 @@
         (and
           target-symbol (not (in-string-p))
           (looking-at-p "\\s_\\|\\sw") ;; Symbol characters
-          ;; TODO: no need to highlight keywords like if
-          (not (equal target "end")))
+          (not (member target idle-highlight-exceptions)))
         (setq idle-highlight-regexp (concat "\\<" (regexp-quote target) "\\>"))
         (highlight-regexp idle-highlight-regexp 'idle-highlight)))))
 
@@ -96,7 +105,7 @@
     (progn
       (unless idle-highlight-global-timer
         (setq idle-highlight-global-timer
-          (run-with-idle-timer 0.5 :repeat 'idle-highlight-word-at-point)))
+          (run-with-idle-timer idle-highlight-idle-time :repeat 
'idle-highlight-word-at-point)))
       (set (make-local-variable 'idle-highlight-regexp) nil))
     (idle-highlight-unhighlight)))
 



reply via email to

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