emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* is it possible to reuse a capture template expansion?
@ 2016-10-04 15:52 Stig Brautaset
  2016-10-04 17:10 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Stig Brautaset @ 2016-10-04 15:52 UTC (permalink / raw)
  To: emacs-orgmode

 
I've got a capture template where I want to prompt for a string and use
it in two places, but I end up being prompted twice. I want a template
something like the below, and be prompted only once each for Title and
Abstract. Is that possible somehow? Any help appreciated.


: * TODO Write %^{Title} Blog post
: #+begin_html
: ---
: title: %^{Title}
: layout: post
: abstract: %^{Abstract}
: ---
: #+end_html
:
: %^{Abstract}
:
: %?

Stig

-- 
: Stig Brautaset, GNU Emacs 25.1.1, Org-mode version 8.3.6

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

* Re: is it possible to reuse a capture template expansion?
  2016-10-04 15:52 is it possible to reuse a capture template expansion? Stig Brautaset
@ 2016-10-04 17:10 ` Nicolas Goaziou
  2016-10-04 20:12   ` Stig Brautaset
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2016-10-04 17:10 UTC (permalink / raw)
  To: Stig Brautaset; +Cc: emacs-orgmode

Hello,

Stig Brautaset <stig@brautaset.org> writes:

> I've got a capture template where I want to prompt for a string and use
> it in two places, but I end up being prompted twice. I want a template
> something like the below, and be prompted only once each for Title and
> Abstract. Is that possible somehow? Any help appreciated.
>
>
> : * TODO Write %^{Title} Blog post
> : #+begin_html
> : ---
> : title: %^{Title}
> : layout: post
> : abstract: %^{Abstract}
> : ---
> : #+end_html
> :
> : %^{Abstract}
> :
> : %?

You can use %1, %2... to reuse the first string, the second one...

Regards,

-- 
Nicolas Goaziou

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

* Re: is it possible to reuse a capture template expansion?
  2016-10-04 17:10 ` Nicolas Goaziou
@ 2016-10-04 20:12   ` Stig Brautaset
  0 siblings, 0 replies; 3+ messages in thread
From: Stig Brautaset @ 2016-10-04 20:12 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Stig Brautaset <stig@brautaset.org> writes:
>
>> I've got a capture template where I want to prompt for a string and use
>> it in two places, but I end up being prompted twice. 

[...]

> You can use %1, %2... to reuse the first string, the second one...

Thanks! I now managed to get it to work, but had to add more
backslashes: %\1, %\2 etc, not %1, %2. BTW, the manual[1] actually says
%\\n, so adds _too many_ backslashes :-)

[1] http://orgmode.org/manual/Template-expansion.html#Template-expansion 


Stig

-- 
: Stig Brautaset, GNU Emacs 25.1.1, Org-mode version 8.3.6

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

end of thread, other threads:[~2016-10-04 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 15:52 is it possible to reuse a capture template expansion? Stig Brautaset
2016-10-04 17:10 ` Nicolas Goaziou
2016-10-04 20:12   ` Stig Brautaset

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