all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jan Seeger <jan.seeger@thenybble.de>
To: Jan Seeger <jan.seeger@thenybble.de>,
	emacs-orgmode@gnu.org, Nicolas Goaziou <n.goaziou@neuf.fr>
Subject: Re: [PATCH] Reverse capture finalize and refile, hack buffer killing.
Date: Mon, 12 Oct 2015 15:10:03 +0200	[thread overview]
Message-ID: <87y4f8b5ck.wl-jan.seeger@thenybble.de> (raw)
In-Reply-To: <874mi2laf3.fsf@nicolasgoaziou.fr>

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

Hello!

Attached is the full output of git-format patch (should have done it
like that earlier^^).


[-- Attachment #2: 0001-Reverse-capture-finalize-and-refile-hack-buffer-kill.patch --]
[-- Type: application/octet-stream, Size: 2014 bytes --]

From c5a5080ec739658095446c30004cfb7b6f1ca0d6 Mon Sep 17 00:00:00 2001
From: Jan Seeger <jan.seeger@thenybble.de>
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


  reply	other threads:[~2015-10-12 13:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-10-13 19:50                     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4f8b5ck.wl-jan.seeger@thenybble.de \
    --to=jan.seeger@thenybble.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@neuf.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.