[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 667f4e9 17/67: Defer running styl
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 667f4e9 17/67: Defer running style hook until options are given actually |
Date: |
Fri, 8 Feb 2019 11:40:32 -0500 (EST) |
branch: externals/auctex
commit 667f4e9351702ea1bd54c127bafa2dbf368b1401
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Defer running style hook until options are given actually
* latex.el (LaTeX-arg-usepackage-read-packages-with-options): Don't
run the style hooks before reading package options, just load the
style files for completion of package options.
(LaTeX-arg-usepackage): Run style hooks actually after the package
options are given.
(TeX-arg-document): Don't run the style hooks before reading class
options, just load the style file for completion of class options.
The style hooks are run afterward by `TeX-update-style' anyway.
; Mark unused argument with underscore.
* style/exam.el ("exam"): Prepare `LaTeX-exam-class-options' to have
its full values outside the style hook along with the above idea.
* style/mathtools.el ("mathtools"):
* style/empheq.el ("empheq"):
* style/graphics.el ("graphics"): Set `LaTeX-*****-package-options'
outside the style hook along with the above idea.
---
latex.el | 9 +++++----
style/empheq.el | 12 ++++++------
style/exam.el | 8 +++++---
style/graphics.el | 9 +++++++--
style/mathtools.el | 8 ++++----
5 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/latex.el b/latex.el
index 55945c0..a7be8de 100644
--- a/latex.el
+++ b/latex.el
@@ -2234,7 +2234,7 @@ May be reset with `\[universal-argument]
\[TeX-normal-mode]'.")
To insert a hook here, you must insert it in the appropiate style file.")
-(defun TeX-arg-document (optional &optional _ignore)
+(defun TeX-arg-document (_optional &optional _ignore)
"Insert arguments to documentclass.
OPTIONAL and IGNORE are ignored."
(let* ((TeX-file-extensions '("cls"))
@@ -2255,7 +2255,7 @@ OPTIONAL and IGNORE are ignored."
LaTeX-global-class-files nil nil nil nil LaTeX-default-style))
;; Clean up hook before use.
(setq TeX-after-document-hook nil)
- (TeX-run-style-hooks style)
+ (TeX-load-style style)
(setq var (intern (format "LaTeX-%s-class-options" style)))
(setq defopt (if (stringp LaTeX-default-options)
LaTeX-default-options
@@ -2318,7 +2318,7 @@ of the options, nil otherwise."
"Packages: " TeX-global-input-files))
;; Clean up hook before use in `LaTeX-arg-usepackage-insert'.
(setq LaTeX-after-usepackage-hook nil)
- (mapc 'TeX-run-style-hooks packages)
+ (mapc #'TeX-load-style packages)
;; Prompt for options only if at least one package has been supplied,
return
;; nil otherwise.
(when packages
@@ -2361,7 +2361,8 @@ OPTIONAL is ignored."
(let* ((packages-options (LaTeX-arg-usepackage-read-packages-with-options))
(packages (car packages-options))
(options (cdr packages-options)))
- (LaTeX-arg-usepackage-insert packages options)))
+ (LaTeX-arg-usepackage-insert packages options)
+ (apply #'TeX-run-style-hooks packages)))
(defun LaTeX-insert-usepackages ()
"Prompt for the insertion of usepackage macros until empty
diff --git a/style/empheq.el b/style/empheq.el
index b0231e8..5680132 100644
--- a/style/empheq.el
+++ b/style/empheq.el
@@ -1,6 +1,6 @@
;;; empheq.el --- AUCTeX style for `empheq.sty' (v2.14)
-;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
;; Author: Arash Esbati <address@hidden>
;; Maintainer: address@hidden
@@ -98,6 +98,11 @@
(defvar LaTeX-empheq-package-options
'("overload" "overload2" "ntheorem" "newmultline" "oldmultline")
"Package options for the empheq package.")
+(TeX-load-style "mathtools")
+;; Add elements from `LaTeX-mathtools-package-options' only once
+;; and not every time the style hook runs
+(dolist (elt LaTeX-mathtools-package-options)
+ (add-to-list 'LaTeX-empheq-package-options elt))
;; Setup for \Declare(Left|Right)Delimiter:
@@ -269,11 +274,6 @@ number of ampersands if possible."
;; Load amsmath.el and mathtools.el
(TeX-run-style-hooks "amsmath" "mathtools")
- ;; Add elements from `LaTeX-mathtools-package-options' only once
- ;; and not every time the style hook runs
- (dolist (elt LaTeX-mathtools-package-options)
- (add-to-list 'LaTeX-empheq-package-options elt))
-
;; Local version of key-val options
(setq LaTeX-empheq-key-val-options-local
(copy-alist LaTeX-empheq-key-val-options))
diff --git a/style/exam.el b/style/exam.el
index b761128..20e66f9 100644
--- a/style/exam.el
+++ b/style/exam.el
@@ -36,6 +36,11 @@
'("answers" "noanswers" "cancelspace" "nocancelspace" "addpoints")
"Class options for the exam class.")
+(TeX-load-style "article")
+;; Add options from `LaTeX-article-class-options' only once:
+(dolist (opt LaTeX-article-class-options)
+ (add-to-list 'LaTeX-exam-class-options opt))
+
(defun LaTeX-exam-insert-item ()
"Insert a new item in an environment from exam class.
Item inserted depends on the environment."
@@ -63,9 +68,6 @@ Arguments NAME and TYPE are the same as for the function
"exam"
(lambda ()
(TeX-run-style-hooks "article")
- ;; Add options from `LaTeX-article-class-options' only once:
- (dolist (opt LaTeX-article-class-options)
- (add-to-list 'LaTeX-exam-class-options opt))
;; Make our label prefix available ...
(let ((envs '("questions")))
(dolist (env envs)
diff --git a/style/graphics.el b/style/graphics.el
index a48e612..b74cd4d 100644
--- a/style/graphics.el
+++ b/style/graphics.el
@@ -2,11 +2,16 @@
;;; Code:
+;; Load "graphicx" explicitly to access `LaTeX-graphicx-package-options'
+;; before running style hook "graphics". This is necessary to have
+;; support for completion of package options of "usepackage".
+(TeX-load-style "graphicx")
+(defvar LaTeX-graphics-package-options LaTeX-graphicx-package-options)
+
(TeX-add-style-hook "graphics"
(function
(lambda ()
- (TeX-run-style-hooks "graphicx")
- (setq LaTeX-graphics-package-options LaTeX-graphicx-package-options)))
+ (TeX-run-style-hooks "graphicx")))
LaTeX-dialect)
;;; graphics.el ends here.
diff --git a/style/mathtools.el b/style/mathtools.el
index f36a13d..cfac6ce 100644
--- a/style/mathtools.el
+++ b/style/mathtools.el
@@ -1,6 +1,6 @@
;;; mathtools.el --- Style hook for the LaTeX package `mathtools'.
-;; Copyright (C) 2011-2012, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2012, 2014, 2016, 2018 Free Software Foundation, Inc.
;; Author: Mads Jensen <address@hidden>
;; Created: 2011-02-13
@@ -47,6 +47,9 @@
;; via nonrobust package option)
"nonrobust")
"Package options for the mathtools package.")
+(TeX-load-style "amsmath")
+(dolist (elt LaTeX-amsmath-package-options)
+ (add-to-list 'LaTeX-mathtools-package-options elt))
(defvar LaTeX-mathtools-key-val-options
'(("showonlyrefs")
@@ -240,9 +243,6 @@ Put line break macro on the last line. Next, insert an
ampersand."
;; mathtools requires amsmath, as some bugs in amsmath are fixed
(TeX-run-style-hooks "amsmath")
- (dolist (elt LaTeX-amsmath-package-options)
- (add-to-list 'LaTeX-mathtools-package-options elt))
-
(LaTeX-add-environments
;; 3.4.1 Matrices
'("matrix*" [ "Vertical alignment (l, r or c (default))" ])
- [AUCTeX-diffs] [elpa] externals/auctex d2b0547 16/67: Fix not to run wrong style hooks, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex d2b0547 16/67: Fix not to run wrong style hooks, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 7030681 29/67: * tex-buf.el (TeX-special-mode): Use `define-derived-mode'., Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 4617caa 26/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 0a05b39 22/67: Use `declare-function' without `fboundp' test, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex ff75757 21/67: Remove references to older emacsens in comments and doc strings, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 449ec06 43/67: ; Silence the compiler in styles for `reftex-compile-variables', Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 6610f48 42/67: ; Silence the compiler in styles for `font-latex-add-to-syntax-alist', Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 38d39a6 31/67: Remove compatibility face, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 9ae66cd 33/67: Remove TeX-replace-regexp-in-string, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 5551227 30/67: Remove XEmacs compatibility code in tex-bar.el, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 667f4e9 17/67: Defer running style hook until options are given actually,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 993326c 40/67: ; Silence the compiler in styles for `font-latex-syntactic-keywords-extra', Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 3ce90db 36/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 9c42b43 52/67: Use ASCII apostrophe in code expample, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex dcfdd69 61/67: Fix test conditions on w32, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 49c71f9 44/67: ; Silence the compiler in styles for `LaTeX-x?color-definecolor-list', Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex bbe53ed 53/67: Fix document, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 49720ce 62/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 4cfd116 65/67: Add support for w and W column specifiers, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 253e900 25/67: Adjust autoload cookie, Tassilo Horn, 2019/02/08
- [AUCTeX-diffs] [elpa] externals/auctex 38f9d72 63/67: Remove compatibility code for older emacsen, Tassilo Horn, 2019/02/08