auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] Changes to auctex/latex.el,v


From: Tassilo Horn
Subject: [AUCTeX-diffs] Changes to auctex/latex.el,v
Date: Thu, 10 Jan 2013 09:29:34 +0000

CVSROOT:        /sources/auctex
Module name:    auctex
Changes by:     Tassilo Horn <tsdh>     13/01/10 09:29:33

Index: latex.el
===================================================================
RCS file: /sources/auctex/auctex/latex.el,v
retrieving revision 5.476
retrieving revision 5.477
diff -u -b -r5.476 -r5.477
--- latex.el    30 Dec 2012 17:05:47 -0000      5.476
+++ latex.el    10 Jan 2013 09:29:33 -0000      5.477
@@ -763,12 +763,24 @@
 
 (defun LaTeX-env-document (&optional ignore)
   "Create new LaTeX document.
+Also inserts a \\documentclass macro if there's none already
 The compatibility argument IGNORE is ignored."
+  ;; just assume a single valid \\documentclass, i.e., one not in a
+  ;; commented line
+  (let ((found nil))
+    (save-excursion
+      (while (and (not found)
+                 (re-search-backward
+                  
"\\\\documentclass\\(\\[[a-z0-9A-Z\-\_,]*\\]\\)?\\({[^}]+}\\)"
+                  nil t))
+       (and (not (TeX-in-commented-line))
+            (setq found t))))
+    (when (not found)
   (TeX-insert-macro "documentclass")
   (LaTeX-newline)
   (LaTeX-newline)
   (LaTeX-newline)
-  (end-of-line 0)
+      (end-of-line 0)))
   (LaTeX-insert-environment "document")
   (run-hooks 'LaTeX-document-style-hook)
   (setq LaTeX-document-style-hook nil))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]