瀏覽代碼

LaTeX export: Avoid infinite loop when environment is not closed

Carsten Dominik 16 年之前
父節點
當前提交
b85b2e1f19
共有 2 個文件被更改,包括 10 次插入7 次删除
  1. 2 0
      lisp/ChangeLog
  2. 8 7
      lisp/org-latex.el

+ 2 - 0
lisp/ChangeLog

@@ -3,6 +3,8 @@
 	* org-latex.el (org-export-latex-quotation-marks): Fix export of
 	* org-latex.el (org-export-latex-quotation-marks): Fix export of
 	quotation makrs in parenthesis.
 	quotation makrs in parenthesis.
 	(org-remove-initial-hash): New function.
 	(org-remove-initial-hash): New function.
+	(org-export-latex-preprocess): Fix bug with infinite loop if
+	environment is not properly closed.
 
 
 	* org-table.el (org-table-get-remote-range): Find #+TBLNAME also
 	* org-table.el (org-table-get-remote-range): Find #+TBLNAME also
 	when indented.
 	when indented.

+ 8 - 7
lisp/org-latex.el

@@ -1542,13 +1542,14 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   (goto-char (point-min))
   (goto-char (point-min))
   (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\*?\\)}" nil t)
   (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\*?\\)}" nil t)
     (let* ((start (progn (beginning-of-line) (point)))
     (let* ((start (progn (beginning-of-line) (point)))
-	   (end (or (and (re-search-forward
-			  (concat "^[ \t]*\\\\end{"
-				  (regexp-quote (match-string 1))
-				  "}") nil t)
-			 (point-at-eol))
-		    (point-max))))
-      (add-text-properties start end '(org-protected t))))
+	   (end (and (re-search-forward
+		      (concat "^[ \t]*\\\\end{"
+			      (regexp-quote (match-string 1))
+			      "}") nil t)
+		     (point-at-eol))))
+      (if end
+	  (add-text-properties start end '(org-protected t))
+	(goto-char (point-at-eol))))))
 
 
   ;; Preserve math snippets
   ;; Preserve math snippets