Browse Source

org-clock-auto-clock-resolution is now a tri-state

John Wiegley 15 years ago
parent
commit
511bcc9e81
2 changed files with 19 additions and 7 deletions
  1. 8 0
      lisp/ChangeLog
  2. 11 7
      lisp/org-clock.el

+ 8 - 0
lisp/ChangeLog

@@ -1,3 +1,11 @@
+2009-10-25  John Wiegley  <jwiegley@gmail.com>
+
+	* 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  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-has-been-used): New variable.

+ 11 - 7
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