diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2009-10-02 08:40:02 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2009-10-02 08:40:02 +0200 |
commit | 3ce0a4a9e219b05259fd013b68f22ea04ed62b87 (patch) | |
tree | b60be8e397c291db6f56eac0eab1eead642d8419 | |
parent | 8d2cbde0c9ec2090d001fbb961443815f337308b (diff) | |
download | org-mode-3ce0a4a9e219b05259fd013b68f22ea04ed62b87.tar.gz |
Fix position error when clocking in while buffer is narrowed
Bernt Hansen writes:
> If you narrow to subtree when there is a following task the narrowed
> buffer has a blank line at the end. If you are on this line and
> clock-in it starts the clock for the _following_ task (outside the
> narrowed subtree) and not the task you are looking at.
>
> I stumbled across this today because the following task was already
> over the estimated limit when I clocked it in - which triggered my
> alarm sound.
>
> ,----[ test.org ]
> | #+STARTUP:
> | * TODO One
> | * TODO Two
> `----
>
> ,----[ minimal.emacs ]
> | (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
> | (add-to-list 'auto-mode-alist
> | '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
> | (require 'org-install)
> |
> | (global-set-key "\C-cl" 'org-store-link)
> | (global-set-key "\C-ca" 'org-agenda)
> | (global-set-key "\C-cb" 'org-iswitchb)
> `----
>
> Key sequence to reproduce:
>
> $ emacs -q -l minimal.emacs test.org
>
> | Key | Notes |
> |-------------------------------+-------------------------------|
> | C-n | Go to first task '* TODO One' |
> | M-x org-narrow-to-subtree RET | Narrow to subtree |
> | C-n | Move to last blank line |
> | C-c C-x C-i | Clock in (next) task |
> |-------------------------------+-------------------------------|
>
> -Bernt
>
> Emacs : GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
> of 2008-11-09 on raven, modified by Debian
> Package: Org-mode version 6.31trans (release_6.31.8.g7485)
-rwxr-xr-x | lisp/ChangeLog | 3 | ||||
-rw-r--r-- | lisp/org-clock.el | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 75019fb..5d761d9 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-10-02 Carsten Dominik <carsten.dominik@gmail.com> + * org-clock.el: Make sure the clock-in target position does not + move to a different node by widening the buffer. + * org-html.el (org-export-html-format-image): Wrap image into figure div only when there is a caption. diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 455fc1c..de279e0 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -524,7 +524,11 @@ the clocking selection, associated with the letter `d'." ;; Mark as default clocking task (org-clock-mark-default-task)) - (setq target-pos (point)) ;; we want to clock in at this location + ;; Clock in at which position? + (setq target-pos + (if (and (eobp) (not (org-on-heading-p))) + (point-at-bol 0) + (point))) (run-hooks 'org-clock-in-prepare-hook) (save-excursion (when (and selected-task (marker-buffer selected-task)) @@ -535,6 +539,7 @@ the clocking selection, associated with the letter `d'." (move-marker selected-task nil)) (save-excursion (save-restriction + (if (and (widen) (goto-char target-pos) (org-back-to-heading t) |