emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Nick Dokos <ndokos@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: run a function during capture
Date: Tue, 24 Jan 2017 09:43:06 +0100	[thread overview]
Message-ID: <m2k29kyhk5.fsf@charm-wifi.irisa.fr> (raw)
In-Reply-To: <87vat57ghi.fsf@gmail.com> (Nick Dokos's message of "Mon, 23 Jan 2017 13:56:09 -0500")

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

On 2017-01-23 13:56, Nick Dokos <ndokos@gmail.com> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> ...
>> - I added a hook to org-capture-after-finalize-hook
>                                   ^^^^^
>>   #+begin_src emacs-lisp
>>   (defun as/do-org-board-dl-hook ()
>>     (when (equal (buffer-name) (concat "CAPTURE-" as/org-board-capture-file))
>>       (org-board-archive)))
>>
>>   (add-hook 'org-capture-before-finalize-hook 'as/do-org-board-dl-hook)
>                            ^^^^^^
>>   #+end_src
>>
>> (Note: I mistakenly said that the "prepare" hook worked, but that would
>                                      ^^^^^^^
>> download the file even when cancelling, which was wrong)
>
> Make up your mind, will you? :-)

As you can guess, I was testing as I was editing the message. As always,
the code is the truth™.

For the record, here is what I discovered:
- the prepare hook is run even when cancelling
- the before hook is run with the buffer widened, but the point is still
in the same position as when confirming pointer
- when the after hook is run, I did not get access to the captured data
(I may have done it wrong, but since the before hook worked, I did not
look further)

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-12: 404.48, 2015-12: 401.85

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]

      reply	other threads:[~2017-01-24  8:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 16:47 run a function during capture Alan Schmitt
2017-01-19 17:11 ` Nick Dokos
2017-01-23 13:49   ` Alan Schmitt
2017-01-20 13:25 ` Xebar Saram
2017-01-23 14:16   ` Alan Schmitt
2017-01-23 18:56     ` Nick Dokos
2017-01-24  8:43       ` Alan Schmitt [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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=m2k29kyhk5.fsf@charm-wifi.irisa.fr \
    --to=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=ndokos@gmail.com \
    /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 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).