From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Mitchell Subject: [PATCH] Ensure org-export-handle-comments protects its insertions Date: Mon, 28 Mar 2011 16:20:47 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=59876 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4EJZ-00049Z-OI for emacs-orgmode@gnu.org; Mon, 28 Mar 2011 11:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4EJY-0000BG-90 for emacs-orgmode@gnu.org; Mon, 28 Mar 2011 11:25:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:41045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4EJY-0000B5-1I for emacs-orgmode@gnu.org; Mon, 28 Mar 2011 11:25:08 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q4EJU-0006IM-MU for emacs-orgmode@gnu.org; Mon, 28 Mar 2011 17:25:04 +0200 Received: from e4300lm.epcc.ed.ac.uk ([129.215.63.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Mar 2011 17:25:04 +0200 Received: from wence by e4300lm.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Mar 2011 17:25:04 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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