branch: main commit 696400c90f685126e8788178999ed1e7bdda2193 Merge: 4473c1f2 ba0b1af3 Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge remote-tracking branch 'origin/master' into externals/auctex --- Makefile.in | 4 +- bib-cite.el | 3 +- context-en.el | 6 +- context-nl.el | 6 +- context.el | 24 +++-- doc/install.texi | 19 +++- font-latex.el | 4 +- latex.el | 17 +++- preview.el | 31 ++++-- style/bigstrut.el | 33 +++++-- style/{multirow.el => extramarks.el} | 43 +++++--- style/fancyhdr.el | 185 +++++++++++++++++++++++------------ style/graphicx.el | 7 +- style/multirow.el | 47 +++++++-- style/scrbase.el | 8 +- style/scrpage2.el | 4 +- style/thmtools.el | 38 ++++--- tests/tex/utility.el | 31 +++++- tex-buf.el | 2 +- tex.el | 25 +++-- 20 files changed, 373 insertions(+), 164 deletions(-) diff --git a/Makefile.in b/Makefile.in index e83c74ca..9afc3282 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,7 +2,7 @@ # Maintainer: auctex-devel@gnu.org -# Copyright (C) 2003-2008, 2010, 2013-2015, 2018-2019 Free Software +# Copyright (C) 2003-2008, 2010, 2013-2015, 2018-2021 Free Software # Foundation, Inc. # This file is part of AUCTeX. @@ -173,7 +173,7 @@ STYLESRC = style/prosper.el \ style/multitoc.el style/fbox.el style/xkcdcolors.el \ style/ltxguide.el style/revtex4-2.el style/overpic.el \ style/tex-live.el style/algorithm.el style/algpseudocode.el \ - style/appendix.el style/scholax.el + style/appendix.el style/scholax.el style/extramarks.el STYLEELC = $(STYLESRC:.el=.elc) diff --git a/bib-cite.el b/bib-cite.el index bcf57ed7..0799c40c 100644 --- a/bib-cite.el +++ b/bib-cite.el @@ -675,7 +675,8 @@ a path separator and to translate DOS' backslash to slash. e.g. Use a path like \"c:\\emtex\\bibinput;c:\\latex\\bibinput\" -\(You can change the environment variable which is searched by setting the elisp variable bib-bibtex-env-variable)" +\(You can change the environment variable which is searched by +setting the elisp variable bib-bibtex-env-variable)" :group 'bib-cite :type 'boolean) diff --git a/context-en.el b/context-en.el index 19dd1724..4de977ad 100644 --- a/context-en.el +++ b/context-en.el @@ -128,11 +128,13 @@ (defvar ConTeXt-project-structure-list-en '("project" "environment" "product" "component") - "List of the names of ConTeXt project structure elements for its en interface. List should be in logical order.") + "List of ConTeXt project structure elements for its en interface. +List should be in logical order.") (defvar ConTeXt-section-block-list-en '("frontmatter" "bodymatter" "appendices" "backmatter") - "List of the names of ConTeXt section blocks for its en interface. List should be in logical order.") + "List of ConTeXt section block names for its en interface. +List should be in logical order.") ;; TODO: diff --git a/context-nl.el b/context-nl.el index 7a12d833..debda1f8 100644 --- a/context-nl.el +++ b/context-nl.el @@ -108,11 +108,13 @@ (defvar ConTeXt-project-structure-list-nl '("project" "omgeving" "produkt" "onderdeel") - "List of the names of ConTeXt project structure elements for its nl interface. List should be in logical order.") + "List of ConTeXt project structure elements for its nl interface. +List should be in logical order.") (defvar ConTeXt-section-block-list-nl '("inleidingen" "hoofdteksten" "bijlagen" "uitleidingen") - "List of the names of ConTeXt section blocks for its nl interface. List should be in logical order.") + "List of ConTeXt section block names for its nl interface. +List should be in logical order.") ;; TODO: diff --git a/context.el b/context.el index cb285ff7..3e29f5a7 100644 --- a/context.el +++ b/context.el @@ -406,10 +406,14 @@ section." The following variables are set before the hooks are run -`ConTeXt-level' - numeric section level, see the documentation of `ConTeXt-section'. -`ConTeXt-name' - name of the sectioning command, derived from `level'. -`ConTeXt-title' - The title of the section, default to an empty string. -`ConTeXt-done-mark' - Position of point afterwards, default nil (meaning end). +`ConTeXt-level' - numeric section level, see the documentation of + `ConTeXt-section'. +`ConTeXt-name' - name of the sectioning command, derived from + `level'. +`ConTeXt-title' - The title of the section, default to an empty + string. +`ConTeXt-done-mark' - Position of point afterwards, default nil + (meaning end). The following standard hook exist - @@ -454,10 +458,14 @@ in your .emacs file." The following variables are set before the hooks are run -`ConTeXt-level' - numeric section level, see the documentation of `ConTeXt-section'. -`ConTeXt-name' - name of the sectioning command, derived from `ConTeXt-level'. -`ConTeXt-title' - The title of the section, default to an empty string. -`ConTeXt-done-mark' - Position of point afterwards, default nil (meaning end). +`ConTeXt-level' - numeric section level, see the documentation of + `ConTeXt-section'. +`ConTeXt-name' - name of the sectioning command, derived from + `ConTeXt-level'. +`ConTeXt-title' - The title of the section, default to an empty + string. +`ConTeXt-done-mark' - Position of point afterwards, default nil + (meaning end). The following standard hook exist - diff --git a/doc/install.texi b/doc/install.texi index 0e88cec1..d055e4c9 100644 --- a/doc/install.texi +++ b/doc/install.texi @@ -17,10 +17,21 @@ The modern and strongly recommended way of installing @AUCTeX{} is by using the Emacs package manager integrated in Emacs 24 and greater (@acronym{ELPA}). Simply do @kbd{M-x list-packages RET}, mark the auctex package for installation with @kbd{i}, and hit @kbd{x} to execute -the installation procedure. That's all. This installation procedure -has several advantages. Besides being platform and @acronym{OS} -independent, you will receive intermediate releases between major -@AUCTeX{} releases conveniently. For past @acronym{ELPA} releases, see +the installation procedure. That's all. + +@code{use-package} users can use this simple recipe in their +@code{user-init-file} which essentially does the same as the manual +installation explained above. + +@example +(use-package tex + :ensure auctex) +@end example + +Using the @acronym{ELPA} version has several advantages. Besides being +platform and @acronym{OS} independent, you will receive intermediate +bugfix releases between major @AUCTeX{} releases conveniently. For past +@acronym{ELPA} releases, see @url{https://elpa.gnu.org/packages/auctex.html}. @ifclear rawfile Once the installation is completed, you can skip the rest of this diff --git a/font-latex.el b/font-latex.el index bf258f12..494fb30e 100644 --- a/font-latex.el +++ b/font-latex.el @@ -338,7 +338,9 @@ variable `font-latex-fontify-sectioning'." ',num) ("vref" "*{") ("eqref" "{") ("ref" "{") ("Ref" "{") ("include" "{") ("input" "{") ("bibliography" "{") ("index" "{") ("glossary" "{") ("footnote" "[{") ("footnotemark" "[") ("footnotetext" "[{") - ("marginpar" "[{")) + ("marginpar" "[{") ("chaptermark" "{") ("sectionmark" "{") + ("subsectionmark" "{") ("subsubsectionmark" "{") + ("paragraphmark" "{") ("subparagraphmark" "{")) font-lock-constant-face 2 command) ("function" (("begin" "{") ("end" "{") ("pagenumbering" "{") diff --git a/latex.el b/latex.el index 3639bf67..b4fd7d38 100644 --- a/latex.el +++ b/latex.el @@ -6217,8 +6217,12 @@ function would return non-nil and `(match-string 1)' would return (cons (concat "\\" (nth 0 x)) (nth 1 x))) LaTeX-section-list))) - (set (make-local-variable 'TeX-auto-full-regexp-list) - (append LaTeX-auto-regexp-list plain-TeX-auto-regexp-list)) + (setq-local TeX-auto-full-regexp-list + (delete-dups (append LaTeX-auto-regexp-list + ;; Prevent inadvertent destruction + ;; of `plain-TeX-auto-regexp-list'. + (copy-sequence + plain-TeX-auto-regexp-list)))) (LaTeX-set-paragraph-start) (setq paragraph-separate @@ -6540,9 +6544,18 @@ function would return non-nil and `(match-string 1)' would return '("textsubscript" "Text") '("textcircled" "Text") '("mathring" t) + '("MakeUppercase" t) + '("MakeLowercase" t) + '("chaptermark" "Text") + '("sectionmark" "Text") + '("subsectionmark" "Text") + '("subsubsectionmark" "Text") + '("paragraphmark" "Text") + '("subparagraphmark" "Text") "LaTeXe" "listfiles" "frontmatter" "mainmatter" "backmatter" + "leftmark" "rightmark" "textcompwordmark" "textvisiblespace" "textemdash" "textendash" "textexclamdown" "textquestiondown" "textquotedblleft" "textquotedblright" "textquoteleft" "textquoteright" diff --git a/preview.el b/preview.el index e8e57b41..08ea45c0 100644 --- a/preview.el +++ b/preview.el @@ -1,7 +1,7 @@ ;;; preview.el --- embed preview LaTeX images in source buffer ;; Copyright (C) 2001-2006, 2010-2015, -;; 2017-2020 Free Software Foundation, Inc. +;; 2017-2021 Free Software Foundation, Inc. ;; Author: David Kastrup ;; Keywords: tex, wp, convenience @@ -1166,7 +1166,7 @@ NONREL is not NIL." (setq preview-gs-init-string ;; Add commands for revised file access controls introduced ;; after gs 9.27 (bug#37719) - (concat (format "systemdict /.addcontrolpath known {%s} if\n" + (concat (format "systemdict /.addcontrolpath known {%s} if " (mapconcat (lambda (f) (format "/PermitFileReading %s .addcontrolpath" (preview-ps-quote-filename f))) @@ -1312,11 +1312,6 @@ Try \\[ps-run-start] \\[ps-run-buffer] and \ (defun preview-gs-flag-error (ov err) "Make an eps error flag in overlay OV for ERR string." - ;; N.B. Although this code shows command line of gs invocation and - ;; error together via mouse popup menu, they are not necessarily - ;; associated with each other. There is a case that the command - ;; line is for "[...].prv/tmpXXXXXX/pr1-2.png" while the error is - ;; raised for "[...].prv/tmpXXXXXX/pr1-1.png". (c.f. bug#37719) (let* ((filenames (overlay-get ov 'filenames)) (file (car (nth 0 filenames))) ;; FIXME: This format isn't equal to actual invocation of gs @@ -3299,7 +3294,13 @@ call, and in its CDR the final stuff for the placement hook." close-data open-data fast-hook - slow-hook) + slow-hook + TeX-translate-location-file + TeX-translate-location-line + TeX-translate-location-error + TeX-translate-location-offset + TeX-translate-location-context + TeX-translate-location-string) ;; clear parsing variables (dolist (var preview-parse-variables) (set (nth 1 var) nil)) @@ -3422,9 +3423,23 @@ name(\\([^)]+\\))\\)\\|\ (nconc fast-hook (list fast))) (setq slow-hook (nconc slow-hook (list lst))))))) + ;; Functions in `TeX-translate-location-hook' + ;; may examine and modify the following variables. + (setq TeX-translate-location-file file + TeX-translate-location-line line + ;; TeX-translate-location-error error + TeX-translate-location-offset offset + ;; TeX-translate-location-context context + TeX-translate-location-string string) (condition-case err (save-excursion (mapc #'funcall slow-hook)) (error (preview-log-error err "Translation hook"))) + (setq file TeX-translate-location-file + line TeX-translate-location-line + ;; error TeX-translate-location-error + offset TeX-translate-location-offset + ;; context TeX-translate-location-context + string TeX-translate-location-string) (push (vector file (+ line offset) string after-string snippet box counters) diff --git a/style/bigstrut.el b/style/bigstrut.el index 71ea835a..8324da33 100644 --- a/style/bigstrut.el +++ b/style/bigstrut.el @@ -1,6 +1,6 @@ ;;; bigstrut.el --- AUCTeX style for `bigstrut.sty' -*- lexical-binding: t; -*- -;; Copyright (C) 2012, 2014, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2012, 2014--2021 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -25,26 +25,41 @@ ;;; Commentary: -;; This file adds support for `bigstrut.sty'. +;; This file adds support for `bigstrut.sty', v2.6 from 2021/01/02. ;;; Code: (require 'tex) +;; Silence the compiler: +(declare-function font-latex-add-keywords + "font-latex" + (keywords class)) + (TeX-add-style-hook "bigstrut" (lambda () (TeX-add-symbols - "bigstrutsetup" - '("bigstrut" [ TeX-arg-bigstrut ]))) + '("bigstrut" [ TeX-arg-bigstrut ])) + + (LaTeX-add-lengths "bigstrutjot") + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("bigstrut" "[")) + 'function))) TeX-dialect) -(defun TeX-arg-bigstrut (optional &optional _prompt) - "Prompt for the optional argument in \\bigstrut." +(defun TeX-arg-bigstrut (optional &optional prompt) + "Prompt for the optional argument in \\bigstrut. +If OPTIONAL is non-nil, insert the argument in brackets. PROMPT +replaces the standard one." (TeX-argument-insert - (completing-read (TeX-argument-prompt - optional "Strut to top (t) or bottom (b)" nil t) - (mapcar 'list '("t" "b")) nil t) + (completing-read + (TeX-argument-prompt + optional prompt "Strut to top (t) or bottom (b)") + '("t" "b")) optional)) (defvar LaTeX-bigstrut-package-options nil diff --git a/style/multirow.el b/style/extramarks.el similarity index 57% copy from style/multirow.el copy to style/extramarks.el index d5108b85..ecf619e0 100644 --- a/style/multirow.el +++ b/style/extramarks.el @@ -1,9 +1,10 @@ -;;; multirow.el --- AUCTeX style for `multirow.sty' -*- lexical-binding: t; -*- +;;; extramarks.el --- AUCTeX style for `extramarks.sty' (v4.0) -*- lexical-binding: t; -*- -;; Copyright (C) 2011, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2021 Free Software Foundation, Inc. -;; Author: Mads Jensen <m...@inducks.org> +;; Author: Arash Esbati <ar...@gnu.org> ;; Maintainer: auctex-devel@gnu.org +;; Created: 2021-01-12 ;; Keywords: tex ;; This file is part of AUCTeX. @@ -25,7 +26,8 @@ ;;; Commentary: -;; This file adds support for `multirow.sty'. +;; This file adds support for `extramarks.sty' (v4.0) from 2021/01/04. +;; `extramarks.sty' is part of TeXLive. ;;; Code: @@ -37,23 +39,34 @@ (keywords class)) (TeX-add-style-hook - "multirow" + "extramarks" (lambda () - (TeX-add-symbols - '("multirow" "Number of rows" - [ "Big struts" ] "Width" [ "Fixup" ] t) - "multirowsetup") - (if (not (boundp 'LaTeX-bigstrut-package-options)) - (TeX-add-symbols "bigstrutjot")) + ;; New symbols + (TeX-add-symbols + "firstleftmark" + "lastrightmark" + "firstrightmark" + "lastleftmark" + "firstleftxmark" + "firstrightxmark" + "topleftxmark" + "toprightxmark" + "lastleftxmark" + "lastrightxmark" + "firstxmark" + "lastxmark" + "topxmark" + '("extramarks" 2)) ;; Fontification (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("multirow" "{[{")) 'function))) + (font-latex-add-keywords '(("extramarks" "{{")) + 'reference))) TeX-dialect) -(defvar LaTeX-multirow-package-options nil - "Package options for the multirow package.") +(defvar LaTeX-extramarks-package-options nil + "Package options for the extramarks package.") -;;; multirow.el ends here +;;; extramarks.el ends here diff --git a/style/fancyhdr.el b/style/fancyhdr.el index 4557e3b6..e849f4e9 100644 --- a/style/fancyhdr.el +++ b/style/fancyhdr.el @@ -1,6 +1,6 @@ ;;; fancyhdr.el --- AUCTeX style for `fancyhdr.sty' -*- lexical-binding: t; -*- -;; Copyright (C) 2012, 2013, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2012, 2013, 2018-2021 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -25,7 +25,7 @@ ;;; Commentary: -;; This file adds support for `fancyhdr.sty', version 3.2 +;; This file adds support for `fancyhdr.sty', v4.0 from 2021/01/04. ;;; Code: @@ -37,83 +37,142 @@ "font-latex" (keywords class)) +;; Because there can be many places, `TeX-completing-read-multiple' is +;; used instead of just `completing-read', and a `collection' argument +;; is provided as the list of places differs between the macros +(defun TeX-arg-fancyhdr-place (optional + &optional prompt collection full) + "Prompt for fancyhdr places with completion. +If OPTIONAL is non-nil, insert the resulting value as an optional +argument, otherwise as a mandatory one. If non-nil, PROMPT is +used as the prompt. If non-nil, COLLECTION is used as the +completion list for the place. + +If FULL is non-nil, a full list of places is offered for +completion, otherwise a reduced one omitting place combinations +for H(eader) or F(ooter)." + (let* ((places (or collection + ;; Standard places with no restrictions. + ;; Lower-case versions, and reverse versions + ;; (e.g., OC) are left out for simplicity. + (if full + '("L" "LO" "LE" "LOH" "LOF" "LEH" "LEF" + "C" "CO" "CE" "COH" "COF" "CEH" "CEF" + "R" "RO" "RE" "ROH" "ROF" "REH" "REF") + '("L" "LO" "LE" "C" "CO" "CE" "R" "RE" "RO")))) + (arguments (mapconcat #'identity + (TeX-completing-read-multiple + (TeX-argument-prompt optional + prompt + "Places") + places) + ","))) + (TeX-argument-insert arguments optional))) + +(defvar LaTeX-fancyhdr-fancypagestyle-regexp + '("\\\\fancypagestyle{\\([^}]+\\)}" + 1 LaTeX-auto-pagestyle) + "Regexp matching the first argument of \\fancypagestyle macro.") + (TeX-add-style-hook "fancyhdr" (lambda () (TeX-add-symbols - '("lhead" t) - '("lfoot" t) - '("chead" t) - '("cfoot" t) - '("rhead" t) - '("rfoot" t) - '("nouppercase" t) - '("MakeUppercase" t) - '("fancyhead" [ TeX-arg-fancyhdr-position ] t) - '("fancyfoot" [ TeX-arg-fancyhdr-position ] t) + + ;; 2 Using fancyhdr + '("fancyhead" [ TeX-arg-fancyhdr-place ] t) + '("fancyfoot" [ TeX-arg-fancyhdr-place ] t) + '("fancyhf" [ (TeX-arg-fancyhdr-place nil nil t) ] t) + '("fancyheadoffset" - [ (TeX-arg-fancyhdr-position - "Position" ("LO" "LE" "L" "RE" "RO" "R" "0")) ] t) + [ (TeX-arg-fancyhdr-place nil ("L" "LO" "LE" "R" "RO" "RE")) ] + TeX-arg-length) '("fancyfootoffset" - [ (TeX-arg-fancyhdr-position - "Position" ("LO" "LE" "L" "RE" "RO" "R" "O")) ] t) + [ (TeX-arg-fancyhdr-place nil ("LO" "LE" "L" "RO" "RE" "R")) ] + TeX-arg-length) '("fancyhfoffset" - [ (TeX-arg-fancyhdr-position "Position" ("E" "O" "L" "R")) ] t) - '("fancypagestyle" TeX-arg-pagestyle t) - - "headrulewidth" "footrulewidth" "plainfootrulewidth" - "plainheadrulewidth" "leftmark" "rightmark" - ;; the manual does not mention any subsubsectionmark (!) - "chaptermark" "sectionmark" "subsectionmark" "paragraphmark" - "subparagraphmark" "footrule" "headrule") - - ;; `fancyhdr.sty' supplies these two pagestyles - (LaTeX-add-pagestyles "fancy" "fancyplain") + [ (TeX-arg-fancyhdr-place nil ("L" "LO" "LE" "LOH" "LOF" "LEH" "LEF" + "R" "RO" "RE" "ROH" "ROF" "REH" "REF")) ] + TeX-arg-length) + + "headrulewidth" "footrulewidth" + "headruleskip" "footruleskip" + "headrule" "footrule" + "headwidth" + + '("fancyheadinit" t) + '("fancyfootinit" t) + '("fancyhfinit" t) + + '("fancycenter" + [ TeX-arg-length "Distance" ] [ "Stretch" ] 3) + + '("iftopfloat" 2) + '("ifbotfloat" 2) + '("iffloatpage" 2) + '("iffootnote" 2) + + '("fancypagestyle" + ;; Always add the chosen pagestyle to list of known pagestyles, + ;; dupes are removed when retrieving with the function + ;; `LaTeX-pagestyle-list': + (TeX-arg-pagestyle nil t) + [ TeX-arg-pagestyle "Base pagestyle" ] + t) + + ;; 15 The scoop on LATEX’s marks + '("nouppercase" t)) + + ;; 30 Deprecated commands + ;; Don't offer deprecated commands in V4.0 for completion anymore. + ;; '("lhead" t) + ;; '("lfoot" t) + ;; '("chead" t) + ;; '("cfoot" t) + ;; '("rhead" t) + ;; '("rfoot" t) + ;; "plainfootrulewidth" + ;; "plainheadrulewidth" + + ;; `fancyhdr.sty' supplies these two pagestyles. Pagestyle + ;; `fancyplain' is now deprecated. + (LaTeX-add-pagestyles "fancy" "fancydefault") + + ;; Add \fancypagestyle{pagestyle} to AUCTeX parser + (TeX-auto-add-regexp LaTeX-fancyhdr-fancypagestyle-regexp) ;; Fontification (when (and (fboundp 'font-latex-add-keywords) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("fancyhead" "[{") ("fancyfoot" "[{") - ("lhead" "{") - ("lfoot" "{") - ("chead" "{") - ("cfoot" "{") - ("rhead" "{") - ("rfoot" "{") + ("fancyhf" "[{") ("fancyheadoffset" "[{") ("fancyfootoffset" "[{") - ("fancypagestyle" "{{")) 'function) - (font-latex-add-keywords '(("headrulewidth" "") - ("footrulewidth" "") - ("plainheadrulewidth" "") - ("plainfootrulewidth" "")) 'variable))) + ("fancyhfoffset" "[{") + ("fancyheadinit" "{") + ("fancyfootinit" "{") + ("fancyhfinit" "{") + ;; Fontify deprecated commands for + ;; older documents; to be removed + ;; sometimes ... + ("lhead" "[{") + ("lfoot" "[{") + ("chead" "[{") + ("cfoot" "[{") + ("rhead" "[{") + ("rfoot" "[{") + ;; Don't fontify the last argument; + ;; all macros used there should have + ;; their own fontification since they + ;; can also be used in a document + ;; top-level. + ("fancypagestyle" "{[")) + 'function))) TeX-dialect) -;; Because there can be many positions, `TeX-completing-read-multiple' is used -;; instead of just `completing-read', and a `collection' argument is provided as -;; the list of positions differs between the macros -(defun TeX-arg-fancyhdr-position (optional &optional prompt collection) - "Prompt for a fancyhdr position with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. If non-nil, PROMPT is -used as the prompt. If non-nil, COLLECTION is used as the -completion list for the position." - (let* ((positions (if (not collection) - ;; Standard positions with no restrictions. Lower-case - ;; versions, and reverse versions (e.g., OC) are left - ;; out for simplicity. - '("LO" "LE" "L" "CO" "CE" "C" "RE" "RO" "R") - collection)) - (arguments - (mapconcat 'identity - (TeX-completing-read-multiple - (TeX-argument-prompt optional prompt "Position") - (mapcar 'list positions)) ","))) - (TeX-argument-insert arguments optional))) - -(defvar LaTeX-fancyhdr-package-options nil - "Package options for fancyhdr.") +(defvar LaTeX-fancyhdr-package-options + '("nocheck" "compatV3" "headings" "myheadings") + "Package options for fancyhdr package.") ;;; fancyhdr.el ends here - diff --git a/style/graphicx.el b/style/graphicx.el index d7a6f046..bb28b9cf 100644 --- a/style/graphicx.el +++ b/style/graphicx.el @@ -1,6 +1,6 @@ ;;; graphicx.el --- AUCTeX style file for graphicx.sty -*- lexical-binding: t; -*- -;; Copyright (C) 2000, 2004, 2005, 2014--2020 by Free Software Foundation, Inc. +;; Copyright (C) 2000, 2004, 2005, 2014--2021 by Free Software Foundation, Inc. ;; Author: Ryuichi Arafune <araf...@debian.org> ;; Created: 1999/3/20 @@ -102,7 +102,10 @@ key-val's." (TeX-read-key-val optional (if (and (or (and (eq TeX-engine 'default) (not (TeX-PDF-from-DVI))) - (eq TeX-engine 'luatex)) + (eq TeX-engine 'luatex) + ;; dvipdfmx can handle page and + ;; pagebox options. + (string= (TeX-PDF-from-DVI) "Dvipdfmx")) TeX-PDF-mode) (append '(("page") ("pagebox" ("mediabox" diff --git a/style/multirow.el b/style/multirow.el index d5108b85..25d9f96c 100644 --- a/style/multirow.el +++ b/style/multirow.el @@ -1,6 +1,6 @@ ;;; multirow.el --- AUCTeX style for `multirow.sty' -*- lexical-binding: t; -*- -;; Copyright (C) 2011, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2011, 2018--2021 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -25,7 +25,7 @@ ;;; Commentary: -;; This file adds support for `multirow.sty'. +;; This file adds support for `multirow.sty', v2.6 from 2021/01/02. ;;; Code: @@ -40,20 +40,47 @@ "multirow" (lambda () (TeX-add-symbols - '("multirow" "Number of rows" - [ "Big struts" ] "Width" [ "Fixup" ] t) - "multirowsetup") - - (if (not (boundp 'LaTeX-bigstrut-package-options)) - (TeX-add-symbols "bigstrutjot")) + ;; \multirow[<vpos>]{<nrows>}[<bigstruts>]{<width>}[<vmove>]{<text>} + '("multirow" + [TeX-arg-eval completing-read + (TeX-argument-prompt t nil "Vertical position") + '("c" "b" "t")] + "Number of rows" + [ "Big struts" ] + (TeX-arg-eval completing-read + (TeX-argument-prompt nil nil "Width") + (append + '("*" "=") + (mapcar (lambda (x) + (concat TeX-esc (car x))) + (LaTeX-length-list)))) + [TeX-arg-length "Vertical fix-up"] + t) + "multirowsetup" + "multirowdebugtrue" + "multirowdebugfalse") + + ;; \bigstrutjot is a length defined both in multirow.sty and + ;; bigstrut.sty. It doesn't make a difference within AUCTeX since + ;; dupes are removed by the function `LaTeX-length-list'. + (LaTeX-add-lengths "bigstrutjot") + + ;; \STneed is only defined with package option `supertabular': + (when (LaTeX-provided-package-options-member "multirow" + "supertabular") + (TeX-add-symbols + '("STneed" TeX-arg-length))) ;; Fontification (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("multirow" "{[{")) 'function))) + (font-latex-add-keywords '(("multirow" "[{[{[{")) + 'function))) TeX-dialect) -(defvar LaTeX-multirow-package-options nil +(defvar LaTeX-multirow-package-options '("debug" + "longtable" + "supertabular") "Package options for the multirow package.") ;;; multirow.el ends here diff --git a/style/scrbase.el b/style/scrbase.el index ef13affc..e5cc8539 100644 --- a/style/scrbase.el +++ b/style/scrbase.el @@ -1,6 +1,6 @@ ;;; scrbase.el --- AUCTeX style for the KOMA-Script bundle. -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2005, 2007, 2014, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2004, 2005, 2007, 2014, 2018-2021 Free Software Foundation, Inc. ;; Author: Mark Trettin <mark.tret...@gmx.de> ;; Created: 2002-09-26 @@ -62,7 +62,6 @@ '("maketitle" [ "Pagenumber" ]) '("marginline" t) '("publishers" "Publishers") - '("sectionmark" "Running head") '("setbibpreamble" "Preamble") '("setcaphanging") '("setcapindent" "Indent") @@ -73,8 +72,6 @@ '("setindexpreamble" "Preamble") '("setkomafont" TeX-arg-KOMA-fontelements t) '("subject" "Subject") - '("subsectionmark" "Running head") - '("textsubscript" "Text") '("thanks" "Footnote") '("thefootnotemark") '("titlehead" t) @@ -158,11 +155,8 @@ ("marginline" "{") ("publishers" "{") ("subject" "{") - ("sectionmark" "{") ("setbibpreamble" "{") ("setindexpreamble" "{") - ("subsectionmark" "{") - ("textsubscript" "{") ("titlehead" "{") ("uppertitleback" "{")) 'textual) diff --git a/style/scrpage2.el b/style/scrpage2.el index 2ee9b2c8..33cc7c5f 100644 --- a/style/scrpage2.el +++ b/style/scrpage2.el @@ -65,8 +65,6 @@ '("headmark") '("manualmark") '("pagemark") - '("leftmark") - '("rightmark") '("setfootwidth" [ "Offset" ] "Width") '("setheadwidth" [ "Offset" ] "Width") '("setfootbotline" [ "Length" ] "Thickness") @@ -83,7 +81,7 @@ '("renewpagestyle" "Name" "Head definition" "Foot definition") '("providepagestyle" "Name" "Head definition" "Foot definition")) - ;; Fontification + ;; Fontification (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("lehead" "[{") diff --git a/style/thmtools.el b/style/thmtools.el index a4a33b4c..f4be618a 100644 --- a/style/thmtools.el +++ b/style/thmtools.el @@ -1,6 +1,6 @@ -;;; thmtools.el --- AUCTeX style for `thmtools.sty' (v67) -*- lexical-binding: t; -*- +;;; thmtools.el --- AUCTeX style for `thmtools.sty' (v0.72) -*- lexical-binding: t; -*- -;; Copyright (C) 2018--2020 Free Software Foundation, Inc. +;; Copyright (C) 2018--2021 Free Software Foundation, Inc. ;; Author: Arash Esbati <ar...@gnu.org> ;; Maintainer: auctex-devel@gnu.org @@ -26,7 +26,7 @@ ;;; Commentary: -;; This file adds support for `thmtools.sty' (v67) from 2019/07/31. +;; This file adds support for `thmtools.sty' (v0.72) from 2020/08/01. ;; `thmtools.sty' is part of TeXLive. ;;; Code: @@ -169,15 +169,15 @@ minibuffer. PROMPT replaces the standard one." If OPTIONAL is non-nil, also insert the second argument in square brackets. PROMPT replaces the standard one for the second argument." + (let ((env (TeX-read-string + (TeX-argument-prompt optional prompt "Environment")))) + (LaTeX-add-environments `(,env LaTeX-thmtools-env-label)) + (TeX-argument-insert env optional)) (let ((TeX-arg-opening-brace "[") (TeX-arg-closing-brace "]")) (TeX-argument-insert (LaTeX-thmtools-declaretheorem-key-val t) - t)) - (let ((env (TeX-read-string - (TeX-argument-prompt optional prompt "Environment")))) - (LaTeX-add-environments `(,env LaTeX-thmtools-env-label)) - (TeX-argument-insert env optional))) + t))) (defun LaTeX-thmtools-listoftheorems-key-val (optional &optional prompt) "Query and return a key=val string for \\listoftheorems macro. @@ -199,13 +199,14 @@ minibuffer. PROMPT replaces the standard one." (mapcar #'car (LaTeX-thmtools-declaretheorem-list))))) (TeX-read-key-val optional - `(("numwidth" ,lengths) + `(("title") ("ignore" ,thms) - ("onlynamed" ,thms) - ("show" ,thms) ("ignoreall" ("true" "false")) + ("show" ,thms) ("showall" ("true" "false")) - ("title")) + ("onlynamed" ,thms) + ("swapnumber" ("true" "false")) + ("numwidth" ,lengths)) prompt))) (defun LaTeX-arg-thmtools-listoftheorems (optional &optional prompt) @@ -230,8 +231,15 @@ RefTeX users should customize or add ENVIRONMENT to (add-to-list \\='reftex-label-alist \\='(\"theorem\" ?m \"thm:\" \"~\\ref{%s}\" nil (\"Theorem\" \"theorem\") nil))" - (let* ((choice (read-char - (TeX-argument-prompt nil nil "Heading (h), Key=val (k), Empty (RET)"))) + (let* ((help-form "\ +Select the content of the optional argument with a key: +`h' in order to insert a plain heading, +`k' in order to insert key=value pairs with completion, +RET in order to leave it empty.") + (choice (read-char-choice + (TeX-argument-prompt + nil nil "Heading (h), Key=val (k), Empty (RET)") + '(?h ?k))) (opthead (cond ((= choice ?h) (TeX-read-string (TeX-argument-prompt t nil "Heading"))) @@ -291,7 +299,7 @@ RefTeX users should customize or add ENVIRONMENT to (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("declaretheoremstyle" "[{") - ("declaretheorem" "[{") + ("declaretheorem" "[{[") ("listoftheorems" "[") ("ignoretheorems" "{")) 'function))) diff --git a/tests/tex/utility.el b/tests/tex/utility.el index 92442ba5..ac0a8aab 100644 --- a/tests/tex/utility.el +++ b/tests/tex/utility.el @@ -1,6 +1,6 @@ -;;; utility.el --- tests for AUCTeX utility functions +;;; utility.el --- tests for AUCTeX utility functions -*- lexical-binding: t; -*- -;; Copyright (C) 2017 Free Software Foundation, Inc. +;; Copyright (C) 2017, 2021 Free Software Foundation, Inc. ;; This file is part of AUCTeX. @@ -28,4 +28,31 @@ (should (TeX-delete-duplicate-strings '("nil"))) (should (TeX-delete-dups-by-car '(("nil" . 1))))) +;; `TeX-add-to-alist' needs dynamic scope variable as its first +;; argument. +(defvar TeX-dummy-alist nil) + +(ert-deftest TeX-adding-to-alist () + "Check whether `TeX-add-to-alist' works as expected." + (TeX-add-to-alist 'TeX-dummy-alist '((a 1))) + (should (equal TeX-dummy-alist '((a 1)))) + + (TeX-add-to-alist 'TeX-dummy-alist '((b 2 3))) + (should (equal TeX-dummy-alist '((a 1) (b 2 3)))) + + ;; Append new value(s) of the same key. The target cons is moved to + ;; the last of the alist. + (TeX-add-to-alist 'TeX-dummy-alist '((a 4))) + (should (equal TeX-dummy-alist '((b 2 3) (a 1 4)))) + + ;; Adding the same value again should not create duplicated + ;; elements. + (TeX-add-to-alist 'TeX-dummy-alist '((a 1))) + (should (equal TeX-dummy-alist '((b 2 3) (a 1 4)))) + + ;; A value which is the same as the key should be included in the + ;; result. + (TeX-add-to-alist 'TeX-dummy-alist '((a a))) + (should (equal TeX-dummy-alist '((b 2 3) (a 1 4 a))))) + ;;; utility.el ends here diff --git a/tex-buf.el b/tex-buf.el index e4e80e56..40a2acca 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -359,7 +359,7 @@ Car is the idx file, cdr is whether idx changed after LaTeX run.") (defcustom TeX-check-engine t - "Whether AUCTeX should check the correct engine has been set before running LaTeX commands." + "Check the correct engine has been set before running TeX commands." :group 'TeX-command :type 'boolean) diff --git a/tex.el b/tex.el index 8469dd05..b59aee05 100644 --- a/tex.el +++ b/tex.el @@ -1365,7 +1365,7 @@ restarting Emacs." ,(let (list) ;; Build the list of available predicates. (mapc (lambda (spec) - (add-to-list 'list `(const ,(car spec)))) + (cl-pushnew `(const ,(car spec)) list :test #'equal)) (append TeX-view-predicate-list TeX-view-predicate-list-builtin)) ;; Sort the list alphabetically. @@ -1421,7 +1421,7 @@ are evaluated positively is chosen." ;; Offer list of defined predicates. ,(let (list) (mapc (lambda (spec) - (add-to-list 'list `(const ,(car spec)))) + (cl-pushnew `(const ,(car spec)) list :test #'equal)) (append TeX-view-predicate-list TeX-view-predicate-list-builtin)) (setq list (sort list @@ -1437,8 +1437,8 @@ are evaluated positively is chosen." (group (choice :tag "Viewer" ,@(let (list) (mapc (lambda (spec) - (add-to-list 'list - `(const ,(car spec)))) + (cl-pushnew `(const ,(car spec)) + list :test #'equal)) (append TeX-view-program-list TeX-view-program-list-builtin)) (sort list @@ -4138,7 +4138,7 @@ If SKIP is not-nil, don't insert code for SKIP." "Add REGEXP to `TeX-auto-regexp-list' if not already a member." (if (symbolp TeX-auto-regexp-list) (setq TeX-auto-regexp-list (symbol-value TeX-auto-regexp-list))) - (or (memq regexp TeX-auto-regexp-list) + (or (member regexp TeX-auto-regexp-list) (setq TeX-auto-regexp-list (cons regexp TeX-auto-regexp-list)))) (defvar TeX-auto-empty-regexp-list @@ -4244,6 +4244,15 @@ you should not use something like `[\\(]' for a character range." "\\)")) syms lst) + ;; TODO: Emacs allows at most 255 groups in a regexp, see the + ;; "#define MAX_REGNUM 255" in regex-emacs.c. If our regex + ;; has more groups, bad things may happen, e.g., + ;; (match-beginning 271) returns nil although the regexp that + ;; matched contains group number 271. Sadly, MAX_REGNUM is + ;; not exposed to Lisp, so we need to hard-code it here (and + ;; sometimes check if it increased in newer Emacs versions). + (when (> count 255) + (error "The TeX auto-parser's regexp has too many groups (%d)" count)) (setq count 0) (goto-char (if end (min end (point-max)) (point-max))) (while (re-search-backward regexp beg t) @@ -4713,9 +4722,11 @@ element to ALIST-VAR." (set alist-var (delete old-element (symbol-value alist-var))) ;; Append to `old-element' the values of the current element of ;; NEW-ALIST. - (mapc (lambda (elt) (add-to-list 'old-element elt t)) + (mapc (lambda (elt) + (unless (member elt (cdr old-element)) + (setq old-element (append old-element (list elt))))) (cdr new-element)) - (set alist-var (add-to-list alist-var old-element t))) + (add-to-list alist-var old-element t)) (add-to-list alist-var new-element t))) ;; Next element of NEW-ALIST. (setq new-alist (cdr new-alist))))