summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-06-27 19:35:34 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-06-28 08:00:43 -0700
commit0e636dc2ed8dc4c2a4663551d975ee2a6719c967 (patch)
tree9d3396f334b5e8fc1f5f5fbe5ecc820a223e0966
parentee629299c0f699c5fa9274720ad89286b8ea1e73 (diff)
downloadorg-mode-0e636dc2ed8dc4c2a4663551d975ee2a6719c967.tar.gz
org-exp: check for protection before removing comments
* lisp/org-exp.el (org-export-handle-comments): check for protection before removing comments
-rw-r--r--lisp/org-exp.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 704c0b7..f0c11d6 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1644,14 +1644,17 @@ When it is nil, all comments will be removed."
(while (or (looking-at re)
(re-search-forward re nil t))
(setq pos (match-beginning 0))
- (if (and commentsp
- (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))
- (goto-char (1+ pos))
- (replace-match "")
- (goto-char (max (point-min) (1- pos)))))))
+ (if (get-text-property (point) 'org-protected)
+ (goto-char (1+ pos))
+ (if (and commentsp
+ (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))
+ (goto-char (1+ pos))
+ (replace-match "")
+ (goto-char (max (point-min) (1- pos))))))))
+
(defun org-export-mark-radio-links ()
"Find all matches for radio targets and turn them into internal links."