branch: externals/notmuch-indicator
commit 7cb9b466ae6b085087b876f33429aeaf21c50045
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Remove redundant notmuch-indicator--run-timer and keep its logic in 
notmuch-indicator-refresh
---
 notmuch-indicator.el | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/notmuch-indicator.el b/notmuch-indicator.el
index 0d3f20d7c9..2ed1bf04eb 100644
--- a/notmuch-indicator.el
+++ b/notmuch-indicator.el
@@ -326,20 +326,13 @@ Do it when `notmuch-indicator-mode' is enabled.  Also see
              (eq (timer--function timer) 'notmuch-indicator--indicator))
            timer-list))))
 
-(defun notmuch-indicator--run-timer ()
-  "Run the timer with a delay, starting it if necessary.
-The delay is specified by `notmuch-indicator-refresh-count'."
-  (when (natnump notmuch-indicator-refresh-count)
-    (unless (notmuch-indicator--running-p)
-      (run-at-time nil notmuch-indicator-refresh-count 
#'notmuch-indicator--indicator))))
-
 (defun notmuch-indicator-refresh ()
   "Refresh the active indicator."
   (when (notmuch-indicator--running-p)
-    (cancel-function-timers #'notmuch-indicator--indicator)
-    (when (natnump notmuch-indicator-refresh-count)
-      (run-at-time nil notmuch-indicator-refresh-count 
#'notmuch-indicator--indicator))
-    (notmuch-indicator--indicator)))
+    (cancel-function-timers #'notmuch-indicator--indicator))
+  (when (natnump notmuch-indicator-refresh-count)
+    (run-at-time nil notmuch-indicator-refresh-count 
#'notmuch-indicator--indicator))
+  (notmuch-indicator--indicator))
 
 (define-obsolete-function-alias
   'notmuch-indicator--refresh
@@ -364,7 +357,7 @@ and `notmuch-indicator-force-refresh-commands'."
         (when notmuch-indicator-add-to-mode-line-misc-info
           (setq notmuch-indicator--used-mode-line-construct 
notmuch-indicator-mode-line-construct)
           (add-to-list 'mode-line-misc-info 
notmuch-indicator-mode-line-construct))
-        (notmuch-indicator--run-timer)
+        (notmuch-indicator-refresh)
         (add-hook 'notmuch-after-tag-hook #'notmuch-indicator-refresh)
         (dolist (fn notmuch-indicator-force-refresh-commands)
           (advice-add fn :after #'notmuch-indicator-refresh)))

Reply via email to