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

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

[nongnu] elpa/symbol-overlay c439b73a5f 152/152: Merge pull request #78


From: ELPA Syncer
Subject: [nongnu] elpa/symbol-overlay c439b73a5f 152/152: Merge pull request #78 from mattbeshara/single-active-timer
Date: Thu, 7 Jul 2022 12:04:24 -0400 (EDT)

branch: elpa/symbol-overlay
commit c439b73a5f9713bb3dce98986b589bb901e22130
Merge: d08c33dc85 07119d9c95
Author: Steve Purcell <steve@sanityinc.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #78 from mattbeshara/single-active-timer
    
    Use a single shared timer for all buffers
---
 symbol-overlay.el | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/symbol-overlay.el b/symbol-overlay.el
index b51a286d26..c20f59355d 100644
--- a/symbol-overlay.el
+++ b/symbol-overlay.el
@@ -227,10 +227,8 @@ You can re-bind the commands to any keys you prefer.")
   (if symbol-overlay-mode
       (progn
         (add-hook 'post-command-hook #'symbol-overlay-post-command nil t)
-        (add-hook 'kill-buffer-hook #'symbol-overlay-cancel-timer)
         (symbol-overlay-update-timer symbol-overlay-idle-time))
     (remove-hook 'post-command-hook #'symbol-overlay-post-command t)
-    (symbol-overlay-cancel-timer)
     (symbol-overlay-remove-temp)))
 
 (defun symbol-overlay-get-list (dir &optional symbol exclude)
@@ -336,7 +334,7 @@ This only affects symbols in the current displayed window if
     (when f
       (funcall f symbol))))
 
-(defvar-local symbol-overlay-timer nil
+(defvar symbol-overlay-timer nil
   "Timer for temporary highlighting.")
 
 (defun symbol-overlay-cancel-timer ()
@@ -344,21 +342,18 @@ This only affects symbols in the current displayed window 
if
   (when symbol-overlay-timer
     (cancel-timer symbol-overlay-timer)))
 
-(defun symbol-overlay-idle-timer (buf)
-  "Idle timer callback for BUF.
-This is used to maybe highlight the symbol at point, but only if
-the buffer is visible in the currently-selected window at the
-time."
-  (when (and (buffer-live-p buf) (eq (window-buffer) buf))
-    (with-current-buffer buf
-      (symbol-overlay-maybe-put-temp))))
+(defun symbol-overlay-idle-timer ()
+  "Idle timer callback.
+This is used to maybe highlight the symbol at point in whichever
+buffer happens to be current when the timer is fired."
+  (symbol-overlay-maybe-put-temp))
 
 (defun symbol-overlay-update-timer (value)
   "Update `symbol-overlay-timer' with new idle-time VALUE."
   (symbol-overlay-cancel-timer)
   (setq symbol-overlay-timer
         (and value (> value 0)
-             (run-with-idle-timer value t #'symbol-overlay-idle-timer 
(current-buffer)))))
+             (run-with-idle-timer value t #'symbol-overlay-idle-timer))))
 
 (defun symbol-overlay-post-command ()
   "Installed on `post-command-hook'."



reply via email to

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