Browse Source

org-latex.el: bugfix about exporting first lines with no heading.

org-export-latex-first-lines was confused when there was no
heading after the first headlines.  This patch fixes this.
Bastien Guerry 15 years ago
parent
commit
3bc997fe8f
2 changed files with 9 additions and 4 deletions
  1. 4 0
      lisp/ChangeLog
  2. 5 4
      lisp/org-latex.el

+ 4 - 0
lisp/ChangeLog

@@ -1,3 +1,7 @@
+2009-08-30  Bastien Guerry  <bzg@altern.org>
+
+	* org-latex.el (org-export-latex-first-lines): Bugfix.
+
 2009-08-29  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-modify-effort-estimate): Emit message

+ 5 - 4
lisp/org-latex.el

@@ -1003,10 +1003,11 @@ If BEG is non-nil, it is the beginning of the region.
 If END is non-nil, it is the end of the region."
   (save-excursion
     (goto-char (or beg (point-min)))
-    (let* ((pt (point))
-	   (end (if (re-search-forward "^\\*+ " end t)
-		    (goto-char (match-beginning 0))
-		  (goto-char end))))
+    (let* ((pt (point)))
+      (or end
+	  (and (re-search-forward "^\\*+ " end t)
+	       (setq end (match-beginning 0)))
+	  (setq end (point-max)))
       (prog1
 	  (org-export-latex-content
 	   (org-export-preprocess-string