changeset 257:2b85ef062ccf dev

Do not put new paragraph at the beginning of document environment.
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 12 Feb 2012 11:17:04 +0900
parents b1e70dc23208
children 3995f7fc6678
files yatexenv.el
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/yatexenv.el	Sun Feb 12 11:01:27 2012 +0900
+++ b/yatexenv.el	Sun Feb 12 11:17:04 2012 +0900
@@ -2,7 +2,7 @@
 ;;; YaTeX environment-specific functions.
 ;;; yatexenv.el
 ;;; (c) 1994-2012 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Sat Feb 11 12:15:22 2012 on firestorm
+;;; Last modified Sun Feb 12 11:15:33 2012 on firestorm
 ;;; $Id$
 
 ;;;
@@ -259,11 +259,17 @@
 ;;;
 (defun YaTeX-intelligent-newline-document ()
   "New paragraph by null line or `\\par'."
-  (if (save-excursion (re-search-backward "\\\\par\\>" nil t))
-      (progn
-	(YaTeX-indent-line)
-	(insert "\\par")))
-  (newline)
+  (if (< (count-lines
+	  (or (get 'YaTeX-inner-environment 'point)
+	      (max 1 (- (point) 17)))	;"\begin{document}\n" == 17
+	  (point))
+	 2)
+      nil
+    (if (save-excursion (re-search-backward "\\\\par\\>" nil t))
+	(progn
+	  (YaTeX-indent-line)
+	  (insert "\\par")))
+    (newline))
   (YaTeX-indent-line))
 
 ;;;

yatex.org