summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernt Hansen <bernt@norang.ca>2011-11-20 02:44:07 +0000
committerBastien Guerry <bzg@altern.org>2011-12-11 18:22:06 +0100
commit0151120b1b317bc68c69aaf838807dff3bd3a7e9 (patch)
treedb44ca6af582c9461689388a5154164e926ae861
parent2091083323a29ea5cea001031edf8e44a4c9a861 (diff)
downloadorg-mode-0151120b1b317bc68c69aaf838807dff3bd3a7e9.tar.gz
Fix marker in no buffer error for task state change in an indirect buffer
* lisp/org-clock.el (org-clock-out-if-current): Fix marker in no buffer error for task state change in an indirect buffer org-clock-out-when-current was enhanced in 098cf35 (Clock: Clock out when done also in indirect buffers, 2009-03-23) to handle indirect buffers. This enhancement uses (buffer-base-buffer (org-clocking-buffer)) but when not clocking (org-clocking-buffer) returns nil - so buffer-base-buffer returns the base buffer of the current buffer which is never nil. This leads to marker in no buffer errors trying to stop the clock when it is not running. Now we explicitly check up front that the clock is running before any other conditions that lead to stopping the clock.
-rw-r--r--lisp/org-clock.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 9c6cd80..3654185 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1696,7 +1696,8 @@ from the `before-change-functions' in the current buffer."
"Clock out if the current entry contains the running clock.
This is used to stop the clock after a TODO entry is marked DONE,
and is only done if the variable `org-clock-out-when-done' is not nil."
- (when (and org-clock-out-when-done
+ (when (and (org-clocking-p)
+ org-clock-out-when-done
(or (and (eq t org-clock-out-when-done)
(member state org-done-keywords))
(and (listp org-clock-out-when-done)