diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-12-06 09:32:24 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-12-06 09:32:24 +0100 |
commit | 970b2f7b88bc2b7544f3d33126c54bcd365bff10 (patch) | |
tree | 6743208beca83ab513821ca5dad74abd46887791 | |
parent | cf766fb781fbb08784cd2bec02fa0fb0d9e63b57 (diff) | |
download | org-mode-970b2f7b88bc2b7544f3d33126c54bcd365bff10.tar.gz |
Allow to jump to capture template after finalizing
* lisp/org-capture.el (org-capture-finalize): New prefix argument
STAY-WITH-CAPTURE.
(org-capture-refile): Improve docstring.
* doc/org.texi (Using capture): Document using prefix arguments for
finalizing capture.
-rw-r--r-- | doc/org.texi | 6 | ||||
-rw-r--r-- | lisp/org-capture.el | 20 |
2 files changed, 18 insertions, 8 deletions
diff --git a/doc/org.texi b/doc/org.texi index 5735ac4..4bf947d 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -6149,14 +6149,16 @@ narrowed to this new node. You may then insert the information you want. @orgcmd{C-c C-c,org-capture-finalize} Once you have finished entering information into the capture buffer, @kbd{C-c C-c} will return you to the window configuration before the capture process, -so that you can resume your work without further distraction. +so that you can resume your work without further distraction. When called +with a prefix arg, finalize and then jump to the captured item. @orgcmd{C-c C-w,org-capture-refile} Finalize the capture process by refiling (@pxref{Refiling notes}) the note to a different place. Please realize that this is a normal refiling command that will be executed - so the cursor position at the moment you run this command is important. If you have inserted a tree with a parent and -children, first move the cursor back to the parent. +children, first move the cursor back to the parent. Any prefix argument +given to this command will be passed on to the @code{org-refile} command. @orgcmd{C-c C-k,org-capture-kill} Abort the capture process and return to the previous state. diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 7d0f1ac..6819c18 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -473,9 +473,11 @@ bypassed." (t (setq txt "* Invalid capture template"))) (org-capture-put :template txt))) -(defun org-capture-finalize () - "Finalize the capture process." - (interactive) +(defun org-capture-finalize (&optional stay-with-capture) + "Finalize the capture process. +With prefix argument STAY-WITH-CAPTURE, jump to the location of the +captured item after finalizing." + (interactive "P") (unless (and org-capture-mode (buffer-base-buffer (current-buffer))) (error "This does not seem to be a capture buffer for Org-mode")) @@ -562,17 +564,23 @@ bypassed." (set-window-configuration return-wconf)) (run-hooks 'org-capture-after-finalize-hook) - (when abort-note + ;; Special cases + (cond + (abort-note (cond ((equal abort-note 'clean) (message "Capture process aborted and target buffer cleaned up")) ((equal abort-note 'dirty) - (error "Capture process aborted, but target buffer could not be cleaned up correctly")))))) + (error "Capture process aborted, but target buffer could not be cleaned up correctly")))) + (stay-with-capture + (org-capture-goto-last-stored))) + ;; Return if we did store something + (not abort-note))) (defun org-capture-refile () "Finalize the current capture and then refile the entry. Refiling is done from the base buffer, because the indirect buffer is then -already gone." +already gone. Any prefix argument will be passed to the refile comand." (interactive) (unless (eq (org-capture-get :type 'local) 'entry) (error |