From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Seeger Subject: Bug: org-capture-refile doc inconsistency, refile bug [8.3.1 (8.3.1-129-ga7c8d2-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20150921/)] Date: Wed, 23 Sep 2015 13:59:34 +0200 Message-ID: <87io71qrbt.wl-jan.seeger@thenybble.de> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Wed_Sep_23_13:59:34_2015-1" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeiiE-0002aQ-Il for emacs-orgmode@gnu.org; Wed, 23 Sep 2015 07:59:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zeii9-0004CN-Jl for emacs-orgmode@gnu.org; Wed, 23 Sep 2015 07:59:50 -0400 Received: from thenybble.de ([87.230.87.205]:49881 helo=eins.thenybble.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zeii9-00049t-Ac for emacs-orgmode@gnu.org; Wed, 23 Sep 2015 07:59:45 -0400 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: emacs-orgmode@gnu.org --Multipart_Wed_Sep_23_13:59:34_2015-1 Content-Type: text/plain; charset=US-ASCII Greetings! I've discovered that org-capture-refile's documentation states that org-capture-refile finalizes the buffer first, and then refiles the entry. This is incorrect, the implementation of org-capture-refile first refiles the entry and then calls org-capture-finalize. While this is a small inconsistency, it leads to errors with org-finalize: The cursor possition during finalization is that of the entry before the refile, while normally, the cursor is positioned at the start of the newly inserted entry when org-capture-finalize is called. This leads to superfluous newlines, and possibly other problems, such as timestamps and checkboxes not being updated. I've fixed this bug for me by reversing the order of finalization and refiling, as stated in the documentation. I've attached a patch to do this, but I'm not entirely sure about the side effects caused by the patch. The test suite does pass though. If someone could weigh in on this, I'd be grateful! Regards, Jan Emacs : GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.6) of 2015-09-22 on bean Package: Org-mode version 8.3.1 (8.3.1-129-ga7c8d2-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20150921/) --Multipart_Wed_Sep_23_13:59:34_2015-1 Content-Type: text/plain; type=patch; name="org-capture-refile.patch"; charset=US-ASCII Content-Disposition: attachment; filename="org-capture-refile.patch" Content-Transfer-Encoding: 7bit diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 67dc319..d60929d 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -793,14 +793,15 @@ already gone. Any prefix argument will be passed to the refile command." (let ((pos (point)) (base (buffer-base-buffer (current-buffer))) (org-refile-for-capture t)) + (org-capture-finalize)) (save-window-excursion (with-current-buffer (or base (current-buffer)) (save-excursion (save-restriction (widen) (goto-char pos) - (call-interactively 'org-refile))))) - (org-capture-finalize))) + (call-interactively 'org-refile)))))) + (defun org-capture-kill () "Abort the current capture process." --Multipart_Wed_Sep_23_13:59:34_2015-1--