auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] [elpa] externals/auctex 615d6f2052 13/14: Merge remote-tr


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex 615d6f2052 13/14: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Sat, 16 Apr 2022 04:28:46 -0400 (EDT)

branch: externals/auctex
commit 615d6f2052085adbdebfd51244e6eecd184af6df
Merge: 2568505587 c534b17704
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 Makefile.in                       |   2 +-
 admin/release-process.org         |  24 +++
 auctex.el.in                      |   4 +-
 bib-cite.el                       |  28 +--
 configure.ac                      |   4 +-
 context.el                        |  16 +-
 doc/changes.texi                  |   3 +
 doc/faq.texi                      |   2 +-
 doc/install.texi                  |   2 +-
 doc/preview-faq.texi              |   2 +-
 font-latex.el                     |  30 +--
 latex.el                          |  49 +++--
 latex/preview.dtx                 |   2 +-
 plain-tex.el                      |   8 +-
 preview.el                        |  36 ++--
 style/biblatex.el                 |  29 ++-
 style/etoolbox.el                 | 376 ++++++++++++++++++++++++++++++++++++++
 style/fbox.el                     |  37 +++-
 style/ltx-base.el                 | 146 +++++++++++----
 style/polyglossia.el              |   2 +-
 style/pstricks.el                 |   4 +-
 tests/latex/doctex-indent-in.dtx  |  68 +++++++
 tests/latex/doctex-indent-out.dtx |  68 +++++++
 tests/latex/latex-test.el         |  21 ++-
 tex-fold.el                       |  12 +-
 tex-info.el                       |   4 +-
 tex-site.el.in                    |   6 +-
 tex.el                            |  76 ++++----
 toolbar-x.el                      |   4 +-
 29 files changed, 868 insertions(+), 197 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 9ee6db0c59..c1b29c1733 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -179,7 +179,7 @@ STYLESRC = style/prosper.el \
           style/cuted.el     style/floatpag.el  style/flushend.el \
           style/midfloat.el  style/stabular.el  style/stfloats.el \
           style/rotating.el  style/sidecap.el   style/l3doc.el \
-          style/ifthen.el
+          style/ifthen.el    style/etoolbox.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/admin/release-process.org b/admin/release-process.org
index ea87618ddf..26ff0280d5 100644
--- a/admin/release-process.org
+++ b/admin/release-process.org
@@ -227,3 +227,27 @@ looks for all files without FSF-copyright line which are 
not listed in a
 special copyright_exceptions file.  As result, it spits out a diff between the
 actual and expected copyright exceptions.  If the diff is empty (or at least
 doesn't mention an AUCTeX file), everything is fine.
+
+** Bumping required Emacs version
+
+It happens from time to time that AUCTeX requires a newer Emacs
+version.  For this, the following files in the main directory has to
+be adjusted.
+
+- [ ] =auctex.el.in= :: Change the ~;; Package-Requires:~ cookie in
+  the header.
+- [ ] =configure.ac= :: Change the argument of ~EMACS_CHECK_VERSION~
+- [ ] =tex-site.el.in= :: Change the number after ~emacs-major-version~
+- [ ] =tex.el= :: Change the number after ~emacs-major-version~
+
+In the =doc= directory, these files are affected.
+
+- [ ] =doc/changes.texi= :: Add an entry under *News* about the
+  required version.
+- [ ] =doc/faq.texi= :: Adjust the number in this sentence:
+  =@AUCTeX{} was tested with @w{GNU Emacs XX.X}=.
+- [ ] =doc/install.texi= :: Adjust the number in ~@node Prerequisites~:
+  =@item GNU Emacs XX.X or higher=.
+- [ ] =doc/preview-faq.texi= :: Adjust the number in ~@section Requirements~
+  =@previewlatex{} nominally requires @w{GNU Emacs} with a version of
+  at least XX.X.=.
diff --git a/auctex.el.in b/auctex.el.in
index 014c0a2b8a..61527e2393 100644
--- a/auctex.el.in
+++ b/auctex.el.in
@@ -1,11 +1,11 @@
 ;;; auctex.el --- Integrated environment for *TeX*  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
 
 ;; URL: https://www.gnu.org/software/auctex/
 ;; Maintainer: auctex-devel@gnu.org
 ;; Notifications-To: auctex-diffs@gnu.org
-;; Package-Requires: ((emacs "24.3") (nadvice "0.3"))
+;; Package-Requires: ((emacs "25.1"))
 ;; Keywords: TeX LaTeX Texinfo ConTeXt docTeX preview-latex
 
 ;; This file is part of AUCTeX.
diff --git a/bib-cite.el b/bib-cite.el
index 465f18f973..a6405046f5 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -1,6 +1,6 @@
 ;; bib-cite.el - Display \cite, \ref or \label / Extract refs from BiBTeX 
file. -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1994-1999, 2001, 2003-2005, 2014-2021 Free Software 
Foundation, Inc.
+;; Copyright (C) 1994-1999, 2001, 2003-2005, 2014-2022 Free Software 
Foundation, Inc.
 
 ;; Author:    Peter S. Galbraith <psg@debian.org>
 ;; Created:   06 July 1994
@@ -629,7 +629,7 @@ BiBTeX 0.99b manual says this should be TEXBIB.
 Another version says it should BSTINPUTS.  I don't know anymore!
 
 The colon character (:) is the default path separator in unix, but you may
-use semi-colon (;) for DOS or OS/2 if you set bib-dos-or-os2-variable to t."
+use semi-colon (;) for DOS or OS/2 if you set `bib-dos-or-os2-variable' to t."
   :type 'string)
 
 (defcustom bib-cite-inputs nil
@@ -650,14 +650,14 @@ directory.  You may set this variable to let bib-cite 
find these .aux files."
   ;; Under DOS  system-type equals ms-dos
   "Whether you use DOS or OS/2 for bib-make-bibliography/bib-display.
 
-It tells bib-make-bibliography and bib-display to translate
+It tells `bib-make-bibliography' and `bib-display' to translate
 the BIBINPUTS environment variable using the \";\" character as
 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)"
+setting the elisp variable `bib-bibtex-env-variable')"
   :type 'boolean)
 
 (defcustom bib-etags-command "etags -r '/.*\\\\\\(eq\\|page\\|[fvF]\\)ref.*/' 
-o "
@@ -685,11 +685,11 @@ coexist with some other tags file in your master file 
directory."
 without the curly bracket.
 
 If you change this variable and you use multi-file documents, make sure you
-also edit the variables bib-etags-command and bib-etags-append-command."
+also edit the variables `bib-etags-command' and `bib-etags-append-command'."
   :type 'regexp)
 
 (defcustom bib-substitute-string-in-display t
-  "Determines if bib-display will substitute @string definitions.
+  "Determines if `bib-display' will substitute @string definitions.
 If t, then the @string text is substituted.
 If nil, the text is not substituted but the @string entry is included."
   :type 'boolean)
@@ -1133,7 +1133,7 @@ to create a bibtex file containing only the references 
used in the document."
 Store the TAGS file in the master-directory.
 Expect errors if you use this outside of auctex or within a plain
 single-file document.  Also makes sure that the TAGS buffer is updated.
-See variables bib-etags-command and bib-etags-filename"
+See variables `bib-etags-command' and `bib-etags-filename'."
   (interactive)
   (require 'etags)
   (let* ((the-file-list (bib-document-TeX-files))
@@ -1358,12 +1358,14 @@ If within a single file document:
   You can move back with C-xC-x as the mark is set before moving.
   You can search for next occurrances of a ref command with C-sC-s.
 
-If within a multi-file document (in auctex only)
+If within a multi-file document (in AUCTeX only)
   You can move back with C-xC-x if within the same buffer.  If not, just
   select your previous buffer.
-  You can search for next occurrances of a ref command with tag commands:
+  You can search for next occurrences of a ref command with tag commands:
      C-u M-.     Find next alternate definition of last tag specified.
      C-u - M-.   Go back to previous tag found."
+  ;; FIXME: The last 3 lines of the above doc string no longer hold
+  ;; since M-. is now bound to `xref-find-definitions'.
   (let ((the-regexp (bib-guess-or-prompt-for-label)))
     (if (not the-regexp)
         (message "No name given")
@@ -1954,7 +1956,7 @@ Sets global variable bib-document-TeX-files-warnings."
         (progn
           (kill-buffer tex-buffer)
           (error
-           "Sorry, but this is not a multi-file document (Try C-u C-c C-n if 
using auctex)")))
+           "Sorry, but this is not a multi-file document (Try C-u C-c C-n if 
using AUCTeX)")))
     (with-current-buffer tex-buffer
       ;; set its directory so relative includes work without expanding
       (setq default-directory dir)
@@ -1989,8 +1991,8 @@ Sets global variable bib-document-TeX-files-warnings."
   "Return cite keys obarray for multi-file document.
 Return nil if not a multi-file document.
 This is a AUCTeX supported feature only.
-Also, see bib-buffer-citekeys-obarray.
-Sets global variable bib-document-citekeys-obarray-warnings."
+Also, see `bib-buffer-citekeys-obarray'.
+Set global variable `bib-document-citekeys-obarray-warnings'."
   (setq bib-document-citekeys-obarray-warnings nil)
   (let ((master-tex (bib-master-file))
         (master-aux))
@@ -2319,7 +2321,7 @@ If FIRST-FILE is t, stop after first file is found."
 argument may consist of environment variable plus a trailing directory, e.g.
 HOME or HOME/bin (trailing directory not supported in dos or OS/2).
 
-bib-dos-or-os2-variable affects:
+`bib-dos-or-os2-variable' affects:
   path separator used (: or ;)
   whether backslashes are converted to slashes"
   (if (not (getenv env))
diff --git a/configure.ac b/configure.ac
index a435cb8ecb..fe7616d5a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl Autoconf script for AUCTeX
 
 dnl Maintainer: auctex-devel@gnu.org
 
-dnl Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2022Free Software Foundation, Inc.
 
 dnl This file is part of AUCTeX.
 
@@ -37,7 +37,7 @@ AC_SUBST(PREVIEWVERSION)
 
 EMACS_PROG_EMACS
 
-EMACS_CHECK_VERSION(24,3)
+EMACS_CHECK_VERSION(25,1)
 
 # The Debian package uses `--disable-build-dir-test'; normal users should
 # never need to modify the default behavior.
diff --git a/context.el b/context.el
index 2f5c57e8e8..e87feecdb8 100644
--- a/context.el
+++ b/context.el
@@ -414,7 +414,7 @@ The following variables are set before the hooks are run
 `ConTeXt-done-mark' - Position of point afterwards, default nil
                       (meaning end).
 
-The following standard hook exist -
+The following standard hooks exist -
 
 ConTeXt-numbered-section-heading: Query the user about the name
 of the sectioning command.  Modifies `ConTeXt-level' and
@@ -433,12 +433,12 @@ ConTeXt-section-ref: Insert a reference for this section 
command.
 To get a full featured `ConTeXt-section' command, insert
 
  (setq ConTeXt-numbered-section-hook
-                         '(ConTeXt-numbered-section-heading
+                         \\='(ConTeXt-numbered-section-heading
                                  ConTeXt-section-title
                                  ConTeXt-section-section
                                  ConTeXt-section-ref))
 
-in your .emacs file."
+in your init file such as .emacs.d/init.el or .emacs."
   :group 'ConTeXt-macro
   :type 'hook
   :options
@@ -466,7 +466,7 @@ The following variables are set before the hooks are run
 `ConTeXt-done-mark' - Position of point afterwards, default nil
                       (meaning end).
 
-The following standard hook exist -
+The following standard hooks exist -
 
 ConTeXt-unnumbered-section-heading: Query the user about the name
 of the sectioning command.  Modifies `ConTeXt-level' and
@@ -485,12 +485,12 @@ ConTeXt-section-ref: Insert a reference for this section 
command.
 To get a full featured `ConTeXt-section' command, insert
 
  (setq ConTeXt-unnumbered-section-hook
-                         '(ConTeXt-unnumbered-section-heading
+                         \\='(ConTeXt-unnumbered-section-heading
                                  ConTeXt-section-title
                                  ConTeXt-section-section
                                  ConTeXt-section-ref))
 
-in your .emacs file."
+in your init file such as .emacs.d/init.el or .emacs."
   :group 'ConTeXt-macro
   :type 'hook
   :options
@@ -1696,7 +1696,7 @@ file, or any mode derived thereof. See variable
     "-mprun\\.mp" "-mprun\\.mpd" "-mprun\\.mpo" "-mprun\\.mpy")
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
@@ -1704,7 +1704,7 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   '("\\.dvi" "\\.pdf" "\\.ps")
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
diff --git a/doc/changes.texi b/doc/changes.texi
index 12acd0c247..b8c70ba33e 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -11,6 +11,9 @@
 @heading News since last release
 
 @itemize @bullet
+@item
+@AUCTeX{} now requires GNU Emacs 25.1 or higher.
+
 @item
 @AUCTeX{} tracks the change in Emacs where initial inputs in the
 minibuffer during queries are getting phased out.  Queries for the
diff --git a/doc/faq.texi b/doc/faq.texi
index da5576b122..a6122ec01b 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -71,7 +71,7 @@ statements related to the problem.
 @item
 What versions of Emacs are supported?
 
-@AUCTeX{} was tested with @w{GNU Emacs 24.3}.  Older versions may work but
+@AUCTeX{} was tested with @w{GNU Emacs 25.1}.  Older versions may work but
 are unsupported.
 
 @item
diff --git a/doc/install.texi b/doc/install.texi
index f7af60ff2c..19034cb957 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -96,7 +96,7 @@ the file @file{INSTALL.windows}.
 @end ifclear
 
 @itemize @bullet
-@item GNU Emacs 24.3 or higher
+@item GNU Emacs 25.1 or higher
 
 Using @previewlatex{} requires a version of Emacs compiled with image
 support.
diff --git a/doc/preview-faq.texi b/doc/preview-faq.texi
index 569ef00313..bf16c7f61a 100644
--- a/doc/preview-faq.texi
+++ b/doc/preview-faq.texi
@@ -48,7 +48,7 @@ to @email{auctex-devel@@gnu.org}.
 @subsection Which version of Emacs is needed?
 
 @previewlatex{} nominally requires @w{GNU Emacs} with a version of at
-least 24.3.
+least 25.1.
 
 @subsection Which versions of Ghostscript and @AUCTeX{} are needed?
 
diff --git a/font-latex.el b/font-latex.el
index 2a90f3098b..c49a698754 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -72,13 +72,13 @@ strings to be used as opening and closing quotation marks
 independently of the value of `font-latex-quotes' or a list with
 three elements where the first and second element are strings for
 opening and closing quotation marks and the third element being
-either the symbol 'german or 'french describing the order of
+either the symbol `german' or `french' describing the order of
 quotes.
 
 If `font-latex-quotes' specifies a different state, order of the
 added quotes will be reversed for fontification.  For example if
 '(\"\\\"<\" \"\\\">\" french) is given but `font-latex-quotes'
-specifies 'german, quotes will be used like \">foo\"< for
+specifies `german', quotes will be used like \">foo\"< for
 fontification.")
 
 (defvar font-latex-quotes-control nil
@@ -453,7 +453,7 @@ The first element of each item is the name of the keyword 
class.
 
 The second element is a list of keywords (macros without an
 escape character) to highlight or, if the fifth element is the
-symbol 'command, a list of lists where the first element of each
+symbol `command', a list of lists where the first element of each
 item is a keyword and the second a string specifying the macro
 syntax.  It can contain \"*\" if the macro has a starred variant,
 \"[\" for an optional argument, \"{\" for a mandatory argument,
@@ -466,9 +466,9 @@ form returning a face symbol.
 The fourth element is the fontification level.
 
 The fifth element is the type of construct to be matched.  It can
-be one of 'noarg which will match simple macros without
-arguments (like \"\\foo\"), 'declaration which will match macros
-inside a TeX group (like \"{\\bfseries foo}\"), or 'command which
+be one of `noarg' which will match simple macros without
+arguments (like \"\\foo\"), `declaration' which will match macros
+inside a TeX group (like \"{\\bfseries foo}\"), or `command' which
 will match macros of the form \"\\foo[bar]{baz}\"."))
 
 (defcustom font-latex-deactivated-keyword-classes nil
@@ -569,7 +569,7 @@ attributes that will be applied to the respective part of 
the
 match returned by the match function.  A lisp form returning a
 face name or a list of face attributes is also valid for FACE.
 TYPE is the type of construct to be highlighted.  Currently the
-symbols 'command, 'declaration and 'noarg are valid.
+symbols `command', `declaration' and `noarg' are valid.
 
 This is a helper function for `font-latex-make-built-in-keywords'
 and `font-latex-make-user-keywords' and not intended for general
@@ -906,12 +906,12 @@ Generated by `font-latex-make-user-keywords'.")))
   "Add KEYWORDS to CLASS.
 KEYWORDS is a list of keywords or keywords with syntax specs.
 CLASS corresponds to a keyword class and can be one of the
-symbols 'warning, 'variable, 'reference, 'biblatexnoarg,
-'biblatex, 'function, 'sectioning-0, 'sectioning-1,
-'sectioning-2, 'sectioning-3, 'sectioning-4, 'sectioning-5,
-'slide-title, 'textual, 'bold-command, 'italic-command,
-'math-command, 'type-command, 'bold-declaration,
-'italic-declaration or 'type-declaration.
+symbols `warning', `variable', `reference', `biblatexnoarg',
+`biblatex', `function', `sectioning-0', `sectioning-1',
+`sectioning-2', `sectioning-3', `sectioning-4', `sectioning-5',
+`slide-title', `textual', `bold-command', `italic-command',
+`math-command', `type-command', `bold-declaration',
+`italic-declaration' or `type-declaration'.
 
 The keywords will be added to the buffer-local list of keywords
 of the respective keyword class and necessary updates of the font
@@ -1648,7 +1648,7 @@ Sets `match-data' so that:
  subexpression 0 is a warning indicator,
  subexpression 1 is the keyword, and
  subexpression 2 is the rest in the TeX group.
-Returns nil if no command is found."
+Return nil if no command is found."
   (catch 'match
     (while (re-search-forward keywords limit t)
       (unless (font-latex-faces-present-p '(font-lock-comment-face
@@ -2026,7 +2026,7 @@ Used for patterns like:
 ``this is a normal quote'' and these are multilingual quoted strings:
 \"< french \"> and \"`german\"' quotes.
 The quotes << french >> and 8-bit french are used if `font-latex-quotes' is
-set to french, and >>german<< (and 8-bit) are used if set to german."
+set to `french', and >>german<< (and 8-bit) are used if set to `german'."
   (when font-latex-quotes
     (font-latex-update-quote-list)
     ;; Search for matches.
diff --git a/latex.el b/latex.el
index 4527fbafb7..5747449c5a 100644
--- a/latex.el
+++ b/latex.el
@@ -399,7 +399,7 @@ LaTeX-title - The title of the section, default to an empty 
string.
 LaTeX-toc - Entry for the table of contents list, default nil.
 LaTeX-done-mark - Position of point afterwards, default nil (meaning end).
 
-The following standard hook exist -
+The following standard hooks exist -
 
 LaTeX-section-heading: Query the user about the name of the
 sectioning command.  Modifies `LaTeX-level' and `LaTeX-name'.
@@ -422,13 +422,13 @@ Controled by the variable `LaTeX-section-label'.
 To get a full featured `LaTeX-section' command, insert
 
  (setq LaTeX-section-hook
-       '(LaTeX-section-heading
+       \\='(LaTeX-section-heading
          LaTeX-section-title
          LaTeX-section-toc
          LaTeX-section-section
          LaTeX-section-label))
 
-in your .emacs file."
+in your init file such as .emacs.d/init.el or .emacs."
   :group 'LaTeX-macro
   :type 'hook
   :options '(LaTeX-section-heading
@@ -3278,7 +3278,7 @@ as values for the key.  Use PROMPT as the prompt string."
                    (cond ((member hook '("env" "para"))
                           '("after" "before" "begin" "end"))
                          ((string= hook "include")
-                          '("after" "before" "end"))
+                          '("after" "before" "end" "excluded"))
                          ((string= hook "begindocument")
                           '("before" "end"))
                          ((string= hook "enddocument")
@@ -3337,7 +3337,7 @@ as values for the key.  Use PROMPT as the prompt string."
            (setq where (funcall place)))
 
           ;; include/<file-name>/<where>: <file-name> is optional and
-          ;; <where> is one of (before|after|end)
+          ;; <where> is one of (before|after|end|excluded)
           ((string= hook "include")
            (if (funcall search)
                (progn
@@ -3978,7 +3978,7 @@ If optional argument COMMENT is non-nil, include comment 
env from
   "Return the indentation of a line of LaTeX source.
 FORCE-TYPE can be used to force the calculation of an inner or
 outer indentation in case of a commented line.  The symbols
-'inner and 'outer are recognized."
+`inner' and `outer' are recognized."
   (save-excursion
     (LaTeX-back-to-indentation force-type)
     (let ((i 0)
@@ -4097,7 +4097,7 @@ constructs.  A special case is \\newif where the following
 The point is supposed to be at the beginning of the current line.
 FORCE-TYPE can be used to force the calculation of an inner or
 outer indentation in case of a commented line.  The symbols
-'inner and 'outer are recognized."
+`inner' and `outer' are recognized."
   (let (line-comment-current-flag
         line-comment-last-flag
         comment-current-flag
@@ -4156,9 +4156,20 @@ outer indentation in case of a commented line.  The 
symbols
                                     "end[ \t]*{macrocode\\*?}"))
                 fill-prefix
                 (TeX-in-line-comment))
-           ;; Reset indentation to zero after a macrocode
-           ;; environment.
-           0)
+           ;; Reset indentation to zero after a macrocode environment
+           ;; only when we're not still inside a describing
+           ;; environment like "macro" or "environment" etc.  Text
+           ;; inside these environments after '\end{macrocode}' is
+           ;; indented with `LaTeX-indent-level':
+           (let ((outer-env (LaTeX-current-environment 2)))
+             (cond ((member outer-env '("macro" "environment"))
+                    LaTeX-indent-level)
+                   ((and (fboundp 'LaTeX-doc-NewDocElement-list)
+                         (LaTeX-doc-NewDocElement-list)
+                         (member outer-env
+                                 (mapcar #'cadr 
(LaTeX-doc-NewDocElement-list))))
+                    LaTeX-indent-level)
+                   (t 0))))
           ((looking-at (concat (regexp-quote TeX-esc)
                                "begin *{"
                                ;; Don't give optional argument here
@@ -4220,7 +4231,7 @@ outer indentation in case of a commented line.  The 
symbols
   "Return the indentation of a line.
 FORCE-TYPE can be used to force the calculation of an inner or
 outer indentation in case of a commented line.  The symbols
-'inner and 'outer are recognized."
+`inner' and `outer' are recognized."
   (if (and fill-prefix
            (or (and force-type
                     (eq force-type 'inner))
@@ -4251,7 +4262,7 @@ character(s), but only if `this-command' is not a newline
 command, that is, `TeX-newline' or the value of
 `TeX-newline-function'.  The optional argument FORCE-TYPE can be
 used to force point being moved to the inner or outer indentation
-in case of a commented line.  The symbols 'inner and 'outer are
+in case of a commented line.  The symbols `inner' and `outer' are
 recognized."
   (if (or (and force-type
                (eq force-type 'inner))
@@ -7198,14 +7209,14 @@ runs the hooks in `docTeX-mode-hook'."
   TeX-clean-default-intermediate-suffixes
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
 (defcustom docTeX-clean-output-suffixes TeX-clean-default-output-suffixes
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
@@ -7215,14 +7226,14 @@ that is, you do _not_ have to cater for this yourself 
by adding \\\\' or $."
           '("\\.acn" "\\.acr" "\\.alg" "\\.glg" "\\.ist"))
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
 (defcustom LaTeX-clean-output-suffixes TeX-clean-default-output-suffixes
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
@@ -7286,8 +7297,8 @@ function would return non-nil and `(match-string 1)' 
would return
   (set (make-local-variable 'TeX-search-files-type-alist)
        LaTeX-search-files-type-alist)
 
-  (setq-local beginning-of-defun-function #'LaTeX-find-matching-begin
-              end-of-defun-function       #'LaTeX-find-matching-end)
+  (setq-local beginning-of-defun-function #'LaTeX-find-matching-begin)
+  (setq-local end-of-defun-function       #'LaTeX-find-matching-end)
 
   (LaTeX-indent-commands-regexp-make)
 
@@ -8096,7 +8107,7 @@ key=value, default is \"label\".  NUM is an integer for an
 explicitly numbered group construct, useful when adding items to
 `reftex-label-regexps'.
 
-As an extra feature, the key can be the symbol none where the
+As an extra feature, the key can be the symbol `none' where the
 entire matching for the key=value is skipped.  The regexp then is
 useful for skipping complex optional arguments.  It should be
 wrapped in \\(?:...\\)? then."
diff --git a/latex/preview.dtx b/latex/preview.dtx
index 6b21ace38e..de4675e98a 100644
--- a/latex/preview.dtx
+++ b/latex/preview.dtx
@@ -1676,7 +1676,7 @@ Please complain to your document class author}%
 %<tightpage>       7{currentfile token not{stop}if 65781.76 div })) pop}
 %    \end{macrocode}
 % The ``userdict'' at the start of the last special is also there to
-% avoid an unknown special in dvipng<=1.6. This is the end of the
+% avoid an unknown special in dvipng$<=1.6$. This is the end of the
 % backwards-compatibility code.
 %    \begin{macrocode}
 %<tightpage>  \special{!userdict begin/bop-hook{%
diff --git a/plain-tex.el b/plain-tex.el
index a525740643..4f06a026f0 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -253,14 +253,14 @@ of `plain-TeX-mode-hook'."
   TeX-clean-default-intermediate-suffixes
   "List of regexps matching suffixes of intermediate files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
 (defcustom plain-TeX-clean-output-suffixes TeX-clean-default-output-suffixes
   "List of regexps matching suffixes of output files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
@@ -314,14 +314,14 @@ of `AmS-TeX-mode-hook'."
   TeX-clean-default-intermediate-suffixes
   "List of regexps matching suffixes of intermediate files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
 (defcustom AmSTeX-clean-output-suffixes TeX-clean-default-output-suffixes
   "List of regexps matching suffixes of output files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
diff --git a/preview.el b/preview.el
index f60a7abf00..ad48b0984e 100644
--- a/preview.el
+++ b/preview.el
@@ -412,7 +412,7 @@ screen content.  Buffer-local to rendering buffer.")
   "Color setup list.
 An array with elements 0, 1 and 2 for background,
 foreground and border colors, respectively.  Each element
-is a list of 3 real numbers between 0 and 1, or NIL
+is a list of 3 real numbers between 0 and 1, or nil
 of nothing special should be done for the color")
 (make-variable-buffer-local 'preview-colors)
 
@@ -1091,7 +1091,7 @@ The usual PROCESS and COMMAND arguments for
 
 (defun preview-dsc-parse (file)
   "Parse DSC comments of FILE.
-Returns a vector with offset/length pairs corresponding to
+Return a vector with offset/length pairs corresponding to
 the pages.  Page 0 corresponds to the initialization section."
   (with-temp-buffer
     (set-buffer-multibyte nil)
@@ -1146,7 +1146,7 @@ object corresponding to the wanted page."
 (defun preview-ps-quote-filename (str &optional nonrel)
   "Make a PostScript string from filename STR.
 The file name is first made relative unless
-NONREL is not NIL."
+NONREL is not nil."
   (unless nonrel (setq str (file-relative-name str)))
   (let ((index 0))
     (while (setq index (string-match "[\\()]" str index))
@@ -1520,7 +1520,7 @@ This is for matching screen font size and previews."
   "Calculate the default font size of document.
 If packages, classes or styles were called with an option
 like 10pt, size is taken from the first such option if you
-had let your document be parsed by AucTeX."
+had let your document be parsed by AUCTeX."
   (let* ((regexp "\\`\\([0-9]+\\)pt\\'")
          (option
           (or
@@ -1630,10 +1630,10 @@ Fallback to :inherit and 'default implemented."
                               #'backward-char #'forward-char))
   "Cause previews to open automatically when entered.
 Possibilities are:
-T autoopens,
-NIL doesn't,
+t autoopens,
+nil doesn't,
 a symbol will have its value consulted if it exists,
-defaulting to NIL if it doesn't.
+defaulting to nil if it doesn't.
 An integer will specify a maximum cursor movement distance.
 Larger movements won't open the preview.
 A CONS-cell means to call a function for determining the value.
@@ -1655,7 +1655,7 @@ All of the options show reasonable defaults."
 
 (defun preview-auto-reveal-p (mode distance)
   "Decide whether to auto-reveal.
-Returns non-NIL if region should be auto-opened.
+Return non-nil if region should be auto-opened.
 See `preview-auto-reveal' for definitions of MODE, which gets
 set to `preview-auto-reveal'.  DISTANCE specifies the movement
 distance with which point has been reached in case it has been
@@ -1671,7 +1671,7 @@ a movement starting in the current buffer."
 
 (defun preview-arrived-via (&rest list)
   "Indicate auto-opening.
-Returns non-NIL if called by one of the commands in LIST."
+Return non-nil if called by one of the commands in LIST."
   (memq this-command list))
 
 (defcustom preview-equality-transforms '(identity
@@ -1784,7 +1784,7 @@ REST as the remainder, returning T."
 
 (defun preview-remove-urgentization (ov)
   "Undo urgentization of OV by `preview-add-urgentization'.
-Returns the old arguments to `preview-add-urgentization'
+Return the old arguments to `preview-add-urgentization'
 if there was any urgentization."
   (let ((dispro (overlay-get ov 'display)))
     (when (eq (car-safe dispro) 'when)
@@ -2423,8 +2423,8 @@ Possible values are nil, t, and `ask'."
   "Alist of dumped masters.
 The elements are (NAME . ASSOC).  NAME is the master file name
 \(without extension), ASSOC is what to do with regard to this
-format.  Possible values: NIL means no format is available
-and none should be generated.  T means no format is available,
+format.  Possible values: nil means no format is available
+and none should be generated.  t means no format is available,
 it should be generated on demand.  If the value is a cons cell,
 the CAR of the cons cell is the command with which the format
 has been generated, and the CDR is some Emacs-flavor specific
@@ -2576,7 +2576,7 @@ TeX bounding BOX passed on to the `place' hook.
 COUNTERS is the info about saved counter structures.
 TEMPDIR is a copy of `TeX-active-tempdir'.
 PLACE-OPTS are additional arguments passed into
-`preview-parse-messages'.  Returns
+`preview-parse-messages'.  Return
 a list with additional info from the placement hook.
 Those lists get concatenated together and get passed
 to the close hook."
@@ -2872,9 +2872,9 @@ using MML mode."
   "Return an MML representation of OV as string.
 This can be used to send inline images in mail and news when
 using MML mode.  If there is nothing current available,
-NIL is returned.  If the image has a colored border and the
+nil is returned.  If the image has a colored border and the
 user wants it removed when asked (unless DONT-ASK is set),
-'badcolor is thrown a t.  The MML is returned in the car of the
+`badcolor' is thrown a t.  The MML is returned in the car of the
 result, DONT-ASK in the cdr."
   (and (memq (overlay-get ov 'preview-state) '(active inactive))
        (not (overlay-get ov 'queued))
@@ -3652,7 +3652,7 @@ name(\\([^)]+\\))\\)\\|\
 
 (defun preview-get-geometry ()
   "Transfer display geometry parameters from current display.
-Returns list of scale, resolution and colors.  Calculation
+Return list of scale, resolution and colors.  Calculation
 is done in current buffer."
   (condition-case err
       (let* ((geometry
@@ -3686,7 +3686,7 @@ and `preview-colors' are set as given."
   "Return colors from the current display.
 Fetches the current screen colors and makes a vector
 of colors as numbers in the range 0..65535.
-Pure borderless black-on-white will return triple NIL.
+Pure borderless black-on-white will return triple nil.
 The fourth value is the transparent border thickness."
   (let
       ((bg (color-values (preview-inherited-face-attribute
@@ -3956,7 +3956,7 @@ This is passed through `preview-do-replacements'."
 For the rest of the session, this file is used when running
 on the same master file.
 
-Returns the process for dumping, nil if there is still a valid
+Return the process for dumping, nil if there is still a valid
 format available.
 
 If FORMAT-CONS is non-nil, a previous format may get reused."
diff --git a/style/biblatex.el b/style/biblatex.el
index 3e86b71825..43115becc6 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -266,7 +266,6 @@ for citation keys."
                      "biblatex" "backend=bibtexu")))))
 
    (TeX-run-style-hooks
-    "etoolbox"
     "keyval"
     "kvoptions"
     "logreq"
@@ -330,7 +329,7 @@ for citation keys."
     ;; Dynamic Entry Sets
     '("defbibentryset" "Set"
       (TeX-arg-eval mapconcat #'identity (TeX-completing-read-multiple
-                                         "Keys: " (LaTeX-bibitem-list)) ","))
+                                          "Keys: " (LaTeX-bibitem-list)) ","))
     ;;; Citation Commands
     '("cite" (TeX-arg-conditional TeX-arg-cite-note-p
                                   (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
@@ -522,22 +521,22 @@ for citation keys."
               (car cmd)
               '(TeX-arg-conditional TeX-arg-cite-note-p
                                     ([LaTeX-arg-biblatex-natbib-notes])
-                                  nil)
+                                    nil)
               #'TeX-arg-cite))))
          cmds))
 
-     ;; Fontification for compat macros does not go into `font-latex.el':
-     (when (and (featurep 'font-latex)
-                (eq TeX-install-font-lock 'font-latex-setup))
-       (font-latex-add-keywords '(("citet"        "*[[{")
-                                  ("Citet"        "*[[{")
-                                  ("citep"        "*[[{")
-                                  ("Citep"        "*[[{")
-                                  ("citealt"      "*[[{")
-                                  ("Citealt"      "*[[{")
-                                  ("citealp"      "*[[{")
-                                  ("Citealp"      "*[[{"))
-                                'biblatex))))
+       ;; Fontification for compat macros does not go into `font-latex.el':
+       (when (and (featurep 'font-latex)
+                  (eq TeX-install-font-lock 'font-latex-setup))
+         (font-latex-add-keywords '(("citet"        "*[[{")
+                                    ("Citet"        "*[[{")
+                                    ("citep"        "*[[{")
+                                    ("Citep"        "*[[{")
+                                    ("citealt"      "*[[{")
+                                    ("Citealt"      "*[[{")
+                                    ("citealp"      "*[[{")
+                                    ("Citealp"      "*[[{"))
+                                  'biblatex))))
 
    (LaTeX-add-environments
     ;;; Bibliography commands
diff --git a/style/etoolbox.el b/style/etoolbox.el
new file mode 100644
index 0000000000..42af6a4832
--- /dev/null
+++ b/style/etoolbox.el
@@ -0,0 +1,376 @@
+;;; etoolbox.el --- AUCTeX style for `etoolbox.sty' v2.5k  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Created: 2022-03-19
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `etoolbox.sty' v2.5k from 2020/10/05.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+(defun LaTeX-arg-etoolbox-csname (optional &optional prompt)
+  "Query and insert the name of a TeX control sequence.
+If OPTIONAL is non-nil, then insert it in square brackets.
+PROMPT replaces the standard one."
+  (TeX-argument-insert
+   (completing-read
+    (TeX-argument-prompt optional prompt "Control sequence")
+    (TeX-symbol-list))
+   optional))
+
+(defun LaTeX-arg-etoolbox-macro-free (optional &optional prompt)
+  "Query and insert a macro not surrounded by braces.
+If OPTIONAL is non-nil, insert the macro only when given by the
+user."
+  (let ((TeX-arg-opening-brace "")
+        (TeX-arg-closing-brace "")
+        (macro (completing-read
+                (TeX-argument-prompt optional prompt
+                                     (concat "Macro: " TeX-esc)
+                                     t)
+                (TeX-symbol-list))))
+    (TeX-argument-insert macro optional TeX-esc)))
+
+(TeX-add-style-hook
+ "etoolbox"
+ (lambda ()
+
+   (TeX-add-symbols
+
+    ;; 2.1 Definitions
+    '("newrobustcmd"  TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] 
t)
+    '("newrobustcmd*" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] 
t)
+    '("renewrobustcmd"  TeX-arg-macro [ TeX-arg-define-macro-arguments ] t)
+    '("renewrobustcmd*" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t)
+    '("providerobustcmd"  TeX-arg-define-macro [ 
TeX-arg-define-macro-arguments ] t)
+    '("providerobustcmd*" TeX-arg-define-macro [ 
TeX-arg-define-macro-arguments ] t)
+
+    ;; 2.2 Patching
+    '("robustify" TeX-arg-macro)
+
+    ;; 2.3 Protection
+    '("protecting" t)
+
+    ;; 2.4 Length and Counter Assignments
+    '("defcounter" TeX-arg-counter t)
+    '("deflength"  TeX-arg-length t)
+
+    ;; 2.5 Additional Document Hooks
+    '("AfterPreamble" t)
+    '("AtEndPreamble" t)
+    '("AfterEndPreamble" t)
+    '("AfterEndDocument" t)
+
+    ;; 2.6 Environment Hooks
+    '("AtBeginEnvironment" TeX-arg-environment t)
+    '("AtEndEnvironment" TeX-arg-environment t)
+    '("BeforeBeginEnvironment" TeX-arg-environment t)
+    '("AfterEndEnvironment" TeX-arg-environment t)
+
+    ;; 3 Author Commands
+    ;; 3.1.1 Macro Definitions
+    '("csdef"  LaTeX-arg-etoolbox-csname [TeX-arg-free "Arguments"] t)
+    '("csgdef" LaTeX-arg-etoolbox-csname [TeX-arg-free "Arguments"] t)
+    '("csedef" LaTeX-arg-etoolbox-csname [TeX-arg-free "Arguments"] t)
+    '("csxdef" LaTeX-arg-etoolbox-csname [TeX-arg-free "Arguments"] t)
+    '("protected@csedef"
+      LaTeX-arg-etoolbox-csname [TeX-arg-free "Arguments"] t)
+    '("protected@csxdef"
+      LaTeX-arg-etoolbox-csname [TeX-arg-free "Arguments"] t)
+    '("cslet"   LaTeX-arg-etoolbox-csname TeX-arg-macro)
+    '("letcs"   TeX-arg-macro LaTeX-arg-etoolbox-csname)
+    '("csletcs" LaTeX-arg-etoolbox-csname LaTeX-arg-etoolbox-csname)
+    '("csuse"   LaTeX-arg-etoolbox-csname)
+    '("undef"   LaTeX-arg-etoolbox-macro-free)
+    '("gundef"  LaTeX-arg-etoolbox-macro-free)
+    '("csundef"   LaTeX-arg-etoolbox-csname)
+    '("csgundef"  LaTeX-arg-etoolbox-csname)
+    '("csmeaning" LaTeX-arg-etoolbox-csname)
+    '("csshow"    LaTeX-arg-etoolbox-csname)
+
+    ;; 3.1.2 Arithmetic Definitions
+    '("numdef" LaTeX-arg-etoolbox-macro-free "Integer expression")
+    '("numgdef" LaTeX-arg-etoolbox-macro-free "Integer expression")
+    '("csnumdef" LaTeX-arg-etoolbox-csname "Integer expression")
+    '("csnumgdef" LaTeX-arg-etoolbox-csname "Integer expression")
+
+    '("dimdef" LaTeX-arg-etoolbox-macro-free "Dimension expression")
+    '("dimgdef" LaTeX-arg-etoolbox-macro-free "Dimension expression")
+    '("csdimdef" LaTeX-arg-etoolbox-csname "Dimension expression")
+    '("csdimgdef" LaTeX-arg-etoolbox-csname "Dimension expression")
+
+    '("gluedef" LaTeX-arg-etoolbox-macro-free "Glue expression")
+    '("gluegdef" LaTeX-arg-etoolbox-macro-free "Glue expression")
+    '("csgluedef" LaTeX-arg-etoolbox-csname "Glue expression")
+    '("csgluegdef" LaTeX-arg-etoolbox-csname "Glue expression")
+
+    '("mudef" LaTeX-arg-etoolbox-macro-free "Muglue expression")
+    '("mugdef" LaTeX-arg-etoolbox-macro-free "Muglue expression")
+    '("csmudef" LaTeX-arg-etoolbox-csname "Muglue expression")
+    '("csmugdef" LaTeX-arg-etoolbox-csname "Muglue expression")
+
+    ;; 3.2 Expansion Control
+    '("expandonce" LaTeX-arg-etoolbox-macro-free)
+    '("csexpandonce" LaTeX-arg-etoolbox-csname)
+
+    ;; 3.3.1 Appending to a Hook
+    '("appto" LaTeX-arg-etoolbox-macro-free t)
+    '("gappto" LaTeX-arg-etoolbox-macro-free t)
+    '("eappto" LaTeX-arg-etoolbox-macro-free t)
+    '("xappto" LaTeX-arg-etoolbox-macro-free t)
+    '("protected@eappto" LaTeX-arg-etoolbox-macro-free t)
+    '("protected@xappto" LaTeX-arg-etoolbox-macro-free t)
+
+    '("csappto" LaTeX-arg-etoolbox-csname t)
+    '("csgappto" LaTeX-arg-etoolbox-csname t)
+    '("cseappto" LaTeX-arg-etoolbox-csname t)
+    '("csxappto" LaTeX-arg-etoolbox-csname t)
+    '("protected@cseappto" LaTeX-arg-etoolbox-csname t)
+    '("protected@csxappto" LaTeX-arg-etoolbox-csname t)
+
+    ;; 3.3.2 Prepending to a Hook
+    '("preto" LaTeX-arg-etoolbox-macro-free t)
+    '("gpreto" LaTeX-arg-etoolbox-macro-free t)
+    '("epreto" LaTeX-arg-etoolbox-macro-free t)
+    '("xpreto" LaTeX-arg-etoolbox-macro-free t)
+    '("protected@epreto" LaTeX-arg-etoolbox-macro-free t)
+    '("protected@xpreto" LaTeX-arg-etoolbox-macro-free t)
+
+    '("cspreto" LaTeX-arg-etoolbox-csname t)
+    '("csgpreto" LaTeX-arg-etoolbox-csname t)
+    '("csepreto" LaTeX-arg-etoolbox-csname t)
+    '("csxpreto" LaTeX-arg-etoolbox-csname t)
+    '("protected@csepreto" LaTeX-arg-etoolbox-csname t)
+    '("protected@csxpreto" LaTeX-arg-etoolbox-csname t)
+
+    ;; 3.4 Patching
+
+    '("patchcmd" ["Prefix"] TeX-arg-macro 4)
+    '("ifpatchable" TeX-arg-macro 3)
+    '("ifpatchable*" TeX-arg-macro 2)
+    '("apptocmd" TeX-arg-macro 3)
+    '("pretocmd" TeX-arg-macro 3)
+    "tracingpatches"
+
+    ;; 3.5.1 TeX Flags
+    '("newbool"     "Name")
+    '("providebool" "Name")
+    '("booltrue"    "Name")
+    '("boolfalse"   "Name")
+    '("setbool"     "Name" (TeX-arg-eval completing-read
+                                         (TeX-argument-prompt nil nil "Value")
+                                         '("true" "false")))
+    '("ifbool"      "Name" 2)
+    '("notbool"     "Name" 2)
+
+    ;; 3.5.2 LaTeX Flags
+    '("newtoggle"     "Name")
+    '("providetoggle" "Name")
+    '("toggletrue"    "Name")
+    '("togglefalse"   "Name")
+    '("settoggle"     "Name" (TeX-arg-eval completing-read
+                                           (TeX-argument-prompt nil nil 
"Value")
+                                           '("true" "false")))
+    '("iftoggle"      "Name" 2)
+    '("nottoggle"     "Name" 2)
+
+    ;; 3.6.1 Macro Tests
+    '("ifdef" TeX-arg-macro 2)
+    '("ifcsdef" LaTeX-arg-etoolbox-csname 2)
+    '("ifundef" TeX-arg-macro 2)
+    '("ifcsundef" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefmacro" TeX-arg-macro 2)
+    '("ifcsmacro" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefparam" TeX-arg-macro 2)
+    '("ifcsparam" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefprefix" TeX-arg-macro 2)
+    '("ifcsprefix" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefprotected" TeX-arg-macro 2)
+    '("ifcsprotected" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefltxprotected" TeX-arg-macro 2)
+    '("ifcsltxprotected" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefempty" TeX-arg-macro 2)
+    '("ifcsempty" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefvoid" TeX-arg-macro 2)
+    '("ifcsvoid" LaTeX-arg-etoolbox-csname 2)
+    '("ifdefequal" TeX-arg-macro TeX-arg-macro 2)
+    '("ifcsequal" LaTeX-arg-etoolbox-csname LaTeX-arg-etoolbox-csname 2)
+    '("ifdefstring" TeX-arg-macro 3)
+    '("ifcsstring" LaTeX-arg-etoolbox-csname 3)
+    '("ifdefstrequal" TeX-arg-macro TeX-arg-macro 2)
+    '("ifcsstrequal" LaTeX-arg-etoolbox-csname LaTeX-arg-etoolbox-csname 2)
+
+    ;; 3.6.2 Counter and Length Tests
+    '("ifdefcounter" TeX-arg-macro 2)
+    '("ifcscounter" LaTeX-arg-etoolbox-csname 2)
+    '("ifltxcounter" TeX-arg-counter 2)
+    '("ifdeflength" TeX-arg-length 2)
+    '("ifcslength" (TeX-arg-eval completing-read
+                                 (TeX-argument-prompt nil nil "Length")
+                                 (LaTeX-length-list))
+      2)
+    '("ifdefdimen" TeX-arg-macro 2)
+    '("ifcsdimen" "Control sequence" 2)
+
+    ;; 3.6.3 String Tests
+    '("ifstrequal" 4)
+    '("ifstrempty" 3)
+    '("ifblank" 3)
+    '("notblank" 3)
+
+    ;; 3.6.4 Arithmetic Tests
+    '("ifnumcomp" 5)
+    '("ifnumequal" 4)
+    '("ifnumgreater" 4)
+    '("ifnumless" 4)
+    '("ifnumodd" 3)
+
+    '("ifdimcomp" 5)
+    '("ifdimequal" 4)
+    '("ifdimgreater" 4)
+    '("ifdimless" 4)
+
+    ;; 3.6.5 Boolean Expressions
+    '("ifboolexpr" 3)
+    '("ifboolexpe" 3)
+    '("whileboolexpr" 2)
+    '("unlessboolexpr" 2)
+
+    ;; 3.7 List Processing
+    ;; 3.7.1 User Input
+    '("DeclareListParser" TeX-arg-define-macro "Separator")
+    '("DeclareListParser*" TeX-arg-define-macro "Separator")
+    '("docsvlist" t)
+    '("forcsvlist" 2)
+
+    ;; 3.7.2 Internal Lists
+    '("listadd" TeX-arg-macro t)
+    '("listdadd" TeX-arg-macro t)
+    '("listeadd" TeX-arg-macro t)
+    '("listxadd" TeX-arg-macro t)
+
+    '("listcsadd" LaTeX-arg-etoolbox-csname t)
+    '("listcsgadd" LaTeX-arg-etoolbox-csname t)
+    '("listcseadd" LaTeX-arg-etoolbox-csname t)
+    '("listcsxadd" LaTeX-arg-etoolbox-csname t)
+
+    '("listremove" TeX-arg-macro t)
+    '("listgremove" TeX-arg-macro t)
+    '("listcsremove" LaTeX-arg-etoolbox-csname t)
+    '("listcsgremove" LaTeX-arg-etoolbox-csname t)
+
+    '("dolistlool" TeX-arg-macro)
+    '("dolistcslool" LaTeX-arg-etoolbox-csname)
+
+    '("forlistloop" t TeX-arg-macro)
+    '("forlistcsloop" t LaTeX-arg-etoolbox-csname)
+
+    '("ifinlist" t TeX-arg-macro nil nil)
+    '("xifinlist" t TeX-arg-macro nil nil)
+
+    '("ifinlistcs" t LaTeX-arg-etoolbox-csname nil nil)
+    '("xifinlistcs" t LaTeX-arg-etoolbox-csname nil nil)
+
+    ;; 3.8 Miscellaneous Tools
+    '("rmntonum" "Roman numeral")
+    '("ifrmnum" 3))
+
+   ;; Add the exceptions to `LaTeX-indent-begin-exceptions-list' and
+   ;; run `LaTeX-indent-commands-regexp-make':
+   (let ((exceptions '("ifpatchable"
+                       "ifbool"
+                       "iftoggle"
+                       "ifdef"
+                       "ifcsdef"
+                       "ifundef"
+                       "ifcsundef"
+                       "ifdefmacro"
+                       "ifcsmacro"
+                       "ifdefparam"
+                       "ifcsparam"
+                       "ifdefprefix"
+                       "ifcsprefix"
+                       "ifdefprotected"
+                       "ifcsprotected"
+                       "ifdefltxprotected"
+                       "ifcsltxprotected"
+                       "ifdefempty"
+                       "ifcsempty"
+                       "ifdefvoid"
+                       "ifcsvoid"
+                       "ifdefequal"
+                       "ifcsequal"
+                       "ifdefstring"
+                       "ifcsstring"
+                       "ifdefstrequal"
+                       "ifcsstrequal"
+                       "ifdefcounter"
+                       "ifcscounter"
+                       "ifltxcounter"
+                       "ifdeflength"
+                       "ifcslength"
+                       "ifdefdimen"
+                       "ifcsdimen"
+                       "ifstrequal"
+                       "ifstrempty"
+                       "ifblank"
+                       "ifnumcomp"
+                       "ifnumequal"
+                       "ifnumgreater"
+                       "ifnumless"
+                       "ifnumodd"
+                       "ifdimcomp"
+                       "ifdimequal"
+                       "ifdimgreater"
+                       "ifdimless"
+                       "ifboolexpr"
+                       "ifboolexpe"
+                       "ifinlist"
+                       "ifinlistcs"
+                       "ifrmnum")))
+     (dolist (elt exceptions)
+       (add-to-list 'LaTeX-indent-begin-exceptions-list elt t))
+     (LaTeX-indent-commands-regexp-make))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("newrobustcmd"     "*|{\\[[{")
+                                ("renewrobustcmd"   "*|{\\[[{")
+                                ("providerobustcmd" "*|{\\[[{"))
+                              'function)))
+ TeX-dialect)
+
+(defvar LaTeX-etoolbox-package-options nil
+  "Package options for the etoolbox package.")
+
+;;; etoolbox.el ends here
diff --git a/style/fbox.el b/style/fbox.el
index dc4e211f55..8348dfad6f 100644
--- a/style/fbox.el
+++ b/style/fbox.el
@@ -1,6 +1,6 @@
-;;; fbox.el --- AUCTeX style for `fbox.sty' (v0.04)  -*- lexical-binding: t; 
-*-
+;;; fbox.el --- AUCTeX style for `fbox.sty' (v0.06)  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2019--2020 Free Software Foundation, Inc.
+;; Copyright (C) 2019--2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -26,26 +26,46 @@
 
 ;;; Commentary:
 
-;; This file adds support for `fbox.sty' (v0.04) from 2020/01/03.
+;; This file adds support for `fbox.sty' (v0.06) from 2022/02/20.
 ;; `fbox.sty' is part of TeXLive.
 
 ;;; Code
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
                   "font-latex"
                   (keywords class))
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+
+(defun LaTeX-fbox-key-val-options ()
+  "Return an updated list of key=vals from fbox package."
+  (let ((colors (mapcar #'car (LaTeX-xcolor-definecolor-list)))
+        (lenghts (mapcar (lambda (x)
+                           (concat TeX-esc (car x)))
+                         (LaTeX-length-list))))
+    `(("boxrule" ,lenghts)
+      ("boxsep"  ,lenghts)
+      ("lcolor"  ,colors)
+      ("rcolor"  ,colors)
+      ("bcolor"  ,colors)
+      ("tcolor"  ,colors)
+      ("l")
+      ("r")
+      ("b")
+      ("t"))))
 
 (TeX-add-style-hook
  "fbox"
  (lambda ()
+   (TeX-run-style-hooks "xcolor")
    (TeX-add-symbols
-    '("fbox"     [ "Frame parts (combination of lrtb)" ] t)
-    '("fbox*"    [ "Frame parts (combination of lrtb)" ] t)
-    '("fparbox"  [ "Frame parts (combination of lrtb)" ] t)
-    '("fparbox*" [ "Frame parts (combination of lrtb)" ] t))
+    '("fbox"     [TeX-arg-key-val (LaTeX-fbox-key-val-options)] t)
+    '("fbox*"    [TeX-arg-key-val (LaTeX-fbox-key-val-options)] t)
+    '("fparbox"  [TeX-arg-key-val (LaTeX-fbox-key-val-options)] t)
+    '("fparbox*" [TeX-arg-key-val (LaTeX-fbox-key-val-options)] t))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
@@ -55,4 +75,7 @@
                               'function)))
  TeX-dialect)
 
+(defvar LaTeX-fbox-package-options nil
+  "Package options for the fbox package.")
+
 ;;; fbox.el ends here
diff --git a/style/ltx-base.el b/style/ltx-base.el
index 20b79b639d..d10a1379c7 100644
--- a/style/ltx-base.el
+++ b/style/ltx-base.el
@@ -1,6 +1,6 @@
 ;;; ltx-base.el --- AUCTeX style for basic LaTeX commands.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004, 2016, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2004--2022 Free Software Foundation, Inc.
 
 ;; Author: Frank Küster <frank@kuesterei.ch>
 ;; Maintainer: auctex-devel@gnu.org
@@ -27,62 +27,134 @@
 
 ;; This file adds general support for basic LaTeX commands used for
 ;; writing LaTeX class files (.cls), style files (.sty) and package
-;; files (.dtx).
+;; files (.dtx).  Most of the macros are taken from clsguide.pdf.
 
 ;;; Code:
 
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
 (TeX-add-style-hook
  "ltx-base"
  (lambda ()
    (TeX-add-symbols
-    '("DeclareRobustCommand" TeX-arg-define-macro [ "Number of arguments" ] t)
-    '("CheckCommand" TeX-arg-define-macro [ "Number of arguments" ] t)
-    '("@addtoreset" TeX-arg-counter "Within counter" "counter")
-    '("addvspace" "space")
-    '("addpenalty" "penalty")
-    '("ProvidesClass" "name" [ "release information" ])
-    '("ProvidesPackage" "name" [ "release information" ])
-    '("ProvidesFile" "filename" [ "release information" ])
-    '("NeedsTeXFormat" "format" [ "release" ])
-    '("DeclareOption" "option" t)
-    ;; would be great if DeclareOption RET * RET would give
-    ;; \DeclareOption*!
+
+    ;; 4.1 Identification.  Other '\Provide*' macros are available in
+    ;; latex.el
+    '("NeedsTeXFormat" "Format" [ "Release date" ])
+
+    ;; 4.2 Loading files
+    ;; \RequirePackage is provided in latex.el
+    '("RequirePackageWithOptions" "Package" [ "Release information" ])
+
+    '("LoadClass" [ "Options" ] "Class" [ "Release information" ])
+    '("LoadClassWithOptions"    "Class" [ "Release information" ])
+
+    ;; 4.3 Option declaration
+    '("DeclareOption" "Option" t)
     '("DeclareOption*" t)
+
+    ;; 4.4 Commands within option code
     '("CurrentOption" 0)
-    '("PassOptionsToPackage" "option list" "package")
-    '("ExecuteOptions" "option list")
-    '("ProcessOptions" (TeX-arg-literal "\\relax"))
-    "ProcessOptions*"
     '("OptionNotUsed" 0)
-    ;; candidate for opt/mand toggling
-    '("RequirePackage" [ "option list" ] "package" [ "release" ])
-    '("LoadClass" [ "option list" ] "class" [ "release" ])
+
+    ;; 4.5 Moving options around
+    '("PassOptionsToPackage" "Option(s) list" "Package")
+    '("PassOptionsToClass" "Option(s) list" "Class")
+
+    ;; 4.6 Delaying code
     '("AtEndOfPackage" t)
     '("AtEndOfClass" t)
     '("AtBeginDocument" t)
     '("AtEndDocument" t)
-    '("IfFileExists" "filename" 2)
-    '("InputIfFileExists" "filename" 2)
-    '("PackageWarning" "name" t)
-    '("PackageWarningNoLine" "name" t)
-    '("PackageInfo" "name" t)
-    '("PackageError" "name" "short text" t)
-    '("ClassWarning" "name" t)
-    '("ClassWarningNoLine" "name" t)
-    '("ClassInfo" "name" t)
-    '("ClassError" "name" "short text" t)
+    '("AtBeginDvi" t)
+
+    ;; 4.7 Option processing
+    '("ProcessOptions" (TeX-arg-literal "\\relax"))
+    "ProcessOptions*"
+    '("ExecuteOptions" "Option list")
+
+    ;; 4.8 Safe file commands
+    '("IfFileExists" "File" 2)
+    '("InputIfFileExists" "File" 2)
+
+    ;; 4.9 Reporting errors, etc
+    '("ClassError" "Class name" "Error text" t)
+    '("PackageError" "Package name" "Error text" t)
+
+    '("ClassWarning" "Class name" t)
+    '("PackageWarning" "Package name" t)
+    '("ClassWarningNoLine" "Class name" t)
+    '("PackageWarningNoLine" "Package name" t)
+
+    '("ClassInfo" "Class name" t)
+    '("PackageInfo" "Package name" t)
+
     '("MessageBreak" 0)
-    '("@ifpackageloaded" "package" 2)
-    '("@ifpackagelater" "package" "date" 2)
-    '("@ifpackagewith" "package" "options" 2)
     '("message" "Log Message")
-    '("@ifundefined" "Macro Name" 2)
-    '("@ifnextchar" (TeX-arg-literal " ") (TeX-arg-free "character") 2 )
-    "expandafter"))
+
+    ;; 4.10 Defining commands
+    '("DeclareRobustCommand"
+      TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t)
+    '("DeclareRobustCommand*"
+      TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t)
+
+    '("CheckCommand" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t)
+    '("CheckCommand*" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t)
+
+    ;; 5.1 Layout parameters
+    ;; \paperheight & \paperwidth are provided in latex.el
+
+    ;; 5.2 Case changing
+    ;; \MakeUppercase & \MakeLppercase are provided in latex.el
+
+    ;; 5.4 Better user-defined math display environments
+    "ignorespacesafterend"
+
+    ;; 5.5 Normalising spacing
+    "normalsfcodes"
+
+    ;; Some general macros not mentioned in clsguide.pdf
+    '("@addtoreset" TeX-arg-counter (TeX-arg-counter "Within counter"))
+    '("addpenalty" "Penalty")
+    '("@ifundefined" TeX-arg-macro 2)
+    '("@ifnextchar" (TeX-arg-literal " ") (TeX-arg-free "Character") 2)
+    '("expandafter" 0))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("NeedsTeXFormat"       "{[")
+                                ("RequirePackageWithOptions" "{[")
+                                ("LoadClass"            "[{[")
+                                ("LoadClassWithOptions" "{[")
+                                ;; Don't fontify the second argument
+                                ;; which will contain code:
+                                ("DeclareOption"         "*{")
+                                ("CurrentOption"         "")
+                                ("OptionNotUsed"         "")
+                                ("PassOptionsToPackage"  "{{")
+                                ("PassOptionsToClass"    "{{")
+
+                                ("AtEndOfPackage"  "")
+                                ("AtEndOfClass"    "")
+                                ("AtBeginDocument" "")
+                                ("AtEndDocument"   "")
+                                ("AtBeginDvi"      "")
+
+                                ("ProcessOptions" "*")
+                                ("ExecuteOptions" "{")
+                                ("DeclareRobustCommand" "*|{\\[[{")
+                                ("CheckCommand"         "*|{\\[[{"))
+                              'function)))
  TeX-dialect)
 
 ;; Local Variables:
 ;; coding: utf-8
 ;; End:
+
+;;; ltx-base.el ends here
diff --git a/style/polyglossia.el b/style/polyglossia.el
index 204923b608..cdfb03e093 100644
--- a/style/polyglossia.el
+++ b/style/polyglossia.el
@@ -242,7 +242,7 @@ argument, otherwise as a mandatory one."
     `(,LaTeX-polyglossia-lang-regexp (3 1 2) LaTeX-auto-polyglossia-lang))
    (TeX-auto-add-regexp
     `(,LaTeX-polyglossia-setkeys-regexp (1 2) LaTeX-auto-polyglossia-setkeys))
-   (TeX-run-style-hooks "etoolbox" "makecmds" "xkeyval" "fontspec")
+   (TeX-run-style-hooks "makecmds" "xkeyval" "fontspec")
    (TeX-add-symbols
     '("setdefaultlanguage" (LaTeX-arg-polyglossia-lang  t  nil nil))
     '("setmainlanguage"    (LaTeX-arg-polyglossia-lang  t  nil nil))
diff --git a/style/pstricks.el b/style/pstricks.el
index ec2455004a..6a6707f38c 100644
--- a/style/pstricks.el
+++ b/style/pstricks.el
@@ -1,6 +1,6 @@
 ;;; pstricks.el --- AUCTeX style for the `pstricks' package.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2007-2022  Free Software Foundation, Inc.
 
 ;; Author: Holger Sparr <holger.sparr@gmx.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -784,7 +784,7 @@ comma separated list. Point has to be within the sexp to 
modify."
    (unless (or (member "pst-pdf" TeX-active-styles)
                (eq TeX-engine 'xetex))
      ;; Leave at user's choice whether to disable `TeX-PDF-mode' or
-     ;; not. Instead set up `TeX-PDF-from-DVI' option so that AUCTeX
+     ;; not.  Instead set up `TeX-PDF-from-DVI' option so that AUCTeX
      ;; takes dvips+ps2pdf route when `TeX-PDF-mode' is enabled.
      ;; (TeX-PDF-mode-off)
      (setq TeX-PDF-from-DVI "Dvips"))
diff --git a/tests/latex/doctex-indent-in.dtx b/tests/latex/doctex-indent-in.dtx
new file mode 100644
index 0000000000..4f439588a7
--- /dev/null
+++ b/tests/latex/doctex-indent-in.dtx
@@ -0,0 +1,68 @@
+% \iffalse meta-comment
+%
+%   This file may be distributed and/or modified under the conditions
+%   of the LaTeX Project Public License, either version 1.3 of this
+%   license or (at your option) any later version. The latest version
+%   of this license is in:
+%
+%   http://www.latex-project.org/lppl.txt
+%
+%   and version 1.3 or later is part of all distributions of LaTeX
+%   version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{package}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+\DocInput{package.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \section{Usage}
+%
+%      \DescribeMacro{\YOURMACRO}
+% Put description of |\YOURMACRO| here.
+%
+% \DescribeEnv{YOURENV}
+% Put description of |YOURENV| here.
+%
+% \StopEventually{\PrintIndex}
+%
+% \section{Implementation}
+%
+%      \begin{macro}{\YOURMACRO}
+%               Put explanation of |\YOURMACRO|'s implementation here.
+%                  \begin{macrocode}
+ \newcommand{\YOURMACRO}{%
+  code goes here%
+}
+%    \end{macrocode}
+%             Some more text afterwards.
+%   \end{macro}
+%
+%\begin{environment}{YOURENV}
+%Put explanation of |YOURENV|'s implementation here.
+%\begin{macrocode}
+\newenvironment{YOURENV}{%
+code before environment%
+}{%
+code after environment%
+}
+%\end{macrocode}
+%Some more text afterwards.
+%\end{environment}
+%
+% \Finale
+%
+% \endinput
+% Local Variables:
+% mode: doctex
+% TeX-master: t
+% End:
diff --git a/tests/latex/doctex-indent-out.dtx 
b/tests/latex/doctex-indent-out.dtx
new file mode 100644
index 0000000000..2bdcf40cbe
--- /dev/null
+++ b/tests/latex/doctex-indent-out.dtx
@@ -0,0 +1,68 @@
+% \iffalse meta-comment
+%
+%   This file may be distributed and/or modified under the conditions
+%   of the LaTeX Project Public License, either version 1.3 of this
+%   license or (at your option) any later version. The latest version
+%   of this license is in:
+%
+%   http://www.latex-project.org/lppl.txt
+%
+%   and version 1.3 or later is part of all distributions of LaTeX
+%   version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{package}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+\DocInput{package.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \section{Usage}
+%
+% \DescribeMacro{\YOURMACRO}
+% Put description of |\YOURMACRO| here.
+%
+% \DescribeEnv{YOURENV}
+% Put description of |YOURENV| here.
+%
+% \StopEventually{\PrintIndex}
+%
+% \section{Implementation}
+%
+% \begin{macro}{\YOURMACRO}
+%   Put explanation of |\YOURMACRO|'s implementation here.
+%    \begin{macrocode}
+\newcommand{\YOURMACRO}{%
+  code goes here%
+}
+%    \end{macrocode}
+%   Some more text afterwards.
+% \end{macro}
+%
+% \begin{environment}{YOURENV}
+%   Put explanation of |YOURENV|'s implementation here.
+%    \begin{macrocode}
+\newenvironment{YOURENV}{%
+  code before environment%
+}{%
+  code after environment%
+}
+%    \end{macrocode}
+%   Some more text afterwards.
+% \end{environment}
+%
+% \Finale
+%
+% \endinput
+% Local Variables:
+% mode: doctex
+% TeX-master: t
+% End:
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index d10b98a6e1..d5f267e418 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -54,7 +54,11 @@
  'LaTeX-conditionals-indent/in
  "conditionals-indent-in.tex"
  'LaTeX-conditionals-indent/out
- "conditionals-indent-out.tex")
+ "conditionals-indent-out.tex"
+ 'docTeX/in
+ "doctex-indent-in.dtx"
+ 'docTeX/out
+ "doctex-indent-out.dtx")
 
 ;; Test for detecting \& in a table cell added; see
 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
@@ -672,4 +676,19 @@ check the indentation for optional argument of 
\\usepackage."
              (insert-file-contents LaTeX-conditionals-indent/out)
              (buffer-string)))))
 
+(ert-deftest docTeX-indentation ()
+  "Test if content in docTeX-mode is indented correctly."
+  (should (string=
+           (with-temp-buffer
+             (insert-file-contents docTeX/in)
+             (docTeX-mode)
+             (let ((TeX-parse-self t))
+               (TeX-update-style t)
+               (indent-region (point-min) (point-max))
+               (whitespace-cleanup)
+               (buffer-string)))
+           (with-temp-buffer
+             (insert-file-contents docTeX/out)
+             (buffer-string)))))
+
 ;;; latex-test.el ends here
diff --git a/tex-fold.el b/tex-fold.el
index 54f0a70fd2..6d50f31404 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -62,8 +62,8 @@
 
 (defcustom TeX-fold-type-list '(env macro math)
   "List of item types to consider when folding.
-Valid items are the symbols 'env for environments, 'macro for
-macros, 'math for math macros and 'comment for comments."
+Valid items are the symbols `env' for environments, `macro' for
+macros, `math' for math macros and `comment' for comments."
   :type '(set (const :tag "Environments" env)
               (const :tag "Macros" macro)
               (const :tag "Math Macros" math)
@@ -414,7 +414,7 @@ for macros and 'math for math macros."
 (defun TeX-fold-item (type)
   "Hide the item on which point currently is located.
 TYPE specifies the type of item and can be one of the symbols
-'env for environments, 'macro for macros or 'math for math
+`env' for environments, `macro' for macros or `math' for math
 macros.
 Return non-nil if an item was found and folded, nil otherwise."
   (if (and (eq type 'env)
@@ -508,7 +508,7 @@ Return non-nil if a comment was found and folded, nil 
otherwise."
 (defun TeX-fold-make-overlay (ov-start ov-end type display-string-spec)
   "Make a TeX-fold overlay extending from OV-START to OV-END.
 TYPE is a symbol which is used to describe the content to hide
-and may be 'macro for macros, 'math for math macro and 'env for
+and may be `macro' for macros, `math' for math macro and `env' for
 environments.
 DISPLAY-STRING-SPEC is the original specification of the display
 string in the variables `TeX-fold-macro-spec-list' or
@@ -526,8 +526,8 @@ string in the variables `TeX-fold-macro-spec-list' or
 
 (defun TeX-fold-item-end (start type)
   "Return the end of an item of type TYPE starting at START.
-TYPE can be either 'env for environments, 'macro for macros or
-'math for math macros."
+TYPE can be either `env' for environments, `macro' for macros or
+`math' for math macros."
   (save-excursion
     (cond ((and (eq type 'env)
                 (eq major-mode 'context-mode))
diff --git a/tex-info.el b/tex-info.el
index a05920ddcf..66e57517b8 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -868,7 +868,7 @@ value of `Texinfo-mode-hook'."
   '("\\.cps?" "\\.vrs?" "\\.fns?" "\\.tps?" "\\.pgs?" "\\.kys?")
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
@@ -878,7 +878,7 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\' or $."
     "_toc\\.html" "_fot\\.html" "_abt\\.html" "_[0-9]+\\.html" "_l2h_img.+")
   "List of regexps matching suffixes of files to be deleted.
 The regexps will be anchored at the end of the file name to be matched,
-that is, you do _not_ have to cater for this yourself by adding \\\\' or $."
+that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type '(repeat regexp)
   :group 'TeX-command)
 
diff --git a/tex-site.el.in b/tex-site.el.in
index dda7d22256..e2689bbde4 100644
--- a/tex-site.el.in
+++ b/tex-site.el.in
@@ -38,10 +38,8 @@
 
 ;;; Code:
 
-(when (or (< emacs-major-version 24)
-          (and (= emacs-major-version 24)
-               (< emacs-minor-version 3)))
-  (error "AUCTeX requires Emacs 24.3 or later"))
+(when (< emacs-major-version 25)
+  (error "AUCTeX requires Emacs 25.1 or later"))
 
 (unless (or (fboundp 'TeX-modes-set)     ;Avoid inf-looping.
             (fboundp 'TeX-tex-mode))     ;auctex-autoloads is not loaded.
diff --git a/tex.el b/tex.el
index ca4b8ad35b..747753b319 100644
--- a/tex.el
+++ b/tex.el
@@ -28,10 +28,8 @@
 
 ;;; Code:
 
-(when (or (< emacs-major-version 24)
-          (and (= emacs-major-version 24)
-               (< emacs-minor-version 3)))
-  (error "AUCTeX requires Emacs 24.3 or later"))
+(when (< emacs-major-version 25)
+  (error "AUCTeX requires Emacs 25.1 or later"))
 
 (require 'custom)
 (require 'tex-site)
@@ -270,7 +268,7 @@ expanded.  The expansion is done using the information 
found in
 `TeX-expand-list'.
 
 The third element is the function which actually start the process.
-Several such hooks has been defined:
+Several such hooks have been defined:
 
 TeX-run-command: Start up the process and show the output in a
 separate buffer.  Check that there is not two commands running for the
@@ -725,7 +723,7 @@ Essentially,
 
 is equivalent to
 
-  (if (fboundp 'name) then else...)
+  (if (fboundp \\='name) then else...)
 
 but takes care of byte-compilation issues where the byte-code for
 the latter could signal an error if it has been compiled with
@@ -1784,7 +1782,7 @@ For some users, `x-focus-frame' does the trick.  For some
 users (on GNOME 3.20),
 
   (lambda ()
-    (run-at-time 0.5 nil #'x-focus-frame))
+    (run-at-time 0.5 nil #\\='x-focus-frame))
 
 does the trick.  Some other users use the external wmctrl tool to
 raise the Emacs frame like so:
@@ -1792,7 +1790,7 @@ raise the Emacs frame like so:
   (lambda ()
     (call-process
      \"wmctrl\" nil nil nil \"-i\" \"-R\"
-     (frame-parameter (selected-frame) 'outer-window-id)))"
+     (frame-parameter (selected-frame) \\='outer-window-id)))"
   :type 'function
   :group 'TeX-view)
 
@@ -2267,10 +2265,10 @@ If this variable is nil, AUCTeX will query you for the 
name.
 If the variable is t, AUCTeX will assume the file is a master file
 itself.
 
-If the variable is 'shared, AUCTeX will query for the name, but not
+If the variable is `shared', AUCTeX will query for the name, but not
 change the file.
 
-If the variable is 'dwim, AUCTeX will try to avoid querying by
+If the variable is `dwim', AUCTeX will try to avoid querying by
 attempting to `do what I mean'; and then change the file.
 
 It is suggested that you use the File Variables (see the info node
@@ -3022,7 +3020,7 @@ See variable `TeX-style-hook-dialect' for supported 
dialects."
   :type 'boolean)
 
 (defvar TeX-style-hook-applied-p nil
-  "Nil, unless the style specific hooks have been applied.")
+  "Non-nil means the style specific hooks have been applied.")
  (make-variable-buffer-local 'TeX-style-hook-applied-p)
 
 (defvar TeX-update-style-hook nil
@@ -3719,14 +3717,12 @@ The algorithm is as follows:
                      answer
                    TeX-default-mode))))))
 
-(when (and (boundp 'tex--prettify-symbols-alist)
-           (boundp 'prettify-symbols-compose-predicate))
-  (defun TeX--prettify-symbols-compose-p (start end match)
-    (and (tex--prettify-symbols-compose-p start end match)
-         (not (let ((face (get-text-property end 'face)))
-                (if (consp face)
-                    (memq 'font-latex-verbatim-face face)
-                  (eq face 'font-latex-verbatim-face)))))))
+(defun TeX--prettify-symbols-compose-p (start end match)
+  (and (tex--prettify-symbols-compose-p start end match)
+       (not (let ((face (get-text-property end 'face)))
+              (if (consp face)
+                  (memq 'font-latex-verbatim-face face)
+                (eq face 'font-latex-verbatim-face))))))
 
 (defun VirTeX-common-initialization ()
   "Perform basic initialization."
@@ -3786,13 +3782,10 @@ The algorithm is as follows:
     (TeX-source-correlate-mode 1))
 
   ;; Prettify Symbols mode
-  (when (fboundp 'TeX--prettify-symbols-compose-p)
-    (set (make-local-variable 'prettify-symbols-alist) 
tex--prettify-symbols-alist)
-    (TeX--if-macro-fboundp add-function
-        (add-function :override (local 'prettify-symbols-compose-predicate)
-                      #'TeX--prettify-symbols-compose-p)
-      (set (make-local-variable 'prettify-symbols-compose-predicate)
-           #'TeX--prettify-symbols-compose-p)))
+  (require 'tex-mode)
+  (setq-local prettify-symbols-alist tex--prettify-symbols-alist)
+  (add-function :override (local 'prettify-symbols-compose-predicate)
+                #'TeX--prettify-symbols-compose-p)
 
   ;; Standard Emacs completion-at-point support
   (add-hook 'completion-at-point-functions
@@ -4108,7 +4101,8 @@ If TEX is a directory, generate style files for all files 
in the directory."
                                   LaTeX-verbatim-macros-with-delims-local))
             (verb-macros-braces (when (boundp 
'LaTeX-verbatim-macros-with-braces-local)
                                   LaTeX-verbatim-macros-with-braces-local))
-            (dialect TeX-style-hook-dialect))
+            (dialect TeX-style-hook-dialect)
+            (bibtex-p (eq major-mode 'bibtex-mode)))
         (TeX-unload-style style)
         (with-current-buffer (generate-new-buffer file)
           (erase-buffer)
@@ -4138,7 +4132,21 @@ If TEX is a directory, generate style files for all 
files in the directory."
           (mapc (lambda (el) (TeX-auto-insert el style))
                 TeX-auto-parser)
           (insert ")")
-          (if dialect (insert (concat "\n " (prin1-to-string dialect))))
+          (if dialect (insert (concat
+                               "\n "
+                               (prin1-to-string
+                                (if bibtex-p
+                                    ;; Add :latex since functions such
+                                    ;; as `LaTeX-add-bibitems' are
+                                    ;; only meaningful in LaTeX
+                                    ;; document buffer.
+                                    ;; FIXME: BibTeX is available to
+                                    ;; plain TeX through eplain
+                                    ;; 
(<URL:https://tug.org/eplain/doc/eplain.html#Citations>).
+                                    ;; It would be nice if AUCTeX
+                                    ;; supports such usage.
+                                    `'(or ,dialect :latex)
+                                  dialect)))))
           (insert ")\n\n")
           (write-region (point-min) (point-max) file nil 'silent)
           (kill-buffer (current-buffer))))
@@ -6098,7 +6106,7 @@ valid languages."
   "If non-nil determines behavior of quote insertion.
 It is usually set by language-related style files.  Its value has
 the same structure as the elements of `TeX-quote-language-alist'.
-The symbol 'override can be used as its car in order to override
+The symbol `override' can be used as its car in order to override
 the settings of style files.  Style files should therefore check
 if this symbol is present and not alter `TeX-quote-language' if
 it is.")
@@ -6106,8 +6114,8 @@ it is.")
 
 (defun TeX-insert-quote (force)
   "Insert the appropriate quotation marks for TeX.
-Inserts the value of `TeX-open-quote' (normally ``) or `TeX-close-quote'
-\(normally '') depending on the context.  If `TeX-quote-after-quote'
+Inserts the value of `TeX-open-quote' (normally \\=`\\=`) or `TeX-close-quote'
+\(normally \\='\\=') depending on the context.  If `TeX-quote-after-quote'
 is non-nil, this insertion works only after \".
 With prefix argument FORCE, always inserts \" characters."
   (interactive "*P")
@@ -7043,7 +7051,7 @@ message buffer and start at the first error."
 (defun TeX-previous-error (arg)
   "Find the previous error in the TeX output buffer.
 
-Prefix arg N says how many error messages to move backward (or
+Prefix ARG says how many error messages to move backward (or
 forward, if negative).
 
 This works only with TeX commands and if the
@@ -8044,7 +8052,7 @@ With support for MS-DOS, especially when dviout is used 
with PC-9801 series."
 (defun TeX-run-interactive (name command file)
   "Run TeX interactively.
 Run command in a buffer (in comint-shell-mode) so that it accepts user
-interaction. If you return to the file buffer after the TeX run,
+interaction.  If you return to the file buffer after the TeX run,
 Error parsing on \\[next-error] should work with a bit of luck."
   (TeX-run-set-command name command)
   (require 'comint)
@@ -8775,7 +8783,7 @@ file and `TeX-region-orig-buffer' to access the buffer 
where
 from.")
 
 (defun TeX-quote-filename (file)
-  "Convert file name into a form acceptable to TeX."
+  "Convert file name FILE into a form acceptable to TeX."
   (let (pos)
     (while (setq pos (string-match "\\\\" file pos))
       (setq file (replace-match "/" t t file 0)
diff --git a/toolbar-x.el b/toolbar-x.el
index cdc4b98768..d97035fd8b 100644
--- a/toolbar-x.el
+++ b/toolbar-x.el
@@ -1,6 +1,6 @@
 ;;; toolbar-x.el --- fancy toolbar handling in Emacs  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022  Free Software Foundation, Inc.
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -1553,7 +1553,7 @@ To reproduce the default toolbar with use as BUTTON
 in `toolbarx-install-toolbar':
 
 \(toolbarx-install-toolbar
- '((open-file dired kill-buffer save-buffer write-file undo cut
+ \\='((open-file dired kill-buffer save-buffer write-file undo cut
                copy paste search-forward print-buffer customize help))
  toolbarx-default-toolbar-meaning-alist)
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]