emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Michael Baum <maabaum@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Capture template -- Global replacement of prompt string in buffer?
Date: Sun, 25 Nov 2012 19:33:21 -0500	[thread overview]
Message-ID: <87ip8tp5im.fsf@norang.ca> (raw)
In-Reply-To: <CA+G3xFh9SSHLaHn_A_BTFxswfaq=OyOY3hnaXagQK1TC=uABSA@mail.gmail.com> (Michael Baum's message of "Fri, 2 Nov 2012 14:13:34 -0400")

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

      reply	other threads:[~2012-11-26  0:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02 18:13 Capture template -- Global replacement of prompt string in buffer? Michael Baum
2012-11-26  0:33 ` Bernt Hansen [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=87ip8tp5im.fsf@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=maabaum@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).