Procházet zdrojové kódy

Prevent mode-line timers from being duplicated

(org-clock-in): Before creating `org-clock-mode-line-timer', check to
make sure an older timer is not currently running.
John Wiegley před 15 roky
rodič
revize
b6594a03df
2 změnil soubory, kde provedl 7 přidání a 0 odebrání
  1. 4 0
      lisp/ChangeLog
  2. 3 0
      lisp/org-clock.el

+ 4 - 0
lisp/ChangeLog

@@ -1,5 +1,9 @@
 2009-10-17  John Wiegley  <johnw@newartisans.com>
 
+	* org-clock.el (org-clock-in): Before creating
+	`org-clock-mode-line-timer', check to make sure an older timer is
+	not currently running.
+
 	* org.el (org-files-list): New utility function for returning a
 	list of all open org-mode buffers, plus all files used to build
 	the agenda buffer.  Note that not all the files will necessarily

+ 3 - 0
lisp/org-clock.el

@@ -616,6 +616,9 @@ the clocking selection, associated with the letter `d'."
 		(setq global-mode-string
 		      (append global-mode-string '(org-mode-line-string))))
 	    (org-clock-update-mode-line)
+	    (when org-clock-mode-line-timer
+	      (cancel-timer org-clock-mode-line-timer)
+	      (setq org-clock-mode-line-timer nil))
 	    (setq org-clock-mode-line-timer
 		  (run-with-timer 60 60 'org-clock-update-mode-line))
 	    (message "Clock starts at %s - %s" ts msg-extra)