Hello!

I've reworked the patch to restore the original order of
org-capture-finalize and org-capture-refile, but working around the
interaction with :kill-buffer that required reversing the order in the
first place.

org-capture-finalize requires the capture buffer to be set up
correctly, and restoring this correctly after refiling appears to
require a lot of work.

Regards,
Jan

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 67dc319..3d5df83 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,8 @@ already gone.  Any prefix argument will be passed to the 
refile command."
            (widen)
            (goto-char pos)
            (call-interactively 'org-refile)))))
-    (org-capture-finalize)))
+    (if kill-buffer
+       (kill-buffer base))))
 
 (defun org-capture-kill ()
   "Abort the current capture process."

Reply via email to