[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 14a2b27 24/27: Improve conformanc
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 14a2b27 24/27: Improve conformance to code conventions, and documents |
Date: |
Sat, 27 Jun 2020 03:17:45 -0400 (EDT) |
branch: externals/auctex
commit 14a2b2710331aeda20b0f87b6689df5e1188b7db
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Improve conformance to code conventions, and documents
* font-latex.el (font-latex-update-math-env): Rename by changing "--"
to "-" in function name.
Don't alter user customize option `font-latex-math-environments'. In
order to achieve that, use always `texmathp-tex-commands1' for
input and omit argument LIST.
* style/empheq.el: Arrange in accord with the above changes.
* style/amsmath.el:
* style/breqn.el:
* style/mathtools.el:
Arrange in accord with the above changes.
Use `cl-pushnew' instead of `add-to-list' and require cl-lib in order
to do that.
* doc/changes.texi (News in 12.3):
* texmathp.el:
Mention change about support for AMS-LaTeX and packages mathtools,
empheq and breqn.
---
doc/changes.texi | 10 ++++++++++
font-latex.el | 51 +++++++++++++++++++++++++++------------------------
style/amsmath.el | 15 ++++++++-------
style/breqn.el | 13 +++++++------
style/empheq.el | 14 +++++++-------
style/mathtools.el | 6 ++++--
texmathp.el | 11 ++++++-----
7 files changed, 69 insertions(+), 51 deletions(-)
diff --git a/doc/changes.texi b/doc/changes.texi
index 003e55b..396e955 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -31,6 +31,16 @@ instead.
@xref{Fontification of math}.
@end ifclear
@item
+Support for highlighting and in-math state detection for AMS-LaTeX
+specific environments, such as @samp{align}, @samp{gather} and
+@samp{multiline}, are refactored and put into style file
+@file{amsmath.el}. So these support are available only when
+@code{TeX-parse-self} option is enabled.
+
+Support for in-math state detection for packages mathtools, empheq and
+breqn is also moved into the respective style files, so available only
+when @code{TeX-parse-self} option is enabled.
+@item
@AUCTeX{} tracks changes in @LaTeX{}2e 2020-02-02 release. @AUCTeX{}
supports the improvements to @LaTeX{} font selection mechanism (NFSS).
New macros like @samp{\textsw} or @samp{\textulc} are added to font
diff --git a/font-latex.el b/font-latex.el
index 984771d..d7d26fa 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1786,33 +1786,36 @@ customization into `texmathp-tex-commands'."
Set by `font-latex--update-math-env' and used in
`font-latex-match-math-envII'.")
-(defun font-latex--update-math-env (list)
- "Update variables for font locking of math environments by LIST.
+(defun font-latex-update-math-env ()
+ "Update regexp to search for math environments.
Helper function for style files such as amsmath.el.
-LIST should have the same structure as `texmathp-tex-commands'.
-Extract environments marked as `env-on' in LIST and add them to
-`font-latex-math-environments', except starred variants. Then
-update `font-latex--match-math-envII-regexp'."
- (dolist (entry list)
- (if (and (eq 'env-on (cadr entry))
- (not (string= "*" (substring (car entry) -1))))
- ;; Just push since we no longer need to care the order of entries.
- (cl-pushnew (car entry) font-latex-math-environments :test #'equal)))
- (setq font-latex--match-math-envII-regexp
- (concat "\\\\begin[ \t]*{"
- (regexp-opt font-latex-math-environments t)
- ;; Subexpression 2 is used to build the \end{<env>}
- ;; construct later.
- "\\(\\*?}\\)"
- ;; Match an optional and possible mandatory
- ;; argument(s) as long as they are on the same line
- ;; with no spaces in-between. The content of optinal
- ;; argument can span multiple lines.
- "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
- "\\(?:{[^}]*}\\)*")))
+Extract environments marked as `env-on' in
+`texmathp-tex-commands1' except starred variants. Then build
+`font-latex--match-math-envII-regexp' from them, appending the
+environments in `font-latex-math-environments'."
+ ;; Make sure `texmathp-tex-commands1' is up to date.
+ (texmathp-compile)
+ (let (envs)
+ (dolist (entry texmathp-tex-commands1)
+ (if (and (eq 'env-on (cadr entry))
+ (not (string= "*" (substring (car entry) -1))))
+ (cl-pushnew (car entry) envs :test #'equal)))
+ (setq font-latex--match-math-envII-regexp
+ (concat "\\\\begin[ \t]*{"
+ ;; Take user additions also into account.
+ (regexp-opt (append font-latex-math-environments envs) t)
+ ;; Subexpression 2 is used to build the \end{<env>}
+ ;; construct later.
+ "\\(\\*?}\\)"
+ ;; Match an optional and possible mandatory
+ ;; argument(s) as long as they are on the same line
+ ;; with no spaces in-between. The content of optional
+ ;; argument can span multiple lines.
+ "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+ "\\(?:{[^}]*}\\)*"))))
;; Initialize.
-(font-latex--update-math-env texmathp-tex-commands1)
+(font-latex-update-math-env)
(defun font-latex-match-math-envII (limit)
"Match math patterns up to LIMIT.
diff --git a/style/amsmath.el b/style/amsmath.el
index a31d1c1..0fd9817 100644
--- a/style/amsmath.el
+++ b/style/amsmath.el
@@ -29,13 +29,14 @@
;; This will also load the amstext, amsbsy and amsopn style files.
;;; Code:
+(eval-when-compile (require 'cl-lib))
;; Fontification
(declare-function font-latex-add-keywords
"font-latex"
(keywords class))
-(declare-function font-latex--update-math-env
- "font-latex" (list))
+(declare-function font-latex-update-math-env
+ "font-latex")
(require 'texmathp)
(let ((list '(("equation*" env-on)
("align" env-on) ("align*" env-on)
@@ -47,11 +48,11 @@
("xxalignat" env-on) ("\\boxed" arg-on)
("\\text" arg-off) ("\\intertext" arg-off))))
(dolist (entry list)
- (add-to-list 'texmathp-tex-commands-default entry))
- (texmathp-compile)
- (when (and (featurep 'font-latex)
- (eq TeX-install-font-lock 'font-latex-setup))
- (font-latex--update-math-env list)))
+ (cl-pushnew entry texmathp-tex-commands-default :test #'equal)))
+(texmathp-compile)
+(if (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-update-math-env))
(TeX-add-style-hook
"amsmath"
diff --git a/style/breqn.el b/style/breqn.el
index d10fd04..22c45aa 100644
--- a/style/breqn.el
+++ b/style/breqn.el
@@ -49,6 +49,7 @@
;;; Code:
(require 'latex)
+(eval-when-compile (require 'cl-lib))
(defvar LaTeX-breqn-key-val-options
'(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small"
@@ -96,7 +97,7 @@ Keys offered for key=val query depend on ENV. \"label\" and
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
;; Fontification
-(declare-function font-latex--update-math-env "font-latex" (list))
+(declare-function font-latex-update-math-env "font-latex")
(require 'texmathp)
(let ((list '(("dmath" env-on) ("dmath*" env-on)
("dseries" env-on) ("dseries*" env-on)
@@ -104,11 +105,11 @@ Keys offered for key=val query depend on ENV. \"label\"
and
("darray" env-on) ("darray*" env-on)
("dsuspend" env-off))))
(dolist (entry list)
- (add-to-list 'texmathp-tex-commands-default entry))
- (texmathp-compile)
- (when (and (featurep 'font-latex)
- (eq TeX-install-font-lock 'font-latex-setup))
- (font-latex--update-math-env list)))
+ (cl-pushnew entry texmathp-tex-commands-default :test #'equal)))
+(texmathp-compile)
+(if (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-update-math-env))
(TeX-add-style-hook
"breqn"
diff --git a/style/empheq.el b/style/empheq.el
index e8b5b51..9add6c4 100644
--- a/style/empheq.el
+++ b/style/empheq.el
@@ -41,8 +41,8 @@
(declare-function font-latex-add-keywords
"font-latex"
(keywords class))
-(declare-function font-latex--update-math-env
- "font-latex" (list))
+(declare-function font-latex-update-math-env
+ "font-latex")
(declare-function LaTeX-item-equation-alignat
"amsmath" (&optional suppress))
@@ -288,11 +288,11 @@ number of ampersands if possible."
("AmSflalign" env-on) ("AmSflalign*" env-on)
("AmSalignat" env-on) ("AmSalignat*" env-on))))
(dolist (entry list)
- (cl-pushnew entry texmathp-tex-commands-default :test #'equal))
- (texmathp-compile)
- (when (and (featurep 'font-latex)
- (eq TeX-install-font-lock 'font-latex-setup))
- (font-latex--update-math-env list)))
+ (cl-pushnew entry texmathp-tex-commands-default :test #'equal)))
+(texmathp-compile)
+(if (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-update-math-env))
(TeX-add-style-hook
"empheq"
diff --git a/style/mathtools.el b/style/mathtools.el
index 9701353..5695f11 100644
--- a/style/mathtools.el
+++ b/style/mathtools.el
@@ -39,6 +39,8 @@
;; Needed for auto-parsing:
(require 'tex)
+(eval-when-compile (require 'cl-lib))
+
;; Silence the compiler:
(declare-function font-latex-add-keywords
"font-latex"
@@ -237,8 +239,8 @@ Put line break macro on the last line. Next, insert an
ampersand."
;; Fontification
(require 'texmathp)
-(add-to-list 'texmathp-tex-commands-default
- '("\\shortintertext" arg-off))
+(cl-pushnew '("\\shortintertext" arg-off)
+ texmathp-tex-commands-default :test #'equal)
(texmathp-compile)
(TeX-add-style-hook
diff --git a/texmathp.el b/texmathp.el
index 1755de2..326caad 100644
--- a/texmathp.el
+++ b/texmathp.el
@@ -51,11 +51,12 @@
;; specifying which command at what position is responsible for math
;; mode being on or off.
;;
-;; To configure which macros and environments influence LaTeX math mode,
-;; customize the variable `texmathp-tex-commands'. By default
-;; it recognizes the plain TeX and LaTeX core as well as AMS-LaTeX and
-;; packages mathtools, empheq and breqn (see the variable
-;; `texmathp-tex-commands-default', also as an example).
+;; To configure which macros and environments influence LaTeX math
+;; mode, customize the variable `texmathp-tex-commands'. By default
+;; it recognizes the plain TeX and LaTeX core (see the variable
+;; `texmathp-tex-commands-default', also as an example). Support for
+;; AMS-LaTeX and packages mathtools, empheq and breqn is added as
+;; well if `TeX-parse-self' option is enabled.
;;
;; To try out the code interactively, use `M-x texmathp RET'.
;;
- [AUCTeX-diffs] [elpa] externals/auctex 3d4f378 17/27: Fix typos, (continued)
- [AUCTeX-diffs] [elpa] externals/auctex 3d4f378 17/27: Fix typos, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex e62ce38 12/27: Merge branch 'obsolete-font-latex-update-font-lock', Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 1855efd 21/27: ; * style/mathtools.el: A bit change to align with previous commit., Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 3c1f820 25/27: Add TODO item about remove-style feature, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 1e8a495 27/27: Regenerate docs and tex-site.el after merge, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 4c0d150 22/27: Don't call TeX-remove-style in TeX-arg-document., Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 0079026 19/27: ; * tests/latex/fontification-general.tex: Fix Indentation in environments., Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 9170170 11/27: Delete overhead in extending font lock range of math expression, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 3e1adad 23/27: ; * style/breqn.el (): Fix stupid mistake., Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 22d2eb6 20/27: Use constant regexp to fontify math environments, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 14a2b27 24/27: Improve conformance to code conventions, and documents,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 54bb7c1 05/27: Omit hard font-lock reset also in font-latex-add-to-syntax-alist, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex b97a049 03/27: * doc/changes.texi: Delete words inappropriate for raw file., Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 9c105a2 06/27: Trigger refontification in font-latex-add-to-syntax-alist., Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex f3df76a 09/27: Add support for algopseudocde style, Tassilo Horn, 2020/06/27
- [AUCTeX-diffs] [elpa] externals/auctex 5017391 10/27: Update region extension in font-latex.el, Tassilo Horn, 2020/06/27