org-capture.el: Protect the text used for replacement from being further replaced

* org-capture.el (org-capture-fill-template): Protect the text
used for replacement from being further replaced.

Thanks to Moritz Ulrich for reporting this bug.
This commit is contained in:
Bastien Guerry 2012-08-24 15:45:03 +02:00
parent 82007c40da
commit dd31878ee7
1 changed files with 4 additions and 3 deletions

View File

@ -1452,7 +1452,8 @@ The template may still contain \"%?\" for cursor positioning."
(org-split-string initial "\n") (org-split-string initial "\n")
(concat "\n" lead)))))) (concat "\n" lead))))))
(replace-match (replace-match
(or (eval (intern (concat "v-" (match-string 1)))) "") (or (org-add-props (eval (intern (concat "v-" (match-string 1))))
'(org-protected t)) "")
t t))) t t)))
;; From the property list ;; From the property list
@ -1469,8 +1470,8 @@ The template may still contain \"%?\" for cursor positioning."
(let ((org-inhibit-startup t)) (org-mode)) (let ((org-inhibit-startup t)) (org-mode))
;; Interactive template entries ;; Interactive template entries
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" (while (and (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
nil t) (not (get-text-property (point) 'org-protected)))
(unless (org-capture-escaped-%) (unless (org-capture-escaped-%)
(setq char (if (match-end 3) (match-string-no-properties 3)) (setq char (if (match-end 3) (match-string-no-properties 3))
prompt (if (match-end 2) (match-string-no-properties 2))) prompt (if (match-end 2) (match-string-no-properties 2)))