emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Ensure org-export-handle-comments protects its insertions


From: Lawrence Mitchell
Subject: [O] [PATCH] Ensure org-export-handle-comments protects its insertions
Date: Mon, 28 Mar 2011 16:20:47 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux)

* 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.
---
I think this change makes the actual implementation match the
intention of the code, we want the replacement comment character
to be protected as well, however, I'm not sure if this breaks the
usecases in ob-tangle and the like.

 lisp/org-exp.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 3e84314..da2475e 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1853,7 +1853,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 (propertize
+                                  (format commentsp (match-string 2))
+                                  'org-protected t)
+                                 t t))
          (goto-char (1+ pos))
          (replace-match "")
          (goto-char (max (point-min) (1- pos))))))))
-- 
1.7.4.rc2.18.gb20e9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]