Browse Source

Ensure org-export-handle-comments protects its insertions

* lisp/org-exp.el (org-export-handle-comments): Add the org-protected
property to the replacement string.

Although org-export-handle-comments adds the org-protected property to
the matched string, the subsequent `replace-match' call to change the
comment character does not add this property to the entire format
string.  Fix this by propertizing the entirety of the newtext argument
to replace-match.
Lawrence Mitchell 14 years ago
parent
commit
56cb9cff34
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lisp/org-exp.el

+ 4 - 1
lisp/org-exp.el

@@ -1904,7 +1904,10 @@ When it is nil, all comments will be removed."
 		 (not (equal (char-before (match-end 1)) ?+)))
 	    (progn (add-text-properties
 		    (match-beginning 0) (match-end 0) '(org-protected t))
-		   (replace-match (format commentsp (match-string 2)) t t))
+		   (replace-match (org-add-props
+				      (format commentsp (match-string 2))
+				      nil 'org-protected t)
+				  t t))
 	  (goto-char (1+ pos))
 	  (replace-match "")
 	  (goto-char (max (point-min) (1- pos))))))))