diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-09-15 16:56:35 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-09-15 16:56:35 +0200 |
commit | fa3dab48d0c0f954bfb70977cd8f5278b6f324ae (patch) | |
tree | 4177b07b8589d2a29602df275f48caaef4b108b6 | |
parent | 1e6ab19b2ad7a3f9867a1820baaa166e2ab959b0 (diff) | |
download | org-mode-fa3dab48d0c0f954bfb70977cd8f5278b6f324ae.tar.gz |
org-capture: Save buffer in `org-capture-refile'
* lisp/org-capture.el (org-capture-refile): When :kill-buffer option
is active, save buffer before killing it.
Reported-by: Andrew Burgess <andrew.burgess@embecosm.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-09/msg00052.html>
-rw-r--r-- | lisp/org-capture.el | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 993526f..cbc72d4 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -869,17 +869,15 @@ for `entry'-type templates")) ;; early. We want to wait for the refiling to be over, so we ;; control when the latter function is called. (org-capture-put :kill-buffer nil :jump-to-captured nil) - (unwind-protect - (progn - (org-capture-finalize) - (save-window-excursion - (with-current-buffer base - (org-with-wide-buffer - (goto-char pos) - (call-interactively 'org-refile)))) - (when kill-buffer (kill-buffer base)) - (when jump-to-captured (org-capture-goto-last-stored))) - (set-marker pos nil)))) + (org-capture-finalize) + (save-window-excursion + (with-current-buffer base + (org-with-point-at pos + (call-interactively 'org-refile)))) + (when kill-buffer + (with-current-buffer base (save-buffer)) + (kill-buffer base)) + (when jump-to-captured (org-capture-goto-last-stored)))) (defun org-capture-kill () "Abort the current capture process." |