From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Seeger Subject: Re: [PATCH] Reverse capture finalize and refile, hack buffer killing. Date: Mon, 12 Oct 2015 15:10:03 +0200 Message-ID: <87y4f8b5ck.wl-jan.seeger@thenybble.de> References: <87io71qrbt.wl-jan.seeger@thenybble.de> <87twqjk06p.fsf@nicolasgoaziou.fr> <5F2C244C-C240-4956-9479-7D3301709B47@thenybble.de> <871tdmene3.fsf@nicolasgoaziou.fr> <871tdmmyqy.wl-jan.seeger@thenybble.de> <8737y2cfd5.fsf@nicolasgoaziou.fr> <87zj07klwd.wl-jan.seeger@thenybble.de> <8737xwf7hu.fsf@nicolasgoaziou.fr> <8737xpbrmn.wl-jan.seeger@thenybble.de> <874mi2laf3.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Mon_Oct_12_15:10:03_2015-1" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlcrq-0004eg-V7 for emacs-orgmode@gnu.org; Mon, 12 Oct 2015 09:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zlcrm-0006T2-UB for emacs-orgmode@gnu.org; Mon, 12 Oct 2015 09:10:18 -0400 Received: from [2a01:488:66:1000:57e6:57cd:0:1] (port=60526 helo=eins.thenybble.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlcrm-0006QR-Kc for emacs-orgmode@gnu.org; Mon, 12 Oct 2015 09:10:14 -0400 In-Reply-To: <874mi2laf3.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jan Seeger , emacs-orgmode@gnu.org, Nicolas Goaziou --Multipart_Mon_Oct_12_15:10:03_2015-1 Content-Type: text/plain; charset=US-ASCII Hello! Attached is the full output of git-format patch (should have done it like that earlier^^). --Multipart_Mon_Oct_12_15:10:03_2015-1 Content-Type: application/octet-stream; type=patch; name="0001-Reverse-capture-finalize-and-refile-hack-buffer-kill.patch" Content-Disposition: attachment; filename="0001-Reverse-capture-finalize-and-refile-hack-buffer-kill.patch" Content-Transfer-Encoding: 7bit >From c5a5080ec739658095446c30004cfb7b6f1ca0d6 Mon Sep 17 00:00:00 2001 From: Jan Seeger Date: Fri, 25 Sep 2015 14:54:31 +0200 Subject: [PATCH] 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 --- lisp/org-capture.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 67dc319..b1cda3d 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." -- 2.4.9 --Multipart_Mon_Oct_12_15:10:03_2015-1--