diff options
author | Jan Seeger <jan.seeger@thenybble.de> | 2015-09-25 14:54:31 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-10-13 21:42:47 +0200 |
commit | d183c59e46dc2779d22f08d6387d482d0e3dd29d (patch) | |
tree | 68daa74bfc3363109fe183191d98b2d6cb12f57f | |
parent | c0c16b88fa300b8661b2d40615f2ae12ccd9673c (diff) | |
download | org-mode-d183c59e46dc2779d22f08d6387d482d0e3dd29d.tar.gz |
org-capture: Reverse capture finalize and refile, hack buffer killing
* org-capture.el (org-capture-refile): Call finalize first, then
refile. If the capture buffer needs to be killed afterwards, kill
after refiling.
Refiling before finalizing led to an incorrect cursor position during
refile. Since adjusting the buffer position and bounds for the refiled
entry is difficult, I reverted the `org-capture-refile' function to its
original order of finalizing and then refiling. However, this leads to
a bug with killing the buffer on capture, described in
<http://permalink.gmane.org/gmane.emacs.orgmode/78027/>. To work around
this, now the :kill-buffer flag is cleared before calling finalize, and
the capture buffer is killed after `org-refile' is called.
TINYCHANGE
-rw-r--r-- | lisp/org-capture.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index fe04fc5..58b578b 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -792,7 +792,10 @@ already gone. Any prefix argument will be passed to the refile command." "Refiling from a capture buffer makes only sense for `entry'-type templates")) (let ((pos (point)) (base (buffer-base-buffer (current-buffer))) - (org-refile-for-capture t)) + (org-refile-for-capture t) + (kill-buffer (org-capture-get :kill-buffer 'local))) + (org-capture-put :kill-buffer nil) + (org-capture-finalize) (save-window-excursion (with-current-buffer (or base (current-buffer)) (save-excursion @@ -800,7 +803,7 @@ already gone. Any prefix argument will be passed to the refile command." (widen) (goto-char pos) (call-interactively 'org-refile))))) - (org-capture-finalize))) + (when kill-buffer (kill-buffer base)))) (defun org-capture-kill () "Abort the current capture process." |