emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 c8b868b: Don't start the 'midnight' timer twice


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 c8b868b: Don't start the 'midnight' timer twice
Date: Sun, 27 Mar 2016 15:16:12 +0000

branch: emacs-25
commit c8b868b1e2532aa07dbf4959798dbdc52ea9b5d5
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Don't start the 'midnight' timer twice
    
    * lisp/midnight.el (midnight-mode): Avoid starting the midnight
    timer twice when activating the mode the first time.  (Bug#23123)
---
 lisp/midnight.el |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/midnight.el b/lisp/midnight.el
index 0e68eb9..878c5a7 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -53,8 +53,12 @@ the time when it is run.")
   "Non-nil means run `midnight-hook' at midnight."
   :global t
   :initialize #'custom-initialize-default
-  (if midnight-mode (timer-activate midnight-timer)
-    (cancel-timer midnight-timer)))
+  ;; Disable first, since the ':initialize' function above already
+  ;; starts the timer when the mode is turned on for the first time,
+  ;; via setting 'midnight-delay', which calls 'midnight-delay-set',
+  ;; which starts the timer.
+  (when (timerp midnight-timer) (cancel-timer midnight-timer))
+  (if midnight-mode (timer-activate midnight-timer)))
 
 ;;; time conversion
 



reply via email to

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