emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 9.1.3.2 Template expansion: documentation issue
@ 2017-01-16 18:20 Karl Eichwalder
  2017-01-22 13:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Eichwalder @ 2017-01-16 18:20 UTC (permalink / raw)
  To: emacs-orgmode

In 9.1.3.2 Template expansion, you say:

      %\n         Insert the text entered at the nth %^{PROMPT}, where 
‘n’ is

but in my 25.1.1, you must use "%\\n".

Maybe, it is also worth noting that

      %^{PROP}p   Prompt the user for a value for property PROP.

will get inserted at the end of a list of properties, but white-space 
will stay
in place:

      :PROP_A:   a
      %^{PROP}p
      :PROP_Z:   z

==>

      :PROP_A:   a

      :PROP_Z:   z
      :PROP:     foo

To avoid white-space issues and an unexpected sorting order, you must 
write (and you lose the preset values):

      :PROPERTIES:%^{PROP_A}p%^{PROP}p%^{PROP_Z}p


-- 
Karl Eichwalder

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

* Re: 9.1.3.2 Template expansion: documentation issue
  2017-01-16 18:20 9.1.3.2 Template expansion: documentation issue Karl Eichwalder
@ 2017-01-22 13:56 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2017-01-22 13:56 UTC (permalink / raw)
  To: Karl Eichwalder; +Cc: emacs-orgmode

Hello,

Karl Eichwalder <ke@gnu.franken.de> writes:

> In 9.1.3.2 Template expansion, you say:
>
>      %\n         Insert the text entered at the nth %^{PROMPT}, where
> ‘n’ is
>
> but in my 25.1.1, you must use "%\\n".

No, you mustn't. The placeholder really is "%\n", but Elisp require
backslash characters to be escaped in strings. So, when you write your
template as a string, you use "%\\n" because it is the only way to have
"%\n".

> Maybe, it is also worth noting that
>
>      %^{PROP}p   Prompt the user for a value for property PROP.
>
> will get inserted at the end of a list of properties, but white-space
> will stay
> in place:
>
>      :PROP_A:   a
>      %^{PROP}p
>      :PROP_Z:   z
>
> ==>
>
>      :PROP_A:   a
>
>      :PROP_Z:   z
>      :PROP:     foo
>
> To avoid white-space issues and an unexpected sorting order, you must
> write (and you lose the preset values):
>
>      :PROPERTIES:%^{PROP_A}p%^{PROP}p%^{PROP_Z}p

You are mis-using %^{prop}p. Granted, `org-capture-templates' docstring
is not particularly clear on this point.

Unlike other placeholders %^{prop}p can be used anywhere in the
template, since it delegates its job to `org-entry-put'. As
a consequence, you shouldn't put it where you expect the property to be
inserted.

Besides, there is no order in properties drawers, so there is no
guarantee that `org-entry-put' will preserve yours.

Would you want to suggest a better wording to explain this in
`org-capture-templates' docstring (and in the related part of the
manual)?

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-01-22 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 18:20 9.1.3.2 Template expansion: documentation issue Karl Eichwalder
2017-01-22 13:56 ` 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).