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

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

[elpa] externals/notmuch-indicator fbbd049762 1/2: Fix regression with p


From: ELPA Syncer
Subject: [elpa] externals/notmuch-indicator fbbd049762 1/2: Fix regression with performance pentalty
Date: Tue, 21 Nov 2023 06:58:17 -0500 (EST)

branch: externals/notmuch-indicator
commit fbbd04976267dbf2914e0456de1083eef48c77b8
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Fix regression with performance pentalty
    
    The :eval was calling a function the whole time which was running
    'shell-command-to-string'. Not good... The 'notmuch-indicator--indicator'
    is now only called from the timer, which should not be an issue
    anymore.
---
 notmuch-indicator.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/notmuch-indicator.el b/notmuch-indicator.el
index 1e57116cba..2e60d7c887 100644
--- a/notmuch-indicator.el
+++ b/notmuch-indicator.el
@@ -266,12 +266,16 @@ respectively.")
                (notmuch-indicator--format-counter count properties))))
          notmuch-indicator-args)))
 
+(defvar notmuch-indicator--counters nil
+  "Store the return value of `notmuch-indicator--indicator'.")
+
 (defun notmuch-indicator--indicator ()
   "Return contents of mode line indicator."
-  (or (notmuch-indicator--get-counters) ""))
+  (setq notmuch-indicator--counters
+        (or (notmuch-indicator--get-counters) "")))
 
 (defvar-local notmuch-indicator-mode-line-construct
-    '(notmuch-indicator-mode (" " (:eval (notmuch-indicator--indicator))))
+    '(notmuch-indicator-mode (" " (:eval notmuch-indicator--counters)))
   "Show the notmuch-indicator on the mode line.
 Do it when `notmuch-indicator-mode' is enabled.  Also see
 `notmuch-indicator-add-to-mode-line-misc-info'.")
@@ -291,7 +295,7 @@ Do it when `notmuch-indicator-mode' is enabled.  Also see
   "Run the timer with a delay, starting it if necessary.
 The delay is specified by `notmuch-indicator-refresh-count'."
   (unless (notmuch-indicator--running-p)
-    (run-at-time t notmuch-indicator-refresh-count 
#'notmuch-indicator--indicator)))
+    (run-at-time nil notmuch-indicator-refresh-count 
#'notmuch-indicator--indicator)))
 
 (defun notmuch-indicator-refresh ()
   "Refresh the active indicator."



reply via email to

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