branch: externals/auctex commit f04a508f6a85642524ad1a2279f2bfe2bded1db7 Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Restore all math environments in texmathp.el * texmathp.el (texmathp-tex-commands-default): Restore all math environments from style files. The idea to update t-t-c-d by style files afterwards fails when texmathp is used solely in external packages like org mode. * style/amsmath.el: * style/breqn.el: * style/empheq.el: * style/mathtools.el: Adjust in accord with the above change. * doc/changes.texi: Delete relevant entry. --- doc/changes.texi | 9 --------- style/amsmath.el | 23 ----------------------- style/breqn.el | 16 ---------------- style/empheq.el | 20 -------------------- style/mathtools.el | 8 -------- texmathp.el | 40 +++++++++++++++++++++++++++++++++++----- 6 files changed, 35 insertions(+), 81 deletions(-) diff --git a/doc/changes.texi b/doc/changes.texi index 5127927..942daa4 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -49,16 +49,7 @@ instead. @ifclear rawfile @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{multline}, 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). diff --git a/style/amsmath.el b/style/amsmath.el index 2179d57..ebae233 100644 --- a/style/amsmath.el +++ b/style/amsmath.el @@ -29,34 +29,11 @@ ;; 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") -(require 'texmathp) -(let ((list '(("equation*" env-on) - ("align" env-on) ("align*" env-on) - ("gather" env-on) ("gather*" env-on) - ("multline" env-on) ("multline*" env-on) - ("flalign" env-on) ("flalign*" env-on) - ("alignat" env-on) ("alignat*" env-on) - ("xalignat" env-on) ("xalignat*" env-on) - ("xxalignat" env-on) ("\\boxed" arg-on) - ;; In fact, \text macro is provided separately in - ;; amstext.sty, not amsmath.sty. However, it would be - ;; reasonable enough to include support for it here. - ("\\text" arg-off) ("\\intertext" arg-off) - ("\\tag" arg-off) ("\\tag*" arg-off)))) - (dolist (entry 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 22c45aa..cef8519 100644 --- a/style/breqn.el +++ b/style/breqn.el @@ -49,7 +49,6 @@ ;;; Code: (require 'latex) -(eval-when-compile (require 'cl-lib)) (defvar LaTeX-breqn-key-val-options '(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small" @@ -96,21 +95,6 @@ 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") -(require 'texmathp) -(let ((list '(("dmath" env-on) ("dmath*" env-on) - ("dseries" env-on) ("dseries*" env-on) - ("dgroup" env-on) ("dgroup*" env-on) - ("darray" env-on) ("darray*" env-on) - ("dsuspend" env-off)))) - (dolist (entry 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" (lambda () diff --git a/style/empheq.el b/style/empheq.el index 9add6c4..749964a 100644 --- a/style/empheq.el +++ b/style/empheq.el @@ -41,8 +41,6 @@ (declare-function font-latex-add-keywords "font-latex" (keywords class)) -(declare-function font-latex-update-math-env - "font-latex") (declare-function LaTeX-item-equation-alignat "amsmath" (&optional suppress)) @@ -276,24 +274,6 @@ number of ampersands if possible." (save-excursion (insert (make-string (+ ncols ncols -1) ?&)))))) -;; Fontification -(require 'texmathp) -(let ((list '(("empheq" env-on) - ;; XXX: Should we add the remaining entries only when - ;; "overload" or "overload2" option is given? - ("AmSequation" env-on) ("AmSequation*" env-on) - ("AmSalign" env-on) ("AmSalign*" env-on) - ("AmSgather" env-on) ("AmSgather*" env-on) - ("AmSmultline" env-on) ("AmSmultline*" env-on) - ("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) -(if (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-update-math-env)) - (TeX-add-style-hook "empheq" (lambda () diff --git a/style/mathtools.el b/style/mathtools.el index 5695f11..5ee9c96 100644 --- a/style/mathtools.el +++ b/style/mathtools.el @@ -39,8 +39,6 @@ ;; Needed for auto-parsing: (require 'tex) -(eval-when-compile (require 'cl-lib)) - ;; Silence the compiler: (declare-function font-latex-add-keywords "font-latex" @@ -237,12 +235,6 @@ Put line break macro on the last line. Next, insert an ampersand." (save-excursion (insert ?&))) -;; Fontification -(require 'texmathp) -(cl-pushnew '("\\shortintertext" arg-off) - texmathp-tex-commands-default :test #'equal) -(texmathp-compile) - (TeX-add-style-hook "mathtools" (lambda () diff --git a/texmathp.el b/texmathp.el index 326caad..733f639 100644 --- a/texmathp.el +++ b/texmathp.el @@ -53,10 +53,9 @@ ;; ;; 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. +;; 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 try out the code interactively, use `M-x texmathp RET'. ;; @@ -136,7 +135,38 @@ ("\\textrm" arg-off) ("\\(" sw-on) ("\\)" sw-off) ("\\[" sw-on) ("\\]" sw-off) - ("\\ensuremath" arg-on)) + ("\\ensuremath" arg-on) + + ;; AMS-LaTeX + ("equation*" env-on) + ("align" env-on) ("align*" env-on) + ("gather" env-on) ("gather*" env-on) + ("multline" env-on) ("multline*" env-on) + ("flalign" env-on) ("flalign*" env-on) + ("alignat" env-on) ("alignat*" env-on) + ("xalignat" env-on) ("xalignat*" env-on) + ("xxalignat" env-on) ("\\boxed" arg-on) + ("\\text" arg-off) ("\\intertext" arg-off) + ("\\tag" arg-off) ("\\tag*" arg-off) + + ;; mathtools + ("\\shortintertext" arg-off) + + ;; empheq + ("empheq" env-on) + ("AmSequation" env-on) ("AmSequation*" env-on) + ("AmSalign" env-on) ("AmSalign*" env-on) + ("AmSgather" env-on) ("AmSgather*" env-on) + ("AmSmultline" env-on) ("AmSmultline*" env-on) + ("AmSflalign" env-on) ("AmSflalign*" env-on) + ("AmSalignat" env-on) ("AmSalignat*" env-on) + + ;; breqn + ("dmath" env-on) ("dmath*" env-on) + ("dseries" env-on) ("dseries*" env-on) + ("dgroup" env-on) ("dgroup*" env-on) + ("darray" env-on) ("darray*" env-on) + ("dsuspend" env-off)) "The default entries for `texmathp-tex-commands', which see.") (defun texmathp-compile ()