emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Ensure org-export-handle-comments protects its insertions
Date: Mon, 28 Mar 2011 16:20:47 +0100	[thread overview]
Message-ID: <m3lizzz2y8.fsf@e4300lm.epcc.ed.ac.uk> (raw)

* 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	other threads:[~2011-03-28 15:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3lizzz2y8.fsf@e4300lm.epcc.ed.ac.uk \
    --to=wence@gmx.li \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).