summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-03-23 21:02:23 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2009-03-23 21:02:23 +0100
commit098cf359836d3cf4425c9cc90fcf55166ced62af (patch)
treed6448c5003b6e2d87719b4eeb1f35b99ab127869
parent19f700a606bb493eea2b39d07eb62cd0f771435e (diff)
downloadorg-mode-098cf359836d3cf4425c9cc90fcf55166ced62af.tar.gz
Clock: Clock out when done also in indirect buffers
Chris Randle writes: > I have one giant Org-mode file for everything. I frequently use > `C-c C-x b' to take the current node and show it in a new frame > with narrow subtree so that I can concentrate on just that region > of my file. Rather like hoist in GrandView, if anyone remembers > that. > > My Org Manual (6.24b) says "The indirect buffer...will contain > the entire buffer, but will be narrowed to the current > tree. Editing the indirect buffer will also change the original > buffer, but without affecting visibility in that buffer. > > I've noticed that, when working in the new frame, changing the > TODO state of any item within the frame to DONE (when it is the > currently clocked in item) does not stop the clock. Going back to > my main frame and doing the same thing there on the same item > does stop the clock. > > I haven't altered `org-clock-out-when-done', and Emacs reports > its value as t. This was caused by the fact that markers seem to point to the base buffer always, so we need to check if the current buffer's base buffer is equal to the marker buffer.
-rwxr-xr-xlisp/ChangeLog3
-rw-r--r--lisp/org-clock.el5
2 files changed, 7 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index de4f868..2b7e783 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2009-03-23 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-clock.el (org-clock-out-if-current): Make buffer detection
+ work in indirect buffers as well.
+
* org.el (org-emphasis-regexp-components): Add the exxclamation
mark to the post-emphasis characters.
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 8d2279a..49539a1 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -663,7 +663,10 @@ 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
(member state org-done-keywords)
- (equal (marker-buffer org-clock-marker) (current-buffer))
+ (equal (or (buffer-base-buffer (marker-buffer org-clock-marker))
+ (marker-buffer org-clock-marker))
+ (or (buffer-base-buffer (current-buffer))
+ (current-buffer)))
(< (point) org-clock-marker)
(> (save-excursion (outline-next-heading) (point))
org-clock-marker))