From a5150cca5d54f72976f0798fd315da40b364fda6 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 16 Oct 2009 22:06:09 -0400 Subject: [PATCH] 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. --- lisp/ChangeLog | 4 ++++ lisp/org-clock.el | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f69045f03..c6bbce7e0 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-10-17 John Wiegley + * 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 diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 97e555221..587c7249a 100644 --- a/lisp/org-clock.el +++ b/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)