emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with template expansion of previous prompts.
@ 2012-12-06 15:52 Michael Baum
  2012-12-06 23:34 ` Aaron Ecay
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Baum @ 2012-12-06 15:52 UTC (permalink / raw)
  To: emacs-orgmode

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

This syntax in capture templates does not seem to be working for me, and I
can't figure out why:

------------------------8<----------------------------
%\n         Insert the text entered at the nth %^{prompt}, where n is
               a number, starting from 1.
------------------------8<----------------------------

I'm using it like this:

------------------------8<----------------------------
("a" "Addressbook templates")
("af" "Addressbook - family" entry (file+headline org-addressbook-file
"Family")
"* %^{First name} %^{Middle name} %^{Last name}
:PROPERTIES:
:FIRSTNAME: %\1
:MIDDLENAME: %\2
:LASTNAME: %\3
:ADDRESS-H: %^{Home address}
:HOMEPHONE: %^{Home phone}
usw.
------------------------8<----------------------------

But instead of the template filling in the second reference with the values
entered for, eg., {First name}, I get, (also eg.) %^A (and the ^A is
highlighted, maybe a control character?)

Has this syntax maybe changed in a way not reflected in the manual?

Using org-mode 7.9.2 on GNU Emacs 24.2.1 (x86_64-suse-linux-gnu, GTK+
Version 3.4.4)
 of 2012-10-10 on build20.

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: 1569 bytes --]

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

* Re: Problem with template expansion of previous prompts.
  2012-12-06 15:52 Problem with template expansion of previous prompts Michael Baum
@ 2012-12-06 23:34 ` Aaron Ecay
  2012-12-07 20:18   ` Michael Baum
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Ecay @ 2012-12-06 23:34 UTC (permalink / raw)
  To: Michael Baum, emacs-orgmode

You need to escape the backslash inside the string, I think.  "\1" is
interpreted as a string consisting of one character, the ASCII character
with hex code 0x01, which happens to be C-a.  "\\1" is a 2-character
string: backslash, then one.

-- 
Aaron Ecay

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

* Re: Problem with template expansion of previous prompts.
  2012-12-06 23:34 ` Aaron Ecay
@ 2012-12-07 20:18   ` Michael Baum
  2012-12-24  1:17     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Baum @ 2012-12-07 20:18 UTC (permalink / raw)
  To: emacs-orgmode, aaronecay

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

Yes, you're correct, Aaron, thanks. Apparently the secondary substitutions
only get processed after all the questions are asked and the template is
written out to the temp buffer. So the backslash has to be escaped to
survive the first round of substitutions.

I kind of feel that this should be stated more explicitly in the manual. IN
BOLD TYPE.

maabaum

On Thu, Dec 6, 2012 at 6:34 PM, Aaron Ecay <aaronecay@gmail.com> wrote:

> You need to escape the backslash inside the string, I think.  "\1" is
> interpreted as a string consisting of one character, the ASCII character
> with hex code 0x01, which happens to be C-a.  "\\1" is a 2-character
> string: backslash, then one.
>
> --
> Aaron Ecay
>



-- 
====================================
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: 1327 bytes --]

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

* Re: Problem with template expansion of previous prompts.
  2012-12-07 20:18   ` Michael Baum
@ 2012-12-24  1:17     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2012-12-24  1:17 UTC (permalink / raw)
  To: Michael Baum; +Cc: aaronecay, emacs-orgmode

Hi Michael,

Michael Baum <maabaum@gmail.com> writes:

> Yes, you're correct, Aaron, thanks. Apparently the secondary
> substitutions only get processed after all the questions are asked
> and the template is written out to the temp buffer. So the backslash
> has to be escaped to survive the first round of substitutions.
>
> I kind of feel that this should be stated more explicitly in the
> manual. IN BOLD TYPE.

Can you suggest something more precise?  Or send a patch?
We will not use uppercase warnings, but we may try to be more
explicit.

Thanks,

-- 
 Bastien

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

end of thread, other threads:[~2012-12-24  1:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-06 15:52 Problem with template expansion of previous prompts Michael Baum
2012-12-06 23:34 ` Aaron Ecay
2012-12-07 20:18   ` Michael Baum
2012-12-24  1:17     ` Bastien

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