[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 23/299: * latex.el (LaTeX-env-document): Only insert \documentcla
From: |
Stefan Monnier |
Subject: |
[elpa] 23/299: * latex.el (LaTeX-env-document): Only insert \documentclass in case the document does not already contain one. |
Date: |
Sun, 02 Nov 2014 03:09:57 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 4dfd0f098c3dd015114d2596fe15ef5016c1f3cb
Author: Tassilo Horn <address@hidden>
Date: Thu Jan 10 09:29:33 2013 +0000
* latex.el (LaTeX-env-document): Only insert \documentclass in
case the document does not already contain one.
---
ChangeLog | 5 +++++
latex.el | 22 +++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fb2f088..5ce8d4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-10 Mads Jensen <address@hidden>
+
+ * latex.el (LaTeX-env-document): Only insert \documentclass in
+ case the document does not already contain one.
+
2013-01-09 Ralf Angeli <address@hidden>
* style/epigraph.el ("epigraph"): Do not quote list entries for
diff --git a/latex.el b/latex.el
index 4f94cbf..fcff159 100644
--- a/latex.el
+++ b/latex.el
@@ -763,12 +763,24 @@ To insert a hook here, you must insert it in the
appropiate style file.")
(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."
- (TeX-insert-macro "documentclass")
- (LaTeX-newline)
- (LaTeX-newline)
- (LaTeX-newline)
- (end-of-line 0)
+ ;; 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)))
(LaTeX-insert-environment "document")
(run-hooks 'LaTeX-document-style-hook)
(setq LaTeX-document-style-hook nil))
- [elpa] 21/299: * style/footmisc.el ("footmisc"): Remove fontification settings for length macros., (continued)
- [elpa] 21/299: * style/footmisc.el ("footmisc"): Remove fontification settings for length macros., Stefan Monnier, 2014/11/01
- [elpa] 06/299: * latex.el (LaTeX-math-default): Added unicode character position to some entries and "mathring" entry. (LaTeX-common-initialization): Added support for accent macros \hat, \dot etc and \textasteriskcentered., Stefan Monnier, 2014/11/01
- [elpa] 16/299: * latex.el (LaTeX-pagestyle-list): New variable. (TeX-arg-pagestyle): Use it. * style/imakeidx.el: New style by Mosè Giordano <address@hidden>., Stefan Monnier, 2014/11/01
- [elpa] 22/299: * style/epigraph.el ("epigraph"): Do not quote list entries for `font-latex-add-keywords'., Stefan Monnier, 2014/11/01
- [elpa] 20/299: * style/mathtools.el ("mathtools"): Append amsmath options to mathtools option after the amsmath style file has been loaded. Remove `function' wrapper., Stefan Monnier, 2014/11/01
- [elpa] 12/299: * style/siunitx.el (LaTeX-siunitx-package-options): New variable. ("siunitx"): Use it. * style/hyperref.el (LaTeX-hyperref-href-options): New variable. (LaTeX-hyperref-package-options, "hyperref"): Use it., Stefan Monnier, 2014/11/01
- [elpa] 04/299: * style/bm.el: New style by Mosè Giordano <address@hidden>. * style/siunitx.el: Ditto., Stefan Monnier, 2014/11/01
- [elpa] 03/299: * tex-bar.el (TeX-bar-LaTeX-buttons, TeX-bar-LaTeX-button-alist): Also add spell button., Stefan Monnier, 2014/11/01
- [elpa] 27/299: * latex.el (TeX-arg-environment): Fix typo., Stefan Monnier, 2014/11/01
- [elpa] 25/299: * tex.el (TeX-command-list): Add command to run ChkTeX., Stefan Monnier, 2014/11/01
- [elpa] 23/299: * latex.el (LaTeX-env-document): Only insert \documentclass in case the document does not already contain one.,
Stefan Monnier <=
- [elpa] 26/299: * latex.el: Update copyright range. (LaTeX-auto-pagestyle-regexp-list): New variable. (LaTeX-auto-regexp-list): Use `LaTeX-auto-pagestyle-regexp-list'. ("pagestyle"): New type for the parser. (LaTeX-pagestyle-list): Remove. (TeX-arg-pagestyle): Use `LaTeX-pagestyle-list' function for completing. (LaTeX-common-initialization): Initialize pagestyles. * style/imakeidx.el: Use `LaTeX-pagestyle-list' function to set `firstpagestyle' option values., Stefan Monnier, 2014/11/01
- [elpa] 24/299: * Makefile.in (STYLESRC): Add new style files kantlipsum.el, lipsum.el, and longtable.el. * style/kantlipsum.el: New style. * style/lipsum.el: Ditto. * style/longtable.el: Ditto, Stefan Monnier, 2014/11/01
- [elpa] 29/299: * style/pstricks.el (LaTeX-pstricks-package-options): New variable., Stefan Monnier, 2014/11/01
- [elpa] 28/299: * Makefile.in (STYLESRC): Enable memoir.el style. * style/memoir.el: New style., Stefan Monnier, 2014/11/01
- [elpa] 32/299: * style/ulem.el (LaTeX-arg-fontdecl, LaTeX-arg-fontcmd): Fix declarations., Stefan Monnier, 2014/11/01
- [elpa] 34/299: Fix previous change to auctex.texi., Stefan Monnier, 2014/11/01
- [elpa] 30/299: * style/varioref.el: Update copyright range. ("varioref"): Add more definitions. (LaTeX-varioref-package-options): Reformat., Stefan Monnier, 2014/11/01
- [elpa] 36/299: * doc/auctex.texi: Document `TeX-arg-length' and `TeX-arg-define-length'., Stefan Monnier, 2014/11/01
- [elpa] 37/299: * doc/todo.texi: Remove the todo concerning completion for counters that was implemented by Mosè Giordano on 2013-01-15., Stefan Monnier, 2014/11/01
- [elpa] 31/299: * style/listings.el: Update copyright range. (LaTeX-listings-key-val-options, "listings") (LaTeX-listings-package-options): Update to recent listings version., Stefan Monnier, 2014/11/01