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

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

[nongnu] elpa/why-this 236f8fd225 09/59: Fix problem when enabled on mul


From: ELPA Syncer
Subject: [nongnu] elpa/why-this 236f8fd225 09/59: Fix problem when enabled on multiple buffers
Date: Sun, 27 Nov 2022 16:02:48 -0500 (EST)

branch: elpa/why-this
commit 236f8fd225ac1a8001b27624fb1b121eb7927b57
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Fix problem when enabled on multiple buffers
---
 why-this.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/why-this.el b/why-this.el
index 6c7c98fa12..84e1cb6502 100644
--- a/why-this.el
+++ b/why-this.el
@@ -108,6 +108,9 @@ NICK."
 (defvar why-this--idle-timer nil
   "Timer for rendering.")
 
+(defvar why-this--buffer-count 0
+  "Count of buffers where Why-This mode is enabled.")
+
 (defvar-local why-this--backend nil
   "Backend for current buffer.")
 
@@ -283,10 +286,13 @@ Actually the supported backend is returned."
             (setq why-this--idle-timer nil))
           (setq why-this--idle-timer
                 (run-with-idle-timer why-this-idle-delay t
-                                     #'why-this--render-non-blocking)))
+                                     #'why-this--render-non-blocking))
+          (setq why-this--buffer-count (1+ why-this--buffer-count)))
       (remove-hook 'post-command-hook #'why-this--update-overlays t)
-      (cancel-timer why-this--idle-timer)
-      (setq why-this--idle-timer nil))))
+      (setq why-this--buffer-count (1- why-this--buffer-count))
+      (when (zerop why-this--buffer-count)
+        (cancel-timer why-this--idle-timer)
+        (setq why-this--idle-timer nil)))))
 
 (defun why-this-backend-git (cmd &rest args)
   "Git backend for Why-This mode.



reply via email to

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