emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Can a post-capture hook know which capture template I used?
@ 2023-04-12  3:46 Marcin Borkowski
  2023-04-12  3:59 ` Max Nikulin
  2023-04-12  5:29 ` Hanno Perrey
  0 siblings, 2 replies; 5+ messages in thread
From: Marcin Borkowski @ 2023-04-12  3:46 UTC (permalink / raw)
  To: Org-Mode mailing list

Hi all,

I'd like to perform some actions after a successful capture.  I know
about `org-capture-.*-finalize-hook's, and I think
`org-capture-after-finalize-hook' is the one I need, but I need to
decide what action to take depending on the capture template used.  How
can I access it?

TIA,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: Can a post-capture hook know which capture template I used?
  2023-04-12  3:46 Can a post-capture hook know which capture template I used? Marcin Borkowski
@ 2023-04-12  3:59 ` Max Nikulin
  2023-04-12  5:29 ` Hanno Perrey
  1 sibling, 0 replies; 5+ messages in thread
From: Max Nikulin @ 2023-04-12  3:59 UTC (permalink / raw)
  To: emacs-orgmode

On 12/04/2023 10:46, Marcin Borkowski wrote:
> 
> I'd like to perform some actions after a successful capture.  I know
> about `org-capture-.*-finalize-hook's, and I think
> `org-capture-after-finalize-hook' is the one I need, but I need to
> decide what action to take depending on the capture template used.  How
> can I access it?

It does not respond to your question directly, but capture templates may 
have the :after-finalize property. In some cases it should allow to 
define a template-specific action.

(info "(org) Template elements")
https://orgmode.org/manual/Template-elements.html
10.1.3.1 Template elements



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

* Re: Can a post-capture hook know which capture template I used?
  2023-04-12  3:46 Can a post-capture hook know which capture template I used? Marcin Borkowski
  2023-04-12  3:59 ` Max Nikulin
@ 2023-04-12  5:29 ` Hanno Perrey
  1 sibling, 0 replies; 5+ messages in thread
From: Hanno Perrey @ 2023-04-12  5:29 UTC (permalink / raw)
  To: Marcin Borkowski, Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> skrev: (12 april 2023 05:46:07 CEST)
>Hi all,
>
>I'd like to perform some actions after a successful capture.  I know
>about `org-capture-.*-finalize-hook's, and I think
>`org-capture-after-finalize-hook' is the one I need, but I need to
>decide what action to take depending on the capture template used.  How
>can I access it?
>
>TIA,
>
>-- 
>Marcin Borkowski
>http://mbork.pl
>

Hej Marcin,

you can call `(plist-get org-capture-plist :key)' to get the template key that was used. For an example with `org-capture-before-finalize-hook', see https://gitlab.com/hperrey/khalel/-/blob/master/khalel.el#L502

Hope that helps!

Best wishes,
Hanno


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

* Re: Can a post-capture hook know which capture template I used?
       [not found] <mailman.61.1681315213.22212.emacs-orgmode@gnu.org>
@ 2023-04-14 20:39 ` No Wayman
  2023-04-15  5:45   ` Marcin Borkowski
  0 siblings, 1 reply; 5+ messages in thread
From: No Wayman @ 2023-04-14 20:39 UTC (permalink / raw)
  To: emacs-orgmode


https://www.github.com/progfolio/doct may be helpful here


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

* Re: Can a post-capture hook know which capture template I used?
  2023-04-14 20:39 ` No Wayman
@ 2023-04-15  5:45   ` Marcin Borkowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2023-04-15  5:45 UTC (permalink / raw)
  To: No Wayman; +Cc: emacs-orgmode


On 2023-04-14, at 22:39, No Wayman <iarchivedmywholelife@gmail.com> wrote:

> https://www.github.com/progfolio/doct may be helpful here

Ha, interesting!  Though I'm not sure how useful this is (at least for
me) - after all, I write capture templates once per year (or more
seldom), and I just copy-paste from my other templates and change them
or look up the docs.  Still, looks nice!

-- 
Marcin Borkowski
http://mbork.pl


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

end of thread, other threads:[~2023-04-15  5:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12  3:46 Can a post-capture hook know which capture template I used? Marcin Borkowski
2023-04-12  3:59 ` Max Nikulin
2023-04-12  5:29 ` Hanno Perrey
     [not found] <mailman.61.1681315213.22212.emacs-orgmode@gnu.org>
2023-04-14 20:39 ` No Wayman
2023-04-15  5:45   ` Marcin Borkowski

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