all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Save buffer in org-capture-refile
Date: Sat, 15 Sep 2018 16:58:17 +0200	[thread overview]
Message-ID: <87va76hkom.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <20180905103245.26222-1-andrew.burgess@embecosm.com> (Andrew Burgess's message of "Wed, 5 Sep 2018 11:32:45 +0100")

Hello,

Andrew Burgess <andrew.burgess@embecosm.com> writes:

> I notice that if a capture template sets ':kill-buffer t', and I use
> org-capture-refile to refile into a different file then I don't get
> the result I expect.
>
> Let me give an example, here's my setup:
>
>   $ mkdir ~/tmp
>   $ cd ~/tmp
>   $ echo "* loc1/tasks" > loc1.org
>   $ echo "* inbox/tasks" > inbox.org
>   $ cat test.el
>   (setq org-capture-templates
>         '(("t" "TASK that needs completing" entry
>            (file+headline "~/tmp/inbox.org" "inbox/tasks")
>            "** TODO %?"
>            :prepend t :kill-buffer t)))
>   (setq org-refile-targets (quote (("~/tmp/loc1.org" :maxlevel . 2))))
>   $ emacs -Q -l test.el
>
> Now in emacs:
>
>   org-capture             # Start a capture
>   t                       # Select the template 't'
>   AAAAAA                  # Fill in a task title
>   org-capture-refile      # Start refiling
>   l<TAB>                  # Select refile location, should complete to
>   			  # 'loc1/tasks (loc1.org)'
>
> At this point you should see the message:
>
>   Buffer inbox.org modified; kill anyway? (yes or no)
>
> Neither answer gets you the result you want (I think).
>
> If you choose 'yes', then quit emacs (saving buffers as you go[1])
> you'll find that task 'AAAAAA' is now in both inbox.org and loc1.org.
>
> If you choose 'no', then quit emacs (saving buffers as you go) you'll
> find that the task has moved out of inbox.org into loc1.org, but,
> clearly the requested ':kill-buffer t' wasn't respected.
>
> The problem is that org-capture-refile calls org-capture-finalize, but
> suppresses the call to kill-buffer in org-capture-finalize, instead
> performing that call itself.  However, org-capture-finalize calls
> save-buffer, before calling kill-buffer, org-capture-refile doesn't.
>
> If I add a call to save-buffer into org-capture-refile in a similar
> fashion to the call in org-capture-finalize, then I get the behaviour
> I expect.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

      reply	other threads:[~2018-09-15 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 10:32 [PATCH] Save buffer in org-capture-refile Andrew Burgess
2018-09-15 14:58 ` Nicolas Goaziou [this message]

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=87va76hkom.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=andrew.burgess@embecosm.com \
    --cc=emacs-orgmode@gnu.org \
    /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.