emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2015-09-23 11:59 Jan Seeger
  2015-09-24 20:54 ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Seeger @ 2015-09-23 11:59 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]

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/)



[-- Attachment #2: org-capture-refile.patch --]
[-- Type: text/plain, Size: 710 bytes --]

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."

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-10-13 19:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23 11:59 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/)] Jan Seeger
2015-09-24 20:54 ` Nicolas Goaziou
2015-09-24 21:12   ` OT - gmane problems? [was: Re: 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/)]] Nick Dokos
2015-09-25 11:37   ` 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/)] Jan Seeger
2015-09-25 11:42     ` Nicolas Goaziou
2015-09-25 13:09       ` Jan Seeger
2015-09-25 22:18         ` Nicolas Goaziou
2015-09-28  8:06           ` [PATCH] Reverse capture finalize and refile, hack buffer killing Jan Seeger
2015-09-30 11:53             ` Nicolas Goaziou
2015-10-05  9:18               ` Jan Seeger
2015-10-07 19:56                 ` Nicolas Goaziou
2015-10-12 13:10                   ` Jan Seeger
2015-10-13 19:50                     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).