emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* capture templates and ^{prompt}
@ 2017-06-30  9:14 Jean-Christophe Helary
  2017-06-30  9:18 ` numbchild
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  9:14 UTC (permalink / raw)
  To: Org-mode

I'm looking for a way to use the string acquired by prompt in a second location in the template, like:

* TODO %^{prompt} [/] :sometag:\n** TODO (value of ^{prompt} comes here) :someothertag:\n

What's the best way to get that "value of ^{prompt}" ?

Jean-Christophe 

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

* Re: capture templates and ^{prompt}
  2017-06-30  9:14 capture templates and ^{prompt} Jean-Christophe Helary
@ 2017-06-30  9:18 ` numbchild
  2017-06-30  9:21   ` Jean-Christophe Helary
  0 siblings, 1 reply; 8+ messages in thread
From: numbchild @ 2017-06-30  9:18 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Org-mode

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

Check out the docstring of variable `org-capture-templates`.
There is a doc like this:
```
%\1 ... %\N Insert the text entered at the nth %^{prompt}, where N
              is a number, starting from 1.
```
Maybe this is what you want?

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Fri, Jun 30, 2017 at 5:14 PM, Jean-Christophe Helary <
jean.christophe.helary@gmail.com> wrote:

> I'm looking for a way to use the string acquired by prompt in a second
> location in the template, like:
>
> * TODO %^{prompt} [/] :sometag:\n** TODO (value of ^{prompt} comes here)
> :someothertag:\n
>
> What's the best way to get that "value of ^{prompt}" ?
>
> Jean-Christophe
>

[-- Attachment #2: Type: text/html, Size: 2015 bytes --]

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

* Re: capture templates and ^{prompt}
  2017-06-30  9:18 ` numbchild
@ 2017-06-30  9:21   ` Jean-Christophe Helary
  2017-06-30  9:33     ` Jean-Christophe Helary
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  9:21 UTC (permalink / raw)
  To: Org-mode

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

Ooops, yes, that was totally under my nose :)
Thank you very much.

Jean-Christophe 

> On Jun 30, 2017, at 18:18, numbchild@gmail.com wrote:
> 
> Check out the docstring of variable `org-capture-templates`.
> There is a doc like this:
> ```
> %\1 ... %\N Insert the text entered at the nth %^{prompt}, where N
>               is a number, starting from 1.

[-- Attachment #2: Type: text/html, Size: 1327 bytes --]

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

* Re: capture templates and ^{prompt}
  2017-06-30  9:21   ` Jean-Christophe Helary
@ 2017-06-30  9:33     ` Jean-Christophe Helary
  2017-06-30  9:47       ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30  9:33 UTC (permalink / raw)
  To: Org-mode

* TODO %^{prompt} [/]\n** TODO %\1 %^{prompt} %^t\n

gives

* TODO stuff [/]                                                                                                
** TODO %^A stuff <date>

Why is that ?

Jean-Christophe                                                                                            


> On Jun 30, 2017, at 18:21, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:
> 
> Ooops, yes, that was totally under my nose :)
> Thank you very much.
> 
> Jean-Christophe 
> 
>> On Jun 30, 2017, at 18:18, numbchild@gmail.com wrote:
>> 
>> Check out the docstring of variable `org-capture-templates`.
>> There is a doc like this:
>> ```
>> %\1 ... %\N Insert the text entered at the nth %^{prompt}, where N
>>               is a number, starting from 1.

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

* Re: capture templates and ^{prompt}
  2017-06-30  9:33     ` Jean-Christophe Helary
@ 2017-06-30  9:47       ` Nicolas Goaziou
  2017-06-30 11:04         ` Jean-Christophe Helary
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2017-06-30  9:47 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Org-mode

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

> * TODO %^{prompt} [/]\n** TODO %\1 %^{prompt} %^t\n
>
> gives
>
> * TODO stuff [/]                                                                                                
> ** TODO %^A stuff <date>
>
> Why is that ?

In a string, backslash needs to be escaped: %\\1

Regards,

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

* Re: capture templates and ^{prompt}
  2017-06-30  9:47       ` Nicolas Goaziou
@ 2017-06-30 11:04         ` Jean-Christophe Helary
  2017-07-05  0:17           ` Jean-Christophe Helary
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe Helary @ 2017-06-30 11:04 UTC (permalink / raw)
  To: Org-mode


> On Jun 30, 2017, at 18:47, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 
> Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
> 
>> * TODO %^{prompt} [/]\n** TODO %\1 %^{prompt} %^t\n
>> 
>> gives
>> 
>> * TODO stuff [/]                                                                                                
>> ** TODO %^A stuff <date>
>> 
>> Why is that ?
> 
> In a string, backslash needs to be escaped: %\\1

That's certainly something to add to the documentation:

%\1 ... %\N	Insert the text entered at the Nth %^{prompt}, where N is a number, starting from 1.

Are there cases where %\1 ... %\N would be used *outside* of a string in a template?

Jean-Christophe

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

* Re: capture templates and ^{prompt}
  2017-06-30 11:04         ` Jean-Christophe Helary
@ 2017-07-05  0:17           ` Jean-Christophe Helary
  2017-07-05 21:20             ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe Helary @ 2017-07-05  0:17 UTC (permalink / raw)
  To: Org-mode

Sorry to send this question again:

> Are there cases where %\1 ... %\N would be used *outside* of a string in a template?

Jean-Christophe 


> On Jun 30, 2017, at 20:04, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:
> 
>> 
>> On Jun 30, 2017, at 18:47, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>> 
>> Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
>> 
>>> * TODO %^{prompt} [/]\n** TODO %\1 %^{prompt} %^t\n
>>> 
>>> gives
>>> 
>>> * TODO stuff [/]                                                                             
>>> ** TODO %^A stuff <date>
>>> 
>>> Why is that ?
>> 
>> In a string, backslash needs to be escaped: %\\1
> 
> That's certainly something to add to the documentation:
> 
> %\1 ... %\N	Insert the text entered at the Nth %^{prompt}, where N is a number, starting from 1.
> 
> Are there cases where %\1 ... %\N would be used *outside* of a string in a template?
> 
> Jean-Christophe

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

* Re: capture templates and ^{prompt}
  2017-07-05  0:17           ` Jean-Christophe Helary
@ 2017-07-05 21:20             ` Nicolas Goaziou
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2017-07-05 21:20 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Org-mode

Hello,

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

> Sorry to send this question again:
>
>> Are there cases where %\1 ... %\N would be used *outside* of a string
>>in a template?

I don't think so.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-07-05 21:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30  9:14 capture templates and ^{prompt} Jean-Christophe Helary
2017-06-30  9:18 ` numbchild
2017-06-30  9:21   ` Jean-Christophe Helary
2017-06-30  9:33     ` Jean-Christophe Helary
2017-06-30  9:47       ` Nicolas Goaziou
2017-06-30 11:04         ` Jean-Christophe Helary
2017-07-05  0:17           ` Jean-Christophe Helary
2017-07-05 21:20             ` Nicolas Goaziou

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