From 40084a55d16775519bf7960a7d583894fb606450 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 27 Aug 2012 11:21:52 +0200 Subject: [PATCH] org-exp: Handle inline comments with new syntax * lisp/org-exp.el (org-export-handle-comments): Handle inline comments with new syntax. --- lisp/org-exp.el | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 43652fe83..464c4dbb9 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1985,25 +1985,20 @@ table line. If it is a link, add it to the line containing the link." "Remove comments, or convert to backend-specific format. ORG-COMMENTSP can be a format string for publishing comments. When it is nil, all comments will be removed." - (let ((re "^\\(#\\|[ \t]*#\\+ \\)\\(.*\n?\\)") - pos) + (let ((re "^[ \t]*#\\( \\|$\\)")) (goto-char (point-min)) - (while (or (looking-at re) - (re-search-forward re nil t)) - (setq pos (match-beginning 0)) - (if (get-text-property pos 'org-protected) - (goto-char (1+ pos)) - (if (and org-commentsp - (not (equal (char-before (match-end 1)) ?+))) - (progn (add-text-properties - (match-beginning 0) (match-end 0) '(org-protected t)) - (replace-match (org-add-props - (format org-commentsp (match-string 2)) - nil 'org-protected t) - t t)) - (goto-char (1+ pos)) - (replace-match "") - (goto-char (max (point-min) (1- pos)))))))) + (while (re-search-forward re nil t) + (let ((pos (match-beginning 0)) + (end (progn (forward-line) (point)))) + (if (get-text-property pos 'org-protected) + (forward-line) + (if (not org-commentsp) (delete-region pos end) + (add-text-properties pos end '(org-protected t)) + (replace-match + (org-add-props + (format org-commentsp (buffer-substring (match-end 0) end)) + nil 'org-protected t) + t t))))))) (defun org-export-handle-metalines () "Remove tables and source blocks metalines.