瀏覽代碼

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.
Toby S. Cubitt 13 年之前
父節點
當前提交
b7982a0024
共有 2 個文件被更改,包括 5 次插入5 次删除
  1. 2 2
      doc/org.texi
  2. 3 3
      lisp/org-capture.el

+ 2 - 2
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{You may specify a default value and a completion table with}
             @r{%^@{prompt|default|completion2|completion3...@}.}
             @r{%^@{prompt|default|completion2|completion3...@}.}
             @r{The arrow keys access a prompt-specific history.}
             @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.}
 %?          @r{After completing the template, position cursor here.}
 @end smallexample
 @end smallexample
 
 

+ 3 - 3
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:
               A default value and a completion table ca be specified like this:
               %^{prompt|default|completion2|completion3|...}.
               %^{prompt|default|completion2|completion3|...}.
   %?          After completing the template, position cursor here.
   %?          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
 Apart from these general escapes, you can access information specific to the
 link type that is created.  For example, calling `org-capture' in emails
 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
       ;; Replace %n escapes with nth %^{...} string
       (setq strings (nreverse strings))
       (setq strings (nreverse strings))
       (goto-char (point-min))
       (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-%)
 	(unless (org-capture-escaped-%)
 	  (replace-match
 	  (replace-match
 	   (nth (1- (string-to-number (match-string 1))) strings)
 	   (nth (1- (string-to-number (match-string 1))) strings)