emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Ensure org-export-handle-comments protects its insertions
@ 2011-03-28 15:20 Lawrence Mitchell
  0 siblings, 0 replies; only message in thread
From: Lawrence Mitchell @ 2011-03-28 15:20 UTC (permalink / raw)
  To: emacs-orgmode

* 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-28 15:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-28 15:20 [PATCH] Ensure org-export-handle-comments protects its insertions Lawrence Mitchell

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).