emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Capture template -- Global replacement of prompt string in buffer?
@ 2012-11-02 18:13 Michael Baum
  2012-11-26  0:33 ` Bernt Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Baum @ 2012-11-02 18:13 UTC (permalink / raw)
  To: emacs-orgmode

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

I'm not sure (because I didn't understand what was going on) if this is the
same question that Sebastian Fischmeister  asked earlier ("Custom escapes &
the evaluation order in fill-template"), but is it possible to construct a
capture template using something like the %{prompt} that replaces _all_
occurrences of the prompt string throughout the capture buffer,  rather
than just at the insertion point of the escape expression?

I want to do something like this:
-----------8<--------------------------------
("p" "phone log" entry (file+datetree org-phone-log)
"* %^{Organization} - %^{First Name} %^{Last Name}
:PROPERTIES:
:FIRST_NAME: {First Name}
:LAST_NAME: {Last Name}
:ORG: {Organization}
:END:

usw.
-----------8<--------------------------------

where the value entered in response to {First Name} gets globally
substituted in two or more places in the template.

Can this be done?

tnx,
maab

-- 
====================================
Michael Baum <maabaum@gmail.com>

You should never have your best trousers on when you go out
 to fight for freedom and truth. - Ibsen

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

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

* Re: Capture template -- Global replacement of prompt string in buffer?
  2012-11-02 18:13 Capture template -- Global replacement of prompt string in buffer? Michael Baum
@ 2012-11-26  0:33 ` Bernt Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Bernt Hansen @ 2012-11-26  0:33 UTC (permalink / raw)
  To: Michael Baum; +Cc: emacs-orgmode

Michael Baum <maabaum@gmail.com> writes:

> I'm not sure (because I didn't understand what was going on) if this is the same question that Sebastian Fischmeister  asked earlier ("Custom escapes & the evaluation order in fill-template"), but is it
> possible to construct a capture template using something like the %{prompt} that replaces _all_ occurrences of the prompt string throughout the capture buffer,  rather than just at the insertion point of
> the escape expression?
>
> I want to do something like this:
> -----------8<--------------------------------
> ("p" "phone log" entry (file+datetree org-phone-log)
> "* %^{Organization} - %^{First Name} %^{Last Name}
> :PROPERTIES:
> :FIRST_NAME: {First Name}
> :LAST_NAME: {Last Name}
> :ORG: {Organization}
> :END:
>
> usw.
> -----------8<--------------------------------
>
> where the value entered in response to {First Name} gets globally substituted in two or more places in the template.
>
> Can this be done?

Hi Michael,

Yes this is possible but you have to reference the prompt fields by
position.

--8<---------------cut here---------------start------------->8---
("p" "phone log" entry (file+datetree org-phone-log)
 "* %^{Organization} - %^{First Name} %^{Last Name}
:PROPERTIES:
:FIRST_NAME: %\\2
:LAST_NAME: %\\3
:ORG: %\\1
:END:
")
--8<---------------cut here---------------end--------------->8---

Should do what you want I think.

Regards,
Bernt

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

end of thread, other threads:[~2012-11-26  0:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02 18:13 Capture template -- Global replacement of prompt string in buffer? Michael Baum
2012-11-26  0:33 ` Bernt Hansen

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