From 511bcc9e812340ad659f45a5e7e6b351795773d7 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 25 Oct 2009 18:03:23 -0400 Subject: [PATCH] org-clock-auto-clock-resolution is now a tri-state --- lisp/ChangeLog | 8 ++++++++ lisp/org-clock.el | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b5848e46..6995daba1 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2009-10-25 John Wiegley + + * org-clock.el + (org-clock-auto-clock-resolution): Now takes three values: nil, t + and `when-no-clock-is-running'. + (org-clock-in): Use `org-clock-auto-clock-resolution' to determine + whether or not to resolve Org buffers on clock in. + 2009-10-25 Carsten Dominik * org-clock.el (org-clock-has-been-used): New variable. diff --git a/lisp/org-clock.el b/lisp/org-clock.el index d7d1ff7a9..850db89ab 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -214,10 +214,13 @@ string as argument." (const :tag "Never" nil) (integer :tag "After N minutes"))) -(defcustom org-clock-auto-clock-resolution t - "When non-nil, do not resolve open clocks on clock-in." +(defcustom org-clock-auto-clock-resolution 'when-no-clock-is-running + "When to automatically resolve open clocks found in Org buffers." :group 'org-clock - :type 'boolean) + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t) + (const :tag "When no clock is running" when-no-clock-is-running))) (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. @@ -820,10 +823,11 @@ the clocking selection, associated with the letter `d'." ts selected-task target-pos (msg-extra "") (left-over (and (not org-clock-resolving-clocks) org-clock-left-over-time))) - (unless (or interrupting - org-clock-clocking-in - org-clock-resolving-clocks - (not org-clock-auto-clock-resolution)) + (when (and org-clock-auto-clock-resolution + (or (not interrupting) + (eq t org-clock-auto-clock-resolution)) + (not org-clock-clocking-in) + (not org-clock-resolving-clocks)) (setq org-clock-left-over-time nil) (let ((org-clock-clocking-in t)) (org-resolve-clocks))) ; check if any clocks are dangling