diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 704c0b7ac..f0c11d60b 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."