aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2016-03-27 18:15:06 +0300
committerEli Zaretskii2016-03-27 18:15:06 +0300
commitc8b868b1e2532aa07dbf4959798dbdc52ea9b5d5 (patch)
treefb9dadd72327a6b36c02faacc2da72e8f6088f44
parent278c8a7ef7baec2ffbfba211366ff3586a05f1e6 (diff)
downloademacs-c8b868b1e2532aa07dbf4959798dbdc52ea9b5d5.tar.gz
emacs-c8b868b1e2532aa07dbf4959798dbdc52ea9b5d5.zip
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)
-rw-r--r--lisp/midnight.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/midnight.el b/lisp/midnight.el
index 0e68eb923cd..878c5a7f71f 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -53,8 +53,12 @@ the time when it is run.")
53 "Non-nil means run `midnight-hook' at midnight." 53 "Non-nil means run `midnight-hook' at midnight."
54 :global t 54 :global t
55 :initialize #'custom-initialize-default 55 :initialize #'custom-initialize-default
56 (if midnight-mode (timer-activate midnight-timer) 56 ;; Disable first, since the ':initialize' function above already
57 (cancel-timer midnight-timer))) 57 ;; starts the timer when the mode is turned on for the first time,
58 ;; via setting 'midnight-delay', which calls 'midnight-delay-set',
59 ;; which starts the timer.
60 (when (timerp midnight-timer) (cancel-timer midnight-timer))
61 (if midnight-mode (timer-activate midnight-timer)))
58 62
59;;; time conversion 63;;; time conversion
60 64