summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-04-24 11:54:16 +0200
committerBastien Guerry <bzg@altern.org>2012-04-24 11:54:16 +0200
commit1666b910fe7bfdecbe8950fc5465ee990f541272 (patch)
treebf9f645dbfcacb847a1642583cfde59cd1bde0b3
parentfdace895fa15ca6cf461a4b4a22a01747c80b33b (diff)
downloadorg-mode-1666b910fe7bfdecbe8950fc5465ee990f541272.tar.gz
org-capture.el: Use %\n instead of %n.
* org-capture.el (org-capture-fill-template): Use %\n instead of %n as a template element to be replaced with the nth prompted string. (org-capture-templates): Update docstring. * org.texi (Template expansion): Update doc to reflect change. Using %n triggers errors when the template contains escaped strings, which happens a lot with links.
-rw-r--r--doc/org.texi2
-rw-r--r--lisp/org-capture.el4
2 files changed, 3 insertions, 3 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 65dbb28..e22d446 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -6700,7 +6700,7 @@ dynamic insertion of content. The templates are expanded in the order given her
@r{You may specify a default value and a completion table with}
@r{%^@{prompt|default|completion2|completion3...@}.}
@r{The arrow keys access a prompt-specific history.}
-%<n> @r{Insert the text entered at the nth %^@{@var{prompt}@}, where <n> is}
+%\n @r{Insert the text entered at the nth %^@{@var{prompt}@}, where @code{n} is}
@r{a number, starting from 1.}
%? @r{After completing the template, position cursor here.}
@end smallexample
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d507cc2..25b12dc 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -248,7 +248,7 @@ be replaced with content and expanded in this order:
A default value and a completion table ca be specified like this:
%^{prompt|default|completion2|completion3|...}.
%? After completing the template, position cursor here.
- %<n> Insert the text entered at the nth %^{prompt}, where <n> is
+ %\\n Insert the text entered at the nth %^{prompt}, where `n' is
a number, starting from 1.
Apart from these general escapes, you can access information specific to the
@@ -1480,7 +1480,7 @@ The template may still contain \"%?\" for cursor positioning."
;; Replace %n escapes with nth %^{...} string
(setq strings (nreverse strings))
(goto-char (point-min))
- (while (re-search-forward "%\\([1-9][0-9]*\\)" nil t)
+ (while (re-search-forward "%\\\\\\([1-9][0-9]*\\)" nil t)
(unless (org-capture-escaped-%)
(replace-match
(nth (1- (string-to-number (match-string 1))) strings)