Browse Source

Fix bug with removing xomments during export.

Reported by Adam Spiers.
Carsten Dominik 17 years ago
parent
commit
5d70b8f761
2 changed files with 11 additions and 5 deletions
  1. 5 0
      lisp/ChangeLog
  2. 6 5
      lisp/org-exp.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2008-06-10  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org-exp.el (org-export-handle-comments): Fix bug with several
+	comment lines after each other.
+
 2008-06-09  Carsten Dominik  <dominik@science.uva.nl>
 
 	* org-exp.el (org-export-protect-examples): Catch the case of a

+ 6 - 5
lisp/org-exp.el

@@ -1571,10 +1571,12 @@ These special cookies will later be interpreted by the backend."
 (defun org-export-handle-comments (commentsp)
   "Remove comments, or convert to backend-specific format.
 COMMENTSP can be a format string for publishing comments.
-When it is nit, all comments will be removed."
-  (let (pos)
+When it is nil, all comments will be removed."
+  (let ((re "^#\\(.*\n?\\)")
+	pos)
     (goto-char (point-min))
-    (while (re-search-forward "^#\\(.*\n?\\)" nil t)
+    (while (or (looking-at re)
+	       (re-search-forward re nil t))
       (setq pos (match-beginning 0))
       (if commentsp
 	  (progn (add-text-properties
@@ -1583,8 +1585,7 @@ When it is nit, all comments will be removed."
 	(goto-char (1+ pos))
 	(org-if-unprotected
 	 (replace-match "")
-	 (goto-char (max (point-min) (1- pos))))
-	(end-of-line 1)))))
+	 (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."