From 970b2f7b88bc2b7544f3d33126c54bcd365bff10 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 6 Dec 2010 09:32:24 +0100 Subject: [PATCH] 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. --- doc/org.texi | 6 ++++-- lisp/org-capture.el | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 5735ac449..4bf947dd5 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 7d0f1acb0..6819c18b7 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 -- 2.11.4.GIT