summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToby S. Cubitt <tsc25@cantab.net>2012-04-23 17:20:19 +0200
committerBastien Guerry <bzg@altern.org>2012-04-23 17:34:15 +0200
commitb7982a00248a1497b50954aaf0dd0ed553e25ffb (patch)
tree0389840b4b3c3faf70dfaaed056887813aa01237
parent077af66a6f675cb9eba6e287549e32349090d27f (diff)
downloadorg-mode-b7982a00248a1497b50954aaf0dd0ed553e25ffb.tar.gz
org-capture.el: Fixed bug in org-capture-templates %<n> expandos
* lisp/org-capture.el (org-capture-fill-template): Fixed regexp for %<n> expandos to match any positive integer. (org-capture-templates): Updated docstring accordingly. * doc/org.texi: Updated documentation accordingly.
-rw-r--r--doc/org.texi4
-rw-r--r--lisp/org-capture.el6
2 files changed, 5 insertions, 5 deletions
diff --git a/doc/org.texi b/doc/org.texi
index a25572d..bb98713 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -6700,8 +6700,8 @@ 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 for at the nth %^{prompt}, where <n>}
- @r{represents a digit, 1 to 9.}
+%<n> @r{Insert the text entered at the nth %^{prompt}, where <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 7fbd438..d507cc2 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -248,8 +248,8 @@ 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 for at the nth %^{prompt}, where <n>
- represents a digit, 1 to 9.
+ %<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
link type that is created. For example, calling `org-capture' in emails
@@ -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]\\)+" 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)