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.
This commit is contained in:
Carsten Dominik 2009-03-23 21:02:23 +01:00
parent 19f700a606
commit 098cf35983
2 changed files with 7 additions and 1 deletions

View File

@ -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.

View File

@ -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))