summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-08-24 15:45:03 +0200
committerBastien Guerry <bzg@altern.org>2012-08-24 15:45:03 +0200
commitdd31878ee74b1bb78215be83db39857a799a5b17 (patch)
tree7d267744e304bf8aaa0a9f99864bcb8adf79390e
parent82007c40da966025b64e4ef8f7b77efad2a295c6 (diff)
downloadorg-mode-dd31878ee74b1bb78215be83db39857a799a5b17.tar.gz
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.
-rw-r--r--lisp/org-capture.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 5cd3b8f..407e3be 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1452,7 +1452,8 @@ The template may still contain \"%?\" for cursor positioning."
(org-split-string initial "\n")
(concat "\n" lead))))))
(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)))
;; From the property list
@@ -1469,8 +1470,8 @@ The template may still contain \"%?\" for cursor positioning."
(let ((org-inhibit-startup t)) (org-mode))
;; Interactive template entries
(goto-char (point-min))
- (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?"
- nil t)
+ (while (and (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
+ (not (get-text-property (point) 'org-protected)))
(unless (org-capture-escaped-%)
(setq char (if (match-end 3) (match-string-no-properties 3))
prompt (if (match-end 2) (match-string-no-properties 2)))