emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex fe15af59d0 76/77: Merge remote-tracking branch '


From: Tassilo Horn
Subject: [elpa] externals/auctex fe15af59d0 76/77: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Fri, 26 Aug 2022 16:06:39 -0400 (EDT)

branch: externals/auctex
commit fe15af59d04fc34cddfdf323d916cf00499ce8fb
Merge: b91f15b3a3 06db9e302b
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 .gitignore                          |   2 +
 Makefile.in                         |  41 +++--
 aclocal.m4                          |   6 +-
 bib-cite.el                         |  11 +-
 configure.ac                        |   5 +-
 context.el                          |  10 +-
 doc/auctex.texi                     |  90 ++++++----
 doc/changes.texi                    |  37 +++++
 doc/preview-latex.texi              |   2 +-
 doc/preview-problems.texi           |  10 ++
 doc/todo.texi                       |  43 ++++-
 doc/wininstall.texi                 |   4 +
 font-latex.el                       |  65 +++++---
 latex.el                            | 289 ++++++++++++++++++++++++--------
 preview.el                          |  70 +++++---
 style/amsmath.el                    |  42 ++++-
 style/bigstrut.el                   |   3 +-
 style/caption.el                    |   6 +-
 style/comment.el                    |   3 +-
 style/cuted.el                      |   3 +-
 style/doc.el                        |   3 -
 style/enumitem.el                   |  26 +--
 style/footmisc.el                   |   1 +
 style/footnotehyper.el              |   3 +-
 style/graphicx.el                   |   6 +-
 style/hyperref.el                   |  49 +++---
 style/{midfloat.el => ifetex.el}    |  28 ++--
 style/ifluatex.el                   |  47 +++---
 style/{midfloat.el => ifpdf.el}     |  28 ++--
 style/iftex.el                      | 189 +++++++++++++++++++++
 style/{midfloat.el => ifvtex.el}    |  28 ++--
 style/{midfloat.el => ifxetex.el}   |  28 ++--
 style/jurabib.el                    |   3 +-
 style/{bigstrut.el => keyval.el}    |  38 ++---
 style/kvoptions.el                  | 113 +++++++++++++
 style/{bigstrut.el => kvsetkeys.el} |  38 ++---
 style/l3doc.el                      |   6 +-
 style/listings.el                   |  21 ++-
 style/longtable.el                  |  11 +-
 style/ltcaption.el                  | 120 ++++++++++++++
 style/ltxdoc.el                     |   2 +-
 style/microtype.el                  | 240 +++++++++++++++++++++++++++
 style/midfloat.el                   |   3 +-
 style/multibib.el                   | 132 +++++++++++++++
 style/multirow.el                   |   3 +-
 style/{midfloat.el => proc.el}      |  34 ++--
 style/scrpage2.el                   |   1 +
 style/shortvrb.el                   |  27 ++-
 style/sidecap.el                    |   2 +-
 style/tcolorboxlib-theorems.el      | 317 ++++++++++++++++++++++++++++++++++++
 style/tikz.el                       |  11 +-
 style/ulem.el                       |  10 +-
 style/xltabular.el                  |  11 +-
 style/xparse.el                     |   5 +-
 tests/latex/doctex-indent-in.dtx    |   6 +
 tests/latex/doctex-indent-out.dtx   |   6 +
 tests/latex/latex-filling-in.tex    |  19 +++
 tests/latex/latex-filling-out.tex   |  21 +++
 tests/latex/latex-test.el           |   8 +-
 tests/tex/error-parsing.el          |   9 +-
 tests/tex/test.tex                  |   1 +
 tex-bar.el                          |   4 +-
 tex-fold.el                         |   4 +-
 tex-info.el                         |   1 -
 tex-ispell.el                       |   5 +
 tex.el                              | 225 ++++++++++++++-----------
 66 files changed, 2102 insertions(+), 533 deletions(-)

diff --git a/.gitignore b/.gitignore
index f625e65b26..77429f1c6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,8 @@ latex/preview-mk.ins
 latex/preview.aux
 latex/preview.drv
 latex/preview.dvi
+latex/preview.hd
+latex/preview.out
 latex/preview.pdf
 latex/preview.sty
 latex/prfootnotes.def
diff --git a/Makefile.in b/Makefile.in
index c1b29c1733..9d97eff36b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52,14 +52,25 @@ PACKAGE=auctex
 PACKAGE_INFO=auctex preview-latex
 EMACS=@EMACS@
 ELCC=$(EMACS) -batch -q -no-site-file -no-init-file -l lpath.el
-AUTOLOAD=--eval '(let ((autoload-file (expand-file-name "$@"))) \
-  (mapcar (lambda (file) \
-            (update-file-autoloads file nil autoload-file)) \
-          command-line-args-left) \
+AUTOLOAD=--eval '\
+(let* ((autoload-file (expand-file-name "$@")) \
+       (autoload-file-dir (file-name-directory autoload-file))) \
+  (if (fboundp (quote loaddefs-generate)) \
+      (loaddefs-generate autoload-file-dir autoload-file \
+                        (list "preview.el" "tex-wizard.el")) \
+    (mapcar (lambda (file) \
+             (update-file-autoloads file nil autoload-file)) \
+           command-line-args-left)) \
   (save-buffers-kill-emacs t))'
 
-PREVIEW_AUTOLOAD=--eval '(let ((autoload-file (expand-file-name "$@"))) \
-  (update-file-autoloads "preview.el" nil autoload-file) \
+PREVIEW_AUTOLOAD=--eval '\
+(let* ((autoload-file (expand-file-name "$@")) \
+       (autoload-file-dir (file-name-directory autoload-file))) \
+  (if (fboundp (quote loaddefs-generate)) \
+      (loaddefs-generate autoload-file-dir autoload-file \
+                        (mapcar (function symbol-name) \
+                                (quote ($(AUCSRC) tex-wizard.el)))) \
+    (update-file-autoloads "preview.el" nil autoload-file)) \
   (save-buffers-kill-emacs t))'
 
 # Files and directories excluded from distributed tar ball.
@@ -179,7 +190,11 @@ 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/etoolbox.el
+          style/ifthen.el    style/etoolbox.el  style/ifetex.el \
+          style/ifpdf.el     style/iftex.el     style/ifvtex.el \
+          style/ifxetex.el   style/multibib.el  style/ltcaption.el \
+          style/keyval.el    style/kvoptions.el style/kvsetkeys.el \
+          style/proc.el      style/microtype.el style/tcolorboxlib-theorems.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
@@ -210,6 +225,7 @@ CLEANFILES = $(AUCELC) $(STYLEELC) $(PREVIEWELC) 
preview-latex.el
 DISTCLEANFILES = Makefile tex-site.el tex-site.el.out auctex.el \
        auto-loads.el config.* preview.el
 DISTTEXTS = FAQ INSTALL INSTALL.windows README TODO PROBLEMS.preview
+DYNVARSFILES = *.dynvars style/*.dynvars auctex-dynvars
 
 NOSEARCH = style/.nosearch
 
@@ -252,6 +268,9 @@ tex-site.el: tex-site.el.out auto-loads.el Makefile
        cat auto-loads.el >>$@
        echo "(provide 'tex-site)" >>$@ ; \
        echo ";;; tex-site.el ends here" >>$@
+       sed -i -e "/^(provide 'auto-loads)/d" \
+              -e '/^;;; auto-loads.el ends here/d' \
+              -e 's/^\(;;; auto-loads.el.*\)\(   -\*- lexical-binding: t 
-\*-\)/\1/' $@
 
 tex-site.el.out: tex-site.el.in Makefile config.status
        ./config.status
@@ -370,11 +389,11 @@ uninstall:
        $(ELCC) -f batch-byte-compile $<
 
 dynvars-check:
-       rm -f $(AUCELC) $(STYLEELC) *.dynvars style/*.dynvars auctex-dynvars
-       EMACS_GENERATE_DYNVARS=1 make some > /dev/null 2>&1
+       rm -f $(AUCELC) $(STYLEELC) $(DYNVARSFILES)
+       EMACS_GENERATE_DYNVARS=1 $(MAKE) some > /dev/null 2>&1
        cat *.dynvars style/*.dynvars > auctex-dynvars
        rm -f $(AUCELC) $(STYLEELC)
-       EMACS_DYNVARS_FILE=auctex-dynvars make some
+       EMACS_DYNVARS_FILE=auctex-dynvars $(MAKE) some
 
 clean: doc/Makefile latex/Makefile
        rm -f $(CLEANFILES)
@@ -389,7 +408,7 @@ distclean: doc/Makefile latex/Makefile
 maintainer-clean: doc/Makefile latex/Makefile
        rm -f $(DISTTEXTS)
        rm -rf autom4te.cache
-       rm -f $(CLEANFILES) $(DISTCLEANFILES)
+       rm -f $(CLEANFILES) $(DISTCLEANFILES) $(DYNVARSFILES)
        cd doc && $(MAKE) maintainer-clean
        cd latex && $(MAKE) distclean
        cd tests && $(MAKE) clean
diff --git a/aclocal.m4 b/aclocal.m4
index 383a5935ab..c6c730547b 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,10 +13,10 @@ dnl assigned from the command line arguments from $5.
 AC_DEFUN(EMACS_LISP, [
   elisp="$2"
   OUTPUT=./conftest-$$
-  echo "${EMACS}" -batch $3 -eval "(let* (patsubst([$4], [\w+], [(\&(pop 
command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x 
(prin1-to-string x)) nil \"${OUTPUT}\"))" $5 >& AC_FD_CC 2>&1
-  "${EMACS}" -batch $3 -eval "(let* (patsubst([$4], [\w+], [(\&(pop 
command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x 
(prin1-to-string x)) nil \"${OUTPUT}\"))" $5 >& AC_FD_CC 2>&1
+  echo "${EMACS}" -batch $3 -eval "(let* (patsubst([$4], [\w+], [(\&(pop 
command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x 
(prin1-to-string x)) nil \"${OUTPUT}\"))" $5 >& AS_MESSAGE_LOG_FD 2>&1
+  "${EMACS}" -batch $3 -eval "(let* (patsubst([$4], [\w+], [(\&(pop 
command-line-args-left))])(x ${elisp})) (write-region (if (stringp x) x 
(prin1-to-string x)) nil \"${OUTPUT}\"))" $5 >& AS_MESSAGE_LOG_FD 2>&1
   $1="`cat ${OUTPUT}`"
-  echo "=> [$]{$1}" >& AC_FD_CC 2>&1
+  echo "=> [$]{$1}" >& AS_MESSAGE_LOG_FD 2>&1
   rm -f ${OUTPUT}
 ])
 
diff --git a/bib-cite.el b/bib-cite.el
index a6405046f5..9c19be370d 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -595,6 +595,7 @@
 ;; Silence the compiler:
 (declare-function reftex-view-crossref "ext:reftex-dcr"
                   (&optional arg auto-how fail-quietly))
+(declare-function outline-show-entry "ext:outline" ())
 
 (defgroup bib-cite nil
   "bib-cite, LaTeX minor-mode to display \\cite, \\ref and \\label commands."
@@ -1429,11 +1430,7 @@ If within a multi-file document (in AUCTeX only)
     (if (bib-Is-hidden)
         (save-excursion
           (beginning-of-line)
-          ;; COMPATIBILITY for emacs<25.
-          (if (fboundp 'outline-show-entry)
-              (outline-show-entry)
-            (with-no-warnings
-              (show-entry)))))))
+          (outline-show-entry)))))
 
 (defvar bib-label-prompt-map
   (let ((map (make-sparse-keymap)))
@@ -1579,9 +1576,9 @@ Does not save excursion."
 (defun create-alist-from-list (the-list)
   "Return a single list from a THE-LIST that may contain either items or lists.
 e.g. turns
-'((\"label3\" \"label4\")(\"label1\" \"label2\") \"label\")
+\\='((\"label3\" \"label4\")(\"label1\" \"label2\") \"label\")
 into
-'((\"label3\") (\"label4\") (\"label1\") (\"label2\") (\"label\"))"
+\\='((\"label3\") (\"label4\") (\"label1\") (\"label2\") (\"label\"))"
   (mapcar #'list (bib-cite-mh-list-to-string the-list)))
 
 ;;
diff --git a/configure.ac b/configure.ac
index fe7616d5a0..81c09653e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl along with AUCTeX; see the file COPYING.  If not, write 
to the Free
 dnl Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 dnl MA 02110-1301, USA.
 
-AC_INIT(auctex,13.1,bug-auctex@gnu.org)
+AC_INIT([auctex],[13.1],[bug-auctex@gnu.org])
 
 AC_CHECK_PROGS_REQUIRED(MAKECMD, make, [make not found, aborting!])
 AC_PROG_MAKE_SET
@@ -268,7 +268,8 @@ AC_SHELL_QUOTIFY(TEXI2HTML)
 AC_SHELL_QUOTIFY(TEXI2DVI)
 AC_SHELL_QUOTIFY(TEXI2PDF)
 
-AC_OUTPUT(Makefile tex-site.el.out:tex-site.el.in doc/Makefile auctex.el 
preview.el latex/Makefile)
+AC_CONFIG_FILES([Makefile tex-site.el.out:tex-site.el.in doc/Makefile 
auctex.el preview.el latex/Makefile])
+AC_OUTPUT
 
 
 cat >&2 <<EOF
diff --git a/context.el b/context.el
index e87feecdb8..50fb1adfee 100644
--- a/context.el
+++ b/context.el
@@ -696,7 +696,7 @@ With optional ARG, modify current environment."
         (ConTeXt-environment-menu environment)))))
 
 (defun ConTeXt-modify-environment (environment)
-  "Modify current environment."
+  "Modify current environment to new ENVIRONMENT."
   (save-excursion
     (ConTeXt-find-matching-stop)
     (re-search-backward (concat (regexp-quote TeX-esc)
@@ -1144,9 +1144,9 @@ An optional fourth (or sixth) element means always 
replace if t."
 (defun ConTeXt-outline-name ()
   "Guess a name for the current header line."
   (save-excursion
-    (if (re-search-forward "{\\([^\}]*\\)}" (point-at-eol) t)
+    (if (re-search-forward "{\\([^}]*\\)}" (line-end-position) t)
         (match-string 1)
-      (buffer-substring-no-properties (point) (point-at-eol)))))
+      (buffer-substring-no-properties (point) (line-end-position)))))
 
 ;; This imenu also includes commented out chapters. Perhaps a feature
 ;; for LaTeX, not sure we want or need that for ConTeXt.
@@ -1774,8 +1774,8 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
 
   (add-hook 'activate-menubar-hook #'ConTeXt-menu-update nil t)
 
-  (setq-local beginning-of-defun-function #'ConTeXt-find-matching-start
-              end-of-defun-function       #'ConTeXt-find-matching-stop)
+  (setq-local beginning-of-defun-function #'ConTeXt-find-matching-start)
+  (setq-local end-of-defun-function       #'ConTeXt-find-matching-stop)
 
   ;; Outline support
   (require 'outline)
diff --git a/doc/auctex.texi b/doc/auctex.texi
index ca23668d1b..fb34568b44 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -974,6 +974,9 @@ environment.
 If this command is called inside a comment and
 @code{LaTeX-syntactic-comments} is enabled, try to find the environment
 in commented regions with the same comment prefix.
+
+The key bind @kbd{C-M-a} actually calls @code{beginning-of-defun}, which
+in turn calls @code{LaTeX-find-matching-begin}.
 @end deffn
 
 @deffn Command LaTeX-find-matching-end
@@ -983,6 +986,9 @@ in commented regions with the same comment prefix.
 If this command is called inside a comment and
 @code{LaTeX-syntactic-comments} is enabled, try to find the environment
 in commented regions with the same comment prefix.
+
+The key bind @kbd{C-M-e} actually calls @code{end-of-defun}, which in turn
+calls @code{LaTeX-find-matching-end}.
 @end deffn
 
 @node Equations
@@ -1089,14 +1095,16 @@ caption.
 @cindex \item
 
 In an itemize-like environment, nodes (i.e., @samp{\item}s) may be
-inserted using @kbd{C-c @key{LFD}}.
+inserted using @kbd{C-c @key{LFD}} or @kbd{M-@key{RET}}.  The latter is
+only defined as an alias if the key binding is still available.
 
 @deffn Command LaTeX-insert-item
-@kindex C-c @key{LFD}
-(@kbd{C-c @key{LFD}}) Close the current item, move to the next line and
-insert an appropriate @samp{\item} for the current environment.  That is,
-`itemize' and `enumerate' will have @samp{\item } inserted, while
-`description' will have @samp{\item[] } inserted.
+@kindex C-c LFD
+@kindex M-RET
+(@kbd{C-c @key{LFD}} or @kbd{M-@key{RET}}) Close the current item, move to
+the next line and insert an appropriate @samp{\item} for the current
+environment.  That is, `itemize' and `enumerate' will have @samp{\item }
+inserted, while `description' will have @samp{\item[] } inserted.
 @end deffn
 
 @defopt TeX-arg-item-label-p
@@ -1128,27 +1136,29 @@ act like the empty string is given, but don't prompt 
for a position.
 @AUCTeX{} calculates the number of columns from the format string and
 inserts the suitable number of ampersands.
 
-You can use @kbd{C-c @key{LFD}} (@code{LaTeX-insert-item}) to terminate
-rows in these environments.  It supplies line break macro @samp{\\} and
-inserts the suitable number of ampersands on the next line.  @AUCTeX{}
-also supports the @samp{*@{num@}@{cols@}} notation (which may contain
-another @samp{*}-expression) in the format string when calculating the
-number of ampersands.  Please note that @samp{num} and @samp{cols} must
-be enclosed in braces; expressions like @samp{*2l} are not recognized
-correctly by the algorithm.
+You can use @kbd{C-c @key{LFD}} or @kbd{M-@key{RET}}
+(@code{LaTeX-insert-item}) to terminate rows in these environments.  It
+supplies line break macro @samp{\\} and inserts the suitable number of
+ampersands on the next line.  @AUCTeX{} also supports the
+@samp{*@{num@}@{cols@}} notation (which may contain another
+@samp{*}-expression) in the format string when calculating the number of
+ampersands.  Please note that @samp{num} and @samp{cols} must be enclosed
+in braces; expressions like @samp{*2l} are not recognized correctly by the
+algorithm.
 
 @deffn Command LaTeX-insert-item
-@kindex C-c @key{LFD}
-(@kbd{C-c @key{LFD}}) Close the current row with @samp{\\}, move to the
-next line and insert an appropriate number of ampersands for the current
-environment.
+@kindex C-c LFD
+@kindex M-RET
+(@kbd{C-c @key{LFD}} or @kbd{M-@key{RET}}) Close the current row with
+@samp{\\}, move to the next line and insert an appropriate number of
+ampersands for the current environment.
 @end deffn
 
 Similar supports are provided for various amsmath environments such as
 @samp{align}, @samp{gather}, @samp{alignat}, @samp{matrix} etc.  Try
-typing @kbd{C-c @key{LFD}} in these environments.  It recognizes the
-current environment and does the appropriate job depending on the
-context.
+typing @kbd{C-c @key{LFD}} or @kbd{M-@key{RET}} in these environments.  It
+recognizes the current environment and does the appropriate job depending
+on the context.
 
 @node Customizing Environments
 @subsection Customizing Environments
@@ -1280,7 +1290,7 @@ as much of the macro, as it unambiguously can.  For 
example, if you type
 environments, etc.  This is controlled by @code{TeX-complete-list}.
 
 @deffn Command TeX-complete-symbol
-@kindex M-@key{TAB}
+@kindex M-TAB
 (@kbd{M-@key{TAB}})  Complete @TeX{} symbol before point.
 @end deffn
 
@@ -1658,13 +1668,13 @@ to indenting with a small summary in each case:
 
 @table @kbd
 @item @key{TAB}
-@kindex @key{TAB}
+@kindex TAB
 @findex LaTeX-indent-line
 @code{LaTeX-indent-line} will indent the current line.
 
 @item @key{LFD}
 @itemx C-j
-@kindex @key{LFD}
+@kindex LFD
 @kindex C-j
 @code{newline-and-indent} inserts a new line (much like @key{RET}) and
 moves the cursor to an appropriate position by the left margin.
@@ -2207,6 +2217,7 @@ your own macros which are listed in the table below.
 
 @vindex font-latex-match-bold-command-keywords
 @vindex font-latex-match-italic-command-keywords
+@vindex font-latex-match-underline-command-keywords
 @vindex font-latex-match-math-command-keywords
 @vindex font-latex-match-type-command-keywords
 @vindex font-latex-match-bold-declaration-keywords
@@ -2219,6 +2230,9 @@ Face: @code{font-latex-bold-face}
 @item font-latex-match-italic-command-keywords
 Keywords for commands specifying an italic font.@*
 Face: @code{font-latex-italic-face}
+@item font-latex-match-underline-command-keywords
+Keywords for commands specifying an underlined text.@*
+Face: @code{font-latex-underline-face}
 @item font-latex-match-math-command-keywords
 Keywords for commands specifying a math font.@*
 Face: @code{font-latex-math-face}
@@ -2247,7 +2261,7 @@ entries are "warning", "variable", "biblatexnoarg", 
"biblatex",
 "reference", "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",
+"underline-command", "math-command", "type-command", "bold-declaration",
 "italic-declaration", "type-declaration".
 
 You can also get rid of certain keywords only.  For example if you want
@@ -4301,7 +4315,7 @@ all files in the document.  This means that you will get 
from each file,
 for example, completion for all labels defined anywhere in the document.
 
 @AUCTeX{} will create the @file{auto} directory automatically if
-@code{TeX-auto-save} is non-nil.  Without it, the files in the document
+@code{TeX-auto-save} is non-@code{nil}.  Without it, the files in the document
 will not know anything about each other, except for the name of the
 master file.  @xref{Automatic Local}.
 
@@ -5076,15 +5090,14 @@ These correspond to the personal @TeX{} macros.
 @cindex Local style directory
 
 @AUCTeX{} can update the style information about a file each time you
-save it, and it will do this if the directory @code{TeX-auto-local}
-exists.  @code{TeX-auto-local} is by default set to @samp{"auto"}, so
-simply creating an @file{auto} directory will enable automatic saving of
-style information.
+save it if @code{TeX-auto-save} option is enabled.  Saved information will
+be stored in the directory @code{TeX-auto-local}, set to @samp{"auto"} by
+default.
 
 The advantage of doing this is that macros, labels, etc.@: defined in any
 file in a multifile document will be known in all the files in the
 document.  The disadvantage is that saving will be slower.  To disable,
-set @code{TeX-auto-local} to nil.
+set @code{TeX-auto-local} to @code{nil}.
 
 @defopt TeX-style-local
 Directory containing hand generated @TeX{} information.
@@ -5098,6 +5111,15 @@ Directory containing automatically generated @TeX{} 
information.
 These correspond to @TeX{} macros found in the current directory.
 @end defopt
 
+@defopt TeX-auto-save-aggregate
+When non-@code{nil}, save parsed information in @file{auto} subdirectory
+of master directory.
+
+Otherwise, save in each @file{auto} subdirectory of the parsed file.
+
+Subdirectory name is actually taken from @code{TeX-auto-local}.
+@end defopt
+
 @node Style Files
 @section Writing Your Own Style Support
 @cindex Style files
@@ -5648,7 +5670,7 @@ an optional argument of the @samp{lstlisting} environment:
 @lisp
 (LaTeX-add-environments
  '("lstlisting" LaTeX-env-args
-   [TeX-arg-key-val LaTeX-listings-key-val-options]))
+   [TeX-arg-key-val (LaTeX-listings-key-val-options)]))
 @end lisp
 @end ftable
 
@@ -5808,6 +5830,7 @@ Which see.
 @cindex @file{macro.tex}
 @cindex @file{macro.el}
 @cindex Changing the parser
+@findex TeX-auto-add-regexp
 
 The automatic @TeX{} information extractor works by searching for
 regular expressions in the @TeX{} files, and storing the matched
@@ -5912,6 +5935,9 @@ List of functions to be called before parsing a @TeX{} 
file.
 List of functions to be called after parsing a @TeX{} file.
 @end defvar
 
+@c FIXME: Write a @defun for `TeX-auto-add-regexp' here.  Then we can omit
+@c its @findex below the subsection heading.
+
 @node Appendices
 @appendix Copying, Changes, Development, FAQ, Texinfo Mode
 
diff --git a/doc/changes.texi b/doc/changes.texi
index b8c70ba33e..debfec688b 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -11,6 +11,21 @@
 @heading News since last release
 
 @itemize @bullet
+@item
+@AUCTeX{} underlines the argument of macros which produce underlined text
+in the final product with @code{font-latex-underline-face}.  The
+corresponding keyword class is called @code{underline-command}.
+@ifset rawfile
+See the section for fontification of macros
+@end ifset
+@ifclear rawfile
+@xref{Fontification of macros}
+@end ifclear
+if you dislike this feature and wish to deactivate it.
+
+@item
+Support for the Sioyek document viewer is added.
+
 @item
 @AUCTeX{} now requires GNU Emacs 25.1 or higher.
 
@@ -62,6 +77,26 @@ Replace it with @code{(require 'tex)}.
 Replace it with @code{(require 'latex)}.
 @end enumerate
 
+@item
+When you edit a document divided into multiple files, auto parsed
+information for all sub files are saved under @file{auto} subdirectory at
+master directory when @code{TeX-parse-self} and @code{TeX-auto-save}
+options are enabled.  Now you can have support @file{.el} file saved under
+@file{auto} subdirectory of each directory of the sub file when the sub
+files aren't located at the master directory.
+
+To achieve that, set new user option @code{TeX-auto-save-aggregate} to
+@code{nil}.
+
+@item
+There was another hook where former dynamic free variables could be used.
+The usage was invalidated at version 13.1, by introduction of lexical
+binding over @AUCTeX{}.
+
+The functions in @code{TeX-region-hook} could access the free variables
+@code{master-buffer} and @code{orig-buffer}.  Those are now named
+@code{TeX-region-master-buffer} and @code{TeX-region-orig-buffer},
+respectively.
 @end itemize
 
 @heading News in 13.1
@@ -1111,8 +1146,10 @@ inserted by typing @key{"}.
 Completion support for options of some @LaTeX{} packages was added.
 
 @item
+@ifclear rawfile
 @cindex @file{auctex.el}
 @cindex @file{tex-site.el}
+@end ifclear
 Already in version 11.81 the way to activate @AUCTeX{} changed
 substantially.  This should now be done with @code{(load "auctex.el" nil
 t t)} instead of the former @code{(require 'tex-site)}.  Related to this
diff --git a/doc/preview-latex.texi b/doc/preview-latex.texi
index 26adb89916..4aba7cb5e5 100644
--- a/doc/preview-latex.texi
+++ b/doc/preview-latex.texi
@@ -330,7 +330,7 @@ info manual.
 @item @kbd{M-x preview-report-bug @key{RET}}
 @itemx @code{preview-report-bug}
 @itemx Preview/Report Bug
-@kindex @kbd{M-x preview-report-bug @key{RET}}
+@kindex @kbd{M-x preview-report-bug RET}
 @findex preview-report-bug
 @cindex Report a bug
 This is the preferred way of reporting bugs as it will fill in what
diff --git a/doc/preview-problems.texi b/doc/preview-problems.texi
index e40ff42d1d..0f1518bfa5 100644
--- a/doc/preview-problems.texi
+++ b/doc/preview-problems.texi
@@ -20,6 +20,7 @@ newer versions of the problematic software or by simple 
patches.
 * x-symbol interoperation::     
 * Middle-clicks paste instead of toggling::  
 * No images are displayed with gs 9.27 and earlier::
+* Black texts are too hard to read on dark background::
 @end menu
 
 If you find something not mentioned here, please send a bug report using
@@ -194,3 +195,12 @@ well.
 The default value used to be @code{compatible} for short period before
 Ghostscript 9.50 was released but now is @code{t}.
 @end defopt
+
+@node Black texts are too hard to read on dark background
+@section Black texts are too hard to read on dark background
+Unfortunately, foreground color adjustment discussed in the previous node
+doesn't work for Xe@LaTeX{} for technical reason.  The texts are always
+rendered as black in the preview images, so it's almost impossible to read
+them on dark background.  Hence Xe@LaTeX{} users who like dark background
+in Emacs frame should customize @code{preview-pdf-adjust-color-method} to
+@code{nil}.
diff --git a/doc/todo.texi b/doc/todo.texi
index 218231d0bd..6819ce1718 100644
--- a/doc/todo.texi
+++ b/doc/todo.texi
@@ -73,17 +73,52 @@ buffer-local variables.
 As of @AUCTeX{} 12.3, @code{TeX-remove-style} is no longer used by any
 other codes.
 
+@item Factor out syntax propertization from @file{font-latex.el}
+
+Syntax propertization is implemented in @file{font-latex.el}.  This means
+that features which depend on syntax parse don't work well for
+@file{tex-font.el} users and those who disable font lock.
+
+Hence syntax propertization should be factored out from
+@file{font-latex.el} and implemented as a major mode facility.
+
+(Texinfo mode is an exception because it already has its own syntax
+propertize function, which just copies the one available in Emacs built-in
+texinfo mode.)
+
+@item Add documentation
+
+Following entries should be included in the document:
+@itemize @minus
 @item
-Document @code{LaTeX-insert-into-commments},
-@code{TeX-translate-location-hook}, and usage of @ConTeXt{} mode.
+Variables @code{LaTeX-insert-into-comments}, @code{TeX-translate-location-hook}
+
+@item
+How to use @code{TeX-auto-add-type}, as well as functions and variables
+generated by that macro.
+@ifclear rawfile
+They should be covered in the node @ref{Hacking the Parser}.
+@end ifclear
+
+@item
+Usage of @ConTeXt{} mode
+@end itemize
+
 @end itemize
 
 @node Wishlist
 @section Wishlist
 
 @itemize @bullet
-@item
-Simplify tool bar implementation.  The library @file{toolbar-x.el} was
+@item Enable syntactic font lock for verbatim constructs in @samp{docTeX}
+mode
+
+In @samp{docTeX} mode buffer, @samp{%} sign at the line beginning hinders
+syntactic font lock of verbatim constructs.  This should be improved.
+
+@item Simplify tool bar implementation
+
+The library @file{toolbar-x.el} was
 developed as an abstraction layer to absorb difference between XEmacs
 and @acronym{GNU} Emacs.  Now that XEmacs is no longer supported, the
 library, together with @file{tex-bar.el} as a whole, can be much
diff --git a/doc/wininstall.texi b/doc/wininstall.texi
index 230f8e22e7..1c812d4d55 100644
--- a/doc/wininstall.texi
+++ b/doc/wininstall.texi
@@ -47,8 +47,10 @@ containing the programs to the @env{PATH} environment 
variable if
 necessary.  Here is how to do that in W2000/XP:
 
 @enumerate
+@ifclear rawfile
 @cindex Adding to @env{PATH} in Windows
 @cindex @env{PATH} in Windows
+@end ifclear
 @item
 On the desktop, right click ``My Computer'' and select properties.
 @item
@@ -303,7 +305,9 @@ in either a site-wide @file{site-start.el} or your personal 
startup file
 (usually accessible as @file{~/.emacs} or @file{~/.emacs.d/init.el} from
 within Emacs).
 
+@ifclear rawfile
 @cindex @file{tex-mik.el}
+@end ifclear
 The default configuration of @AUCTeX{} is probably not the best fit for
 Windows systems with MiK@TeX{}.  You might want to add
 @lisp
diff --git a/font-latex.el b/font-latex.el
index c49a698754..4406dea610 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -77,7 +77,7 @@ 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'
+\\='(\"\\\"<\" \"\\\">\" french) is given but `font-latex-quotes'
 specifies `german', quotes will be used like \">foo\"< for
 fontification.")
 
@@ -362,9 +362,10 @@ variable `font-latex-fontify-sectioning'." ',num)
       ("qbezier" "[(((") ("raisebox" "{[[{")
       ("addvspace" "{") ("vspace" "*{") ("hspace" "*{")
       ("addcontentsline" "{{{") ("addtocontents" "{{")
-      ("labelformat" "{{")
+      ("labelformat" "{{") ("linespread" "{")
       ("AddToHook" "{[{") ("RemoveFromHook" "{[") ("AddToHookNext" "{{")
       ("ProvidesClass" "{[") ("ProvidesPackage" "{[") ("ProvidesFile" "{[")
+      ("NewMarkClass" "{")
       ;; XXX: Should macros without arguments rather be listed in a
       ;; separate category with 'noarg instead of 'command handling?
       ("enspace" "") ("enskip" "") ("quad" "") ("qquad" "") ("nonumber" "")
@@ -373,9 +374,11 @@ variable `font-latex-fontify-sectioning'." ',num)
       ("thicklines" "") ("thinlines" "")
       ("noindent" "") ("hline" "") ("ldots" "")
       ("centering" "") ("raggedright" "") ("raggedleft" "")
+      ("raggedbottom" "") ("flushbottom" "")
       ("TeX" "") ("LaTeX" "") ("LaTeXe" "")
       ("normalfont" "") ("normalshape" "")
-      ("tableofcontents" "") ("listoffigures" "") ("listoftables" ""))
+      ("tableofcontents" "") ("listoffigures" "") ("listoftables" "")
+      ("maketitle" ""))
      font-lock-function-name-face 2 command)
     ("sectioning-0"
      (("part" "*[{"))
@@ -428,6 +431,9 @@ variable `font-latex-fontify-sectioning'." ',num)
     ("italic-command"
      (("emph" "{") ("textit" "{") ("textsl" "{") ("mathit" "{"))
      font-latex-italic-face 1 command)
+    ("underline-command"
+     (("underline" "{"))
+     font-latex-underline-face 1 command)
     ("math-command"
      (("ensuremath" "|{\\"))
      font-latex-math-face 1 command)
@@ -478,9 +484,9 @@ Valid entries are \"warning\", \"variable\", 
\"biblatexnoarg\",
 \"biblatex\", \"reference\", \"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\",
-\"type-declaration\".
+\"bold-command\", \"italic-command\", \"underline-command\",
+\"math-command\", \"type-command\", \"bold-declaration\",
+\"italic-declaration\", \"type-declaration\".
 
 You have to restart Emacs for a change of this variable to take effect."
   :group 'font-latex-keywords
@@ -642,10 +648,10 @@ Generated by `font-latex-make-built-in-keywords'."))
       ;; defvar font-latex-match-*
       ;; We make this variable buffer local later, but don't use
       ;; `defvar-local' here because it shouldn't have nil as its
-      ;; default value.  Its true default value is set by
-      ;; through font-latex-match-*-make in :set specification of
-      ;; defcustom of font-latex-match-*-keywords below.  It's
-      ;; only after that this variable can be buffer local.
+      ;; default value.  Its true default value is set through
+      ;; font-latex-match-*-make in :set specification of defcustom of
+      ;; font-latex-match-*-keywords below.  It's only after that this
+      ;; variable can be buffer local.
       (push `(defvar ,(intern (concat prefix name)) nil
                ,(concat "Regular expression to match " name
                         " keywords.
@@ -910,8 +916,8 @@ 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'.
+`underline-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
@@ -1140,6 +1146,20 @@ have changed."
   "Face used to highlight text to be typeset in italic."
   :group 'font-latex-highlighting-faces)
 
+(defface font-latex-underline-face
+  (let ((font '(:inherit underline)))
+    `((((class grayscale) (background light))
+       (:foreground "DimGray" ,@font))
+      (((class grayscale) (background dark))
+       (:foreground "LightGray" ,@font))
+      (((class color) (background light))
+       (:foreground "DarkOliveGreen" ,@font))
+      (((class color) (background dark))
+       (:foreground "OliveDrab" ,@font))
+      (t (,@font))))
+  "Face used to highlight text to be underlined."
+  :group 'font-latex-highlighting-faces)
+
 (defface font-latex-math-face
   (let ((font '(:inherit underline)))
     `((((class grayscale) (background light))
@@ -1347,7 +1367,7 @@ then call `font-latex-set-syntactic-keywords'.")))
 
 (defvar font-latex--updated-region-end nil
 ;; During font lock operation, matched range sometimes exceeds the
-;; given end limit. So record the actual end in this variable to
+;; given end limit.  So record the actual end in this variable to
 ;; notify the font lock machinery.
 ;; Match functions should do the following two if the end of the
 ;; actual match goes beyond the limit:
@@ -1364,11 +1384,8 @@ then call `font-latex-set-syntactic-keywords'.")))
 Take care when the actually fonfified region was extended beyond END."
   (setq font-latex--updated-region-end end)
   (let ((res (font-lock-default-fontify-region beg end verbose)))
-    ;; COMPATIBILITY for older emacsen. Return value for jit-lock
-    ;; is meaningful for only newer emacsen.
-    (if (eq (car-safe res) 'jit-lock-bounds)
-        `(jit-lock-bounds ,(cadr res) .
-                          ,(max (cddr res) font-latex--updated-region-end)))))
+    `(jit-lock-bounds ,(cadr res) .
+                      ,(max (cddr res) font-latex--updated-region-end))))
 
 ;; Copy and adaption of `tex-font-lock-unfontify-region' from
 ;; tex-mode.el in GNU Emacs on 2004-08-04.
@@ -1419,6 +1436,8 @@ ignored during the search."
         ;; XXX: Do not look up syntax-table properties since they may
         ;; be misleading, e.g. in the case of "{foo}^^A" where the
         ;; closing brace gets a comment end syntax.
+        ;; (2022 Mar) The latter half of the above paragraph no longer
+        ;; applies since we changed the way to fontify ^^A comment.
         (parse-sexp-lookup-properties nil))
     (or
      (condition-case nil
@@ -1873,8 +1892,8 @@ The \\begin{equation} incl. arguments in the same line and
         (setq end beg
               beg-of-begin beg))
       ;; Store the position of "\begin{foo}" as (match-beginnig 0) so
-      ;; that `font-lock-multiline' text property covers it. This keeps
-      ;; editing inside multi-line optional argument sane.
+      ;; that `font-lock-multiline' text property covers it.  This
+      ;; keeps editing inside multi-line optional argument sane.
       (store-match-data (list beg-of-begin end beg end))
       t)))
 
@@ -1964,11 +1983,11 @@ Take into account $...$, $$...$$, \\(...\\) and 
\\=\\[...\\], too."
   ;; Check if `font-lock-beg' is inside math mode.
   (goto-char font-lock-beg)
 
-  ;; Workaround bug#41522. Ensure `syntax-table' property is given to
+  ;; Workaround bug#41522.  Ensure `syntax-table' property is given to
   ;; all verbatim-like constructs up to the position before running
   ;; `texmathp' in order to prevent wrong fontification of verbatim
-  ;; face. This is necessary because `texmathp' calls `up-list' inside
-  ;; narrowing.
+  ;; face.  This is necessary because `texmathp' calls `up-list'
+  ;; inside narrowing.
   (syntax-propertize (point))
 
   ;; XXX: Should we make the `texmathp' search honor
diff --git a/latex.el b/latex.el
index 5747449c5a..59ba9cbfc6 100644
--- a/latex.el
+++ b/latex.el
@@ -52,7 +52,6 @@
 
 ;; Silence the compiler for variables:
 (defvar outline-heading-alist)
-(defvar TeX-auto-file)
 (defvar LaTeX-section-list-changed)
 
 ;;; Syntax
@@ -858,7 +857,7 @@ position just before \\begin and the position just before
 \\end.")
 
 (defun LaTeX-modify-environment (environment)
-  "Modify current ENVIRONMENT."
+  "Modify current environment to new ENVIRONMENT."
   (let ((goto-end (lambda ()
                     (LaTeX-find-matching-end)
                     (re-search-backward (concat (regexp-quote TeX-esc)
@@ -1779,18 +1778,18 @@ This is necessary since index entries may contain 
commands and stuff.")
        ("\\\\newenvironment\\*?{\\([^}]+\\)}"
         1 LaTeX-auto-environment)
        (,(concat "\\\\newtheorem{\\(" token "+\\)}") 1 LaTeX-auto-environment)
-       ("\\\\input{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}"
+       ("\\\\input{\"?\\([^#}%\"\\\n\r]+?\\)\\(?:\\.[^#}%/\"\\.\n\r]+\\)?\"?}"
         1 TeX-auto-file)
-       ("\\\\include{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}"
+       ("\\\\include{\\(\\.*[^#}%\\.\n\r]+\\)\\(\\.[^#}%\\.\n\r]+\\)?}"
         1 TeX-auto-file)
        (,(concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}")
         1 LaTeX-auto-bibitem)
        (,(concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, 
\n\r\t%\"#'()={}]*\\)}")
         1 LaTeX-auto-bibitem)
-       ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography)
-       ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r]+\\)\\..+}"
+       ("\\\\bibliography{\\([^#}\\\n\r]+\\)}" 1 LaTeX-auto-bibliography)
+       ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\n\r]+\\)\\..+}"
         1 LaTeX-auto-bibliography)
-       
("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\(?:\\..+\\)?}"
 1 LaTeX-auto-bibliography)
+       
("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\n\r.]+\\)\\(?:\\..+\\)?}"
 1 LaTeX-auto-bibliography)
        ("\\\\newrefsection\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)
        ("\\\\begin{refsection}\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)))
    LaTeX-auto-class-regexp-list
@@ -2142,10 +2141,7 @@ confirmation before proceeding."
                   (assoc label (LaTeX-label-list)))
              (ding)
              (when (y-or-n-p
-                    ;; Emacs 24 compatibility
-                    (if (fboundp 'format-message)
-                        (format-message "Label `%s' exists. Use anyway? " 
label)
-                      (format "Label `%s' exists. Use anyway? " label)))
+                    (format-message "Label `%s' exists. Use anyway? " label))
                (setq valid t)))
             (t
              (setq valid t))))
@@ -3239,9 +3235,9 @@ returning an alist.  Use PROMPT as the prompt string."
          ((and (listp key-val-alist)
                (symbolp (car key-val-alist))
                (fboundp (car key-val-alist)))
-          (let ((head (car key-val-alist))
-                (tail (cdr key-val-alist)))
-            (apply head tail)))
+          (if (> (length key-val-alist) 1)
+              (eval key-val-alist t)
+            (funcall (car key-val-alist))))
          (t
           key-val-alist))))
 
@@ -3251,10 +3247,139 @@ Insert the given value as a TeX macro argument.  If 
OPTIONAL is
 non-nil, insert it as an optional argument.  KEY-VAL-ALIST is an
 alist.  The car of each element should be a string representing a
 key and the optional cdr should be a list with strings to be used
-as values for the key.  Use PROMPT as the prompt string."
+as values for the key.  KEY-VAL-ALIST can be a symbol or a
+function call returning an alist.  Use PROMPT as the prompt
+string."
   (let ((options (TeX-read-key-val optional key-val-alist prompt)))
     (TeX-argument-insert options optional)))
 
+(defun TeX-read-completing-read (optional collection &optional prompt complete
+                                          predicate require-match
+                                          initial-input hist def
+                                          inherit-input-method)
+  "Read a string in the minibuffer, with completion and return it.
+If OPTIONAL is non-nil, indicate it in the prompt.
+
+COLLECTION provides elements for completion and is passed to
+`completing-read'.  It can be:
+  - A List or an alist
+  - A symbol returning a list
+  - A function call
+
+PROMPT replaces the standard one where \\=' (cr): \\=' is appended to
+it.  If you want the full control over the prompt, set COMPLETE
+to non-nil and then provide a full PROMPT.
+
+PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
+INHERIT-INPUT-METHOD are passed to `completing-read', which see."
+  (completing-read
+   (TeX-argument-prompt optional
+                        (cond ((and prompt (not complete))
+                               (concat prompt " (cr)"))
+                              ((and prompt complete)
+                               prompt)
+                              (t "Option (cr)"))
+                        complete)
+   (cond ((and (symbolp collection)
+               (boundp collection))
+          (symbol-value collection))
+         ((and (listp collection)
+               (symbolp (car collection))
+               (fboundp (car collection)))
+          (if (> (length collection) 1)
+              (eval collection t)
+            (funcall (car collection))))
+         (t collection))
+   predicate require-match initial-input hist def inherit-input-method))
+
+(defun TeX-arg-completing-read (optional collection &optional prompt complete
+                                         prefix leftbrace rightbrace
+                                         predicate require-match
+                                         initial-input hist def
+                                         inherit-input-method)
+  "Read a string in the minibuffer, with completion and insert it.
+If OPTIONAL is non-nil, indicate it in the minibuffer and insert
+the result in brackets if not empty.  The brackets used are
+controlled by the string values of LEFTBRACE and RIGHTBRACE.
+
+For PROMPT and COMPLETE, refer to `TeX-read-completing-read'.
+For PREFIX, see `TeX-argument-insert'.
+PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
+INHERIT-INPUT-METHOD are passed to `completing-read', which see."
+  (let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
+        (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace)))
+    (TeX-argument-insert
+     (TeX-read-completing-read optional collection prompt complete
+                               predicate require-match initial-input
+                               hist def inherit-input-method)
+     optional prefix)))
+
+(defun TeX-read-completing-read-multiple (optional table &optional prompt 
complete
+                                                   predicate require-match
+                                                   initial-input hist def
+                                                   inherit-input-method)
+  "Read multiple strings in the minibuffer, with completion and return them.
+If OPTIONAL is non-nil, indicate it in the prompt.
+
+COLLECTION provides elements for completion and is passed to
+`completing-read'.  It can be:
+  - A List or an alist
+  - A symbol returning a list
+  - A function call
+
+PROMPT replaces the standard one where \\=' (crm): \\=' is appended to
+it.  If you want the full control over the prompt, set COMPLETE
+to non-nil and then provide a full PROMPT.
+
+PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
+INHERIT-INPUT-METHOD are passed to
+`TeX-completing-read-multiple', which see."
+  (TeX-completing-read-multiple
+   (TeX-argument-prompt optional
+                        (cond ((and prompt (not complete))
+                               (concat prompt " (crm)"))
+                              ((and prompt complete)
+                               prompt)
+                              (t "Options (crm)"))
+                        complete)
+   (cond ((and (symbolp table)
+               (boundp table))
+          (symbol-value table))
+         ((and (listp table)
+               (symbolp (car table))
+               (fboundp (car table)))
+          (if (> (length table) 1)
+              (eval table t)
+            (funcall (car table))))
+         (t table))
+   predicate require-match initial-input hist def inherit-input-method))
+
+(defun TeX-arg-completing-read-multiple (optional table &optional prompt 
complete
+                                                  prefix leftbrace rightbrace
+                                                  predicate require-match
+                                                  initial-input hist def
+                                                  inherit-input-method)
+  "Read multiple strings in the minibuffer, with completion and insert them.
+If OPTIONAL is non-nil, indicate it in the minibuffer and insert
+the result in brackets if not empty.  The brackets used are
+controlled by the string values of LEFTBRACE and RIGHTBRACE.
+
+For PROMPT and COMPLETE, refer to `TeX-read-completing-read-multiple'.
+For PREFIX, see `TeX-argument-insert'.
+PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
+INHERIT-INPUT-METHOD are passed to
+`TeX-completing-read-multiple', which see."
+  (let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
+        (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace)))
+    (TeX-argument-insert
+     (mapconcat #'identity
+                (TeX-read-completing-read-multiple optional table prompt
+                                                   complete predicate
+                                                   require-match initial-input
+                                                   hist def 
inherit-input-method)
+                ",")
+     optional prefix)))
+
 (defun TeX-read-hook ()
   "Read a LaTeX hook and return it as a string."
   (let* ((hook (completing-read
@@ -3271,7 +3396,9 @@ as values for the key.  Use PROMPT as the prompt string."
                   ;; From ltshipout-doc.pdf
                   "shipout"
                   ;; From ltpara-doc.pdf
-                  "para")))
+                  "para"
+                  ;; From ltmarks-doc.pdf
+                  "insertmark")))
          (place (lambda (&optional opt pr)
                   (completing-read
                    (TeX-argument-prompt opt pr "Where")
@@ -3588,8 +3715,9 @@ non-parenthetical delimiters, like \\verb+foo+, are 
recognized."
   "Return non-nil if position POS is in a verbatim-like construct."
   (when pos (goto-char pos))
   (save-match-data
-    (or (when (fboundp 'font-latex-faces-present-p)
-          (font-latex-faces-present-p 'font-latex-verbatim-face))
+    (or (progn
+          (syntax-propertize (point))
+          (nth 3 (syntax-ppss)))
         (member (LaTeX-current-verbatim-macro)
                 (LaTeX-verbatim-macros-with-delims))
         (member (TeX-current-macro) (LaTeX-verbatim-macros-with-braces))
@@ -3784,7 +3912,10 @@ value."
      4 t)
     (,(concat (regexp-quote TeX-esc)
               "\\(begin\\|end\\)[ \t]*{\\(macro\\|environment\\)\\*?}")
-     0 nil))
+     0 nil)
+    (,(concat (regexp-quote TeX-esc)
+              "\\(begin\\|end\\)[ \t]*{verbatim\\*?}")
+     0 t))
   "List of items which should have a fixed inner indentation.
 The items consist of three parts.  The first is a regular
 expression which should match the respective string.  The second
@@ -3805,10 +3936,10 @@ should add their macros to this variable and then run
 (defvar-local LaTeX-indent-begin-exceptions-list nil
   "List of macros which shouldn't increase the indentation.
 Each item in this list is a string without a backslash and will
-mostly start with 'if'.  These macros should not increase
-indentation although they start with 'if', for example the
-'ifthenelse' macro provided by the ifthen package.  AUCTeX styles
-should add their macros to this variable and then run
+mostly start with \"if\".  These macros should not increase
+indentation although they start with \"if\", for example the
+\"ifthenelse\" macro provided by the ifthen package.  AUCTeX
+styles should add their macros to this variable and then run
 `LaTeX-indent-commands-regexp-make'.")
 
 (defvar-local LaTeX-indent-mid-list nil
@@ -3894,7 +4025,7 @@ macros are added to the regexp's.  This function is 
called in
              'LaTeX-indent-end-regexp-local)
     (funcall func
              LaTeX-indent-begin-exceptions-list
-             "ifthenelse\\b"
+             "ifthenelse\\b\\|iff\\b"
              'LaTeX-indent-begin-regexp-exceptions-local)))
 
 (defun LaTeX-indent-line ()
@@ -3916,13 +4047,18 @@ Lines starting with an item is given an extra 
indentation of
                  (concat (match-string 0) (TeX-comment-padding-string))))))
     (save-excursion
       (cond ((and fill-prefix
-                  (TeX-in-line-comment)
-                  (eq major-mode 'doctex-mode))
+                  (eq major-mode 'doctex-mode)
+                  (TeX-in-line-comment))
              ;; If point is in a line comment in `doctex-mode' we only
-             ;; consider the inner indentation.
-             (let ((inner-indent (LaTeX-indent-calculate 'inner)))
-               (when (/= (LaTeX-current-indentation 'inner) inner-indent)
-                 (LaTeX-indent-inner-do inner-indent))))
+             ;; consider the inner indentation.  An exception is when
+             ;; we're inside a verbatim environment where we don't
+             ;; want to touch the indentation, notably with a
+             ;; fill-prefix "% ":
+             (unless (member (LaTeX-current-environment)
+                             (LaTeX-verbatim-environments))
+               (let ((inner-indent (LaTeX-indent-calculate 'inner)))
+                 (when (/= (LaTeX-current-indentation 'inner) inner-indent)
+                   (LaTeX-indent-inner-do inner-indent)))))
             ((and fill-prefix
                   LaTeX-syntactic-comments)
              ;; In any other case of a comment we have to consider
@@ -3931,16 +4067,16 @@ Lines starting with an item is given an extra 
indentation of
              (let ((inner-indent (LaTeX-indent-calculate 'inner))
                    (outer-indent (LaTeX-indent-calculate 'outer)))
                (when (/= (LaTeX-current-indentation 'inner) inner-indent)
-                   (LaTeX-indent-inner-do inner-indent))
+                 (LaTeX-indent-inner-do inner-indent))
                (when (/= (LaTeX-current-indentation 'outer) outer-indent)
-                   (LaTeX-indent-outer-do outer-indent))))
+                 (LaTeX-indent-outer-do outer-indent))))
             (t
              ;; The default is to adapt whitespace before any
              ;; non-whitespace character, i.e. to do outer
              ;; indentation.
              (let ((outer-indent (LaTeX-indent-calculate 'outer)))
                (when (/= (LaTeX-current-indentation 'outer) outer-indent)
-                   (LaTeX-indent-outer-do outer-indent))))))
+                 (LaTeX-indent-outer-do outer-indent))))))
     (when (< (current-column) (save-excursion
                                 (LaTeX-back-to-indentation) (current-column)))
       (LaTeX-back-to-indentation))))
@@ -4627,7 +4763,8 @@ space does not end a sentence, so don't break a line 
there."
       fill-prefix)))
 
 (defun LaTeX-fill-move-to-break-point (linebeg)
-  "Move to the position where the line should be broken."
+  "Move to the position where the line should be broken.
+See `fill-move-to-break-point' for the meaning of LINEBEG."
   (fill-move-to-break-point linebeg)
   ;; Prevent line break between 2-byte char and 1-byte char.
   (when (and (or (and (not (looking-at LaTeX-nospace-between-char-regexp))
@@ -4652,40 +4789,6 @@ space does not end a sentence, so don't break a line 
there."
                                       (1- (- (point) linebeg)))
              (not (TeX-escaped-p (match-beginning 0))))
     (goto-char (match-beginning 0)))
-  ;; Cater for \verb|...| (and similar) contructs which should not be
-  ;; broken. (FIXME: Make it work with shortvrb.sty (also loaded by
-  ;; doc.sty) where |...| is allowed.  Arbitrary delimiters may be
-  ;; chosen with \MakeShortVerb{<char>}.)  This could probably be
-  ;; handled with `fill-nobreak-predicate', but this is not available
-  ;; in XEmacs.
-  (let ((final-breakpoint (point))
-        (verb-macros (regexp-opt (append (LaTeX-verbatim-macros-with-delims)
-                                         
(LaTeX-verbatim-macros-with-braces)))))
-    (save-excursion
-      ;; Look for the start of a verbatim macro in the current line.
-      (when (re-search-backward (concat (regexp-quote TeX-esc)
-                                        "\\(?:" verb-macros 
"\\)\\([^a-z@*]\\)")
-                                (line-beginning-position) t)
-        ;; Determine start and end of verbatim macro.
-        (let ((beg (point))
-              (end (if (not (string-match "[ [{]" (match-string 1)))
-                       (cdr (LaTeX-verbatim-macro-boundaries))
-                     (TeX-find-macro-end))))
-          ;; Determine if macro end is behind fill column.
-          (when (and end
-                     (> (- end (line-beginning-position))
-                        (current-fill-column))
-                     (> end final-breakpoint))
-            ;; Search backwards for place to break before the macro.
-            (goto-char beg)
-            (skip-chars-backward "^ \n")
-            ;; Determine if point ended up at the beginning of the line.
-            (when (save-excursion (skip-chars-backward " \t%") (bolp))
-              ;; Search forward for a place to break after the macro.
-              (goto-char end)
-              (skip-chars-forward "^ \n" (point-max)))
-            (setq final-breakpoint (point))))))
-    (goto-char final-breakpoint))
   (when LaTeX-fill-break-at-separators
     (let ((orig-breakpoint (point))
           (final-breakpoint (point))
@@ -6056,7 +6159,7 @@ single stroke or a string (for example \"o a\") for a 
multi-stroke
 binding.  If KEY is nil, the symbol has no associated
 keystroke (it is available in the menu, though).  Note that
 predefined keys in `LaTeX-math-default' cannot be overridden in
-this variable.  Currently, only the lowercase letter 'o' is free
+this variable.  Currently, only the lowercase letter \\='o\\=' is free
 for user customization, more options are available in uppercase
 area.
 
@@ -7260,6 +7363,10 @@ function would return non-nil and `(match-string 1)' 
would return
   (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
   (set (make-local-variable 'fill-paragraph-function) #'LaTeX-fill-paragraph)
   (set (make-local-variable 'adaptive-fill-mode) nil)
+  ;; Cater for \verb|...| (and similar) contructs which should not be
+  ;; broken.
+  (add-to-list (make-local-variable 'fill-nobreak-predicate)
+               #'LaTeX-verbatim-p t)
 
   (or LaTeX-largest-level
       (setq LaTeX-largest-level (LaTeX-section-level "section")))
@@ -7780,6 +7887,8 @@ function would return non-nil and `(match-string 1)' 
would return
      ;; User level reset macros:
      '("normalfont" -1) '("normalshape" -1)
 
+     '("linespread" "Factor")
+
      ;; LaTeX hook macros:
      '("AddToHook"      TeX-arg-hook [ "Label" ] t)
      '("RemoveFromHook" TeX-arg-hook [ "Label" ])
@@ -7810,7 +7919,47 @@ function would return non-nil and `(match-string 1)' 
would return
                      (TeX-argument-prompt t nil "Format")
                      '("\\arabic" "\\roman" "\\Roman" "\\alph" "\\Alph")]
        (TeX-arg-counter)
-       (TeX-arg-counter "Within counter"))))
+       (TeX-arg-counter "Within counter"))
+
+     ;; Added in LaTeX 2022-06-01
+     '("NewMarkClass" "Class")
+     '("InsertMark" "Class" t)
+     '("TopMark"
+       [TeX-arg-completing-read ("page"         "previous-page"
+                                 "column"       "previous-column"
+                                 "first-column" "last-column")
+                                "Region"]
+       (TeX-arg-completing-read ("2e-left" "2e-right" "2e-right-nonempty")
+                                "Class"))
+     '("FirstMark"
+       [TeX-arg-completing-read ("page"         "previous-page"
+                                 "column"       "previous-column"
+                                 "first-column" "last-column")
+                                "Region"]
+       (TeX-arg-completing-read ("2e-left" "2e-right" "2e-right-nonempty")
+                                "Class"))
+     '("LastMark"
+       [TeX-arg-completing-read ("page"         "previous-page"
+                                 "column"       "previous-column"
+                                 "first-column" "last-column")
+                                "Region"]
+       (TeX-arg-completing-read ("2e-left" "2e-right" "2e-right-nonempty")
+                                "Class"))
+     '("IfMarksEqualTF"
+       [TeX-arg-completing-read ("page"         "previous-page"
+                                 "column"       "previous-column"
+                                 "first-column" "last-column")
+                                "Region"]
+       (TeX-arg-completing-read ("2e-left" "2e-right" "2e-right-nonempty")
+                                "Class")
+       (TeX-arg-completing-read ("top" "first" "last")
+                                "Position 1")
+       (TeX-arg-completing-read ("top" "first" "last")
+                                "Position 2")
+       2)
+     '("fpeval" t)
+     '("dimeval" t)
+     '("skipeval" t) ))
 
   (TeX-run-style-hooks "LATEX")
 
diff --git a/preview.el b/preview.el
index ad48b0984e..7796fcb4fd 100644
--- a/preview.el
+++ b/preview.el
@@ -1622,7 +1622,7 @@ numbers (can be float if available)."
 
 (defface preview-reference-face '((t nil))
   "Face consulted for colors and scale of active previews.
-Fallback to :inherit and 'default implemented."
+Fallback to :inherit and \\='default implemented."
   :group 'preview-appearance)
 
 (defcustom preview-auto-reveal
@@ -1707,13 +1707,13 @@ to the default background in most other cases."
   "Width of transparent border for previews in pt.
 Setting this to a numeric value will add a border of
 `preview-transparent-color' around images, and will turn
-the heuristic-mask setting of images to default to 't since
+the heuristic-mask setting of images to default to t since
 then the borders are correctly detected even in case of
 palette operations.  If the transparent color is something
 not present otherwise in the image, the cursor display
 will affect just this border.  A width of 0 is interpreted
 by PostScript as meaning a single pixel, other widths are
-interpreted as PostScript points (1/72 of 1in)"
+interpreted as PostScript points (1/72 of 1in)."
   :group 'preview-appearance
   :type '(choice (const :value nil :tag "No border")
                  (number :value 1.5 :tag "Border width in pt")))
@@ -1945,7 +1945,7 @@ definition of OV, AFTER-CHANGE, BEG, END and LENGTH."
 (defun preview-toggle (ov &optional arg event)
   "Toggle visibility of preview overlay OV.
 ARG can be one of the following: t displays the overlay,
-nil displays the underlying text, and 'toggle toggles.
+nil displays the underlying text, and `toggle' toggles.
 If EVENT is given, it indicates the window where the event
 occured, either by being a mouse event or by directly being
 the window in question.  This may be used for cursor restoration
@@ -2328,11 +2328,6 @@ kept."
         (and save-info
              (cons 'preview (cons timestamp (nreverse save-info))))))))
 
-(eval-after-load "desktop"
-  '(add-hook
-    'desktop-buffer-misc-functions
-    #'desktop-buffer-preview-misc-data))
-
 (defvar preview-temp-dirs nil
 "List of top level temporary directories in use from preview.
 Any directory not in this list will be cleared out by preview
@@ -2388,6 +2383,18 @@ BUFFER-MISC is the appropriate data to be used."
                   (preview-buffer-restore-internal
                    buffer-misc))))))
 
+;; Add autoload cookies explicitly for desktop.el.
+;; <Background> preview-latex doesn't conform to the following
+;; assumptions of desktop.el:
+;; (1) The file associated with the major mode by autoload has defun
+;;     of handler, which restores the state of the buffer.
+;; (2) The file has suitable `add-to-list' form also for
+;;     `desktop-buffer-mode-handlers' to register the entry of the
+;;     handler.
+;; This isn't the case here because the file associated with
+;; `latex-mode' is tex-mode.el, neither preview.el nor latex.el.  Thus
+;; we include both of them as explicit autoloads in preview-latex.el.
+;;;###autoload
 (defun desktop-buffer-preview (file-name _buffer-name misc)
   "Hook function for restoring persistent previews into a buffer."
   (when (and file-name (file-readable-p file-name))
@@ -2398,18 +2405,9 @@ BUFFER-MISC is the appropriate data to be used."
             buf)
         buf))))
 
-(eval-after-load "desktop"
-  '(if (boundp 'desktop-buffer-mode-handlers)
-       (add-to-list 'desktop-buffer-mode-handlers
-                    '(latex-mode . desktop-buffer-preview))
-     (defvar desktop-buffer-file-name)
-     (defvar desktop-buffer-name)
-     (defvar desktop-buffer-misc)
-     (add-hook 'desktop-buffer-handlers (lambda ()
-                                          (desktop-buffer-preview
-                                           desktop-buffer-file-name
-                                           desktop-buffer-name
-                                           desktop-buffer-misc)))))
+;;;###autoload
+(add-to-list 'desktop-buffer-mode-handlers
+             '(latex-mode . desktop-buffer-preview))
 
 (defcustom preview-auto-cache-preamble 'ask
   "Whether to generate a preamble cache format automatically.
@@ -3115,9 +3113,7 @@ to add the preview functionality."
         `(menu-item "Preview at point" preview-at-point
                     :image ,preview-tb-icon
                     :help "Preview on/off at point"
-                    :vert-only t)))
-    (if (boundp 'desktop-buffer-misc)
-        (preview-buffer-restore desktop-buffer-misc))))
+                    :vert-only t)))))
 
 (defun preview-clean-subdir (dir)
   "Cleans out a temporary DIR with preview image files."
@@ -3640,7 +3636,7 @@ name(\\([^)]+\\))\\)\\|\
              (mm-dims (cdr (assoc 'mm-size monitor-attrs)))
              (mm-width (nth 0 mm-dims))
              (mm-height (nth 1 mm-dims))
-             (pixel-dims (cdddr (assoc 'geometry monitor-attrs)))
+             (pixel-dims (cl-cdddr (assoc 'geometry monitor-attrs)))
              (pixel-width (nth 0 pixel-dims))
              (pixel-height (nth 1 pixel-dims)))
         (cons (/ (* 25.4 pixel-width) mm-width)
@@ -3983,8 +3979,28 @@ If FORMAT-CONS is non-nil, a previous format may get 
reused."
           (preview-cache-preamble-off format-cons)
         (setq format-cons (list format-name))
         (push format-cons preview-dumped-alist))
-      ;; mylatex.ltx expects a file name to follow.  Bad. `.tex'
-      ;; in the tools bundle is an empty file.
+      ;; mylatex.ltx expects a file name to follow.  Bad.
+      ;; The file `.tex' in the tools bundle is solely emitting
+      ;; `File ignored', and `\input mylatex.ltx \relax' has the
+      ;; same effect as `\input mylatex.ltx .tex '.
+      ;; The \dump hacks accomplish, among others:
+      ;; - let TeX not ignore spaces (despite instructions to the
+      ;;   contrary inserted into the format by mylatex.ltx)
+      ;;   as we may need to input a `file name with spaces'.
+      ;; - work around the fact that the backslash `\' (as per
+      ;;   mylatex.ltx mandate) has lost its standard TeX status
+      ;;   once the format is loaded, and we could not use `\input'
+      ;;   as in e.g. `pdflatex &abc '\input' abc.tex'.  We
+      ;;   configure TeX for `/' as substitute.
+      ;; - in place of such `/input', we will use `/AUCTEXINPUT'
+      ;;   defined here in the dumped format to grab the file name,
+      ;;   sanitize it via `\detokenize', then
+      ;;   reset TeX to ignore spaces and execute `\input' which
+      ;;   will skip the preamble already dumped.
+      ;; Prior to the patch adding `/AUCTEXINPUT', resetting the
+      ;; spaces to be ignored was included as part of `\everyjob',
+      ;; which was another way to delay this to after the filename
+      ;; was seen by TeX.
       (write-region "\\let\\PREVIEWdump\\dump\\def\\dump{%
 \\edef\\next{{\\ifx\\pdfoutput\\undefined\\else\
 \\pdfoutput=\\the\\pdfoutput\\relax\\fi\
diff --git a/style/amsmath.el b/style/amsmath.el
index 5e7812e7b7..f72f8be8fd 100644
--- a/style/amsmath.el
+++ b/style/amsmath.el
@@ -57,7 +57,8 @@
     "align*" "gather*" "flalign*" "multline*" "equation*"
     "split"
     "cases"
-    "matrix" "smallmatrix" "pmatrix" "bmatrix" "Bmatrix" "vmatrix" "Vmatrix"
+    "matrix" "smallmatrix"
+    "bmatrix" "Bmatrix" "pmatrix" "vmatrix" "Vmatrix"
     "subequations"
     '("subarray" "Alignment"))
 
@@ -126,13 +127,13 @@
                    ("alignedat" . LaTeX-item-equation-alignat)
                    ("flalign"  . LaTeX-item-equation)
                    ("flalign*" . LaTeX-item-equation)
-                   ("matrix" .  LaTeX-item-equation)
-                   ("pmatrix" .  LaTeX-item-equation)
-                   ("bmatrix" .  LaTeX-item-equation)
-                   ("Bmatrix" .  LaTeX-item-equation)
-                   ("vmatrix" .  LaTeX-item-equation)
-                   ("Vmatrix" .  LaTeX-item-equation)
-                   ("smallmatrix" . LaTeX-item-equation)
+                   ("matrix" .  LaTeX-item-equation-matrix)
+                   ("pmatrix" .  LaTeX-item-equation-matrix)
+                   ("bmatrix" .  LaTeX-item-equation-matrix)
+                   ("Bmatrix" .  LaTeX-item-equation-matrix)
+                   ("vmatrix" .  LaTeX-item-equation-matrix)
+                   ("Vmatrix" .  LaTeX-item-equation-matrix)
+                   ("smallmatrix" . LaTeX-item-equation-matrix)
                    ("subarray" . LaTeX-item-equation)
                    ("cases"    . LaTeX-item-equation))
                  LaTeX-item-list))
@@ -225,6 +226,31 @@ If SUPPRESS is non-nil, do not insert line break macro."
       (LaTeX-newline)
       (indent-according-to-mode))))
 
+(defun LaTeX-item-equation-matrix ()
+  "Insert contents to terminate a line in matrix environments.
+Put line break macro on the last line and insert suitable number
+of ampersands if possible.  This number is extracted from the
+first line of the environment."
+  (end-of-line 0)
+  (just-one-space)
+  (TeX-insert-macro "\\")
+  (forward-line 1)
+  (indent-according-to-mode)
+  (let* ((p (point))
+         (s (save-excursion
+              (LaTeX-find-matching-begin)
+              (point)))
+         (e (save-excursion
+              (goto-char s)
+              (search-forward "\\\\" p t)))
+         n)
+    (save-excursion
+      (goto-char s)
+      (setq n (how-many "[^\\]&" s e)))
+    (when (and n (> n 0))
+      (save-excursion
+        (insert (make-string n ?&))))))
+
 (defun LaTeX-item-equation-alignat (&optional suppress)
   "Insert contents to terminate a line in multi-line equations environment.
 Put line break macro on the last line.  Next, if the current
diff --git a/style/bigstrut.el b/style/bigstrut.el
index 8324da3376..874a11802a 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--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2012, 2014--2022 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <mje@inducks.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -30,6 +30,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/caption.el b/style/caption.el
index 134157a443..1b06fbf633 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -1,6 +1,6 @@
 ;;; caption.el --- AUCTeX style for `caption.sty' (v3.4a)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -365,6 +365,10 @@ STAR is non-nil, do not query for a short-caption and a 
label."
    ;; Add caption to the parser.
    (TeX-auto-add-regexp LaTeX-caption-DeclareCaption-regexp)
 
+   ;; Run style hook for ltcaption if longtable package is loaded:
+   (when (member "longtable" (TeX-style-list))
+     (TeX-run-style-hooks "ltcaption"))
+
    ;; Caption commands:
    (TeX-add-symbols
     '("caption*" t)
diff --git a/style/comment.el b/style/comment.el
index 8d0c90c99f..11a14192df 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -1,6 +1,6 @@
 ;;; comment.el --- AUCTeX style for `comment.sty'  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2007, 2018--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2018--2022 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -32,6 +32,7 @@
 
 (require 'tex)
 (require 'tex-style)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/cuted.el b/style/cuted.el
index cb769fc3a9..568eb9622e 100644
--- a/style/cuted.el
+++ b/style/cuted.el
@@ -1,6 +1,6 @@
 ;;; cuted.el --- AUCTeX style for `cuted.sty' (v2.0)  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021, 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -32,6 +32,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/doc.el b/style/doc.el
index 63c6580c07..3ab6c0c74f 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -36,9 +36,6 @@
 (declare-function font-latex-add-keywords
                   "font-latex"
                   (keywords class))
-(declare-function font-latex-add-to-syntax-alist
-                  "font-latex"
-                  (list))
 
 (defun LaTeX-env-doc-no-comment (environment)
   "Insert ENVIRONMENT and make sure there is no commented empty line inside."
diff --git a/style/enumitem.el b/style/enumitem.el
index d8ad056651..62ad17f1c7 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -331,18 +331,20 @@ provided.  OPTIONAL is ignored."
                    sizes))))
       (TeX-argument-insert size t)))
   ;; Second opt. argument:
-  (TeX-argument-insert
-   (mapconcat #'identity
-              (TeX-completing-read-multiple
-               (TeX-argument-prompt t nil "Environment(s), level(s)")
-               (append
-                (when (LaTeX-provided-package-options-member
-                       "enumitem" "includedisplayed")
-                  '("trivlist"))
-                (mapcar #'car (LaTeX-enumitem-newlist-list))
-                '("1" "2" "3" "4")))
-              ",")
-   t)
+  (let ((TeX-arg-opening-brace LaTeX-optop)
+        (TeX-arg-closing-brace LaTeX-optcl))
+    (TeX-argument-insert
+     (mapconcat #'identity
+                (TeX-completing-read-multiple
+                 (TeX-argument-prompt t nil "Environment(s), level(s)")
+                 (append
+                  (when (LaTeX-provided-package-options-member
+                         "enumitem" "includedisplayed")
+                    '("trivlist"))
+                  (mapcar #'car (LaTeX-enumitem-newlist-list))
+                  '("1" "2" "3" "4")))
+                ",")
+     t))
   ;; Mandatory argument:
   (TeX-argument-insert
    (TeX-read-key-val nil (LaTeX-enumitem-key-val-options))
diff --git a/style/footmisc.el b/style/footmisc.el
index 64fd89e163..bc3b56adf9 100644
--- a/style/footmisc.el
+++ b/style/footmisc.el
@@ -30,6 +30,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/footnotehyper.el b/style/footnotehyper.el
index d97e5b2533..d37af85307 100644
--- a/style/footnotehyper.el
+++ b/style/footnotehyper.el
@@ -1,6 +1,6 @@
 ;;; footnotehyper.el --- AUCTeX style for `footnotehyper.sty'  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021, 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -31,6 +31,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/graphicx.el b/style/graphicx.el
index 0e1e220095..5704ecf19e 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--2021 by Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2004, 2005, 2014--2022 by Free Software Foundation, Inc.
 
 ;; Author: Ryuichi Arafune <arafune@debian.org>
 ;; Created: 1999/3/20
@@ -89,8 +89,8 @@ Temporarily remove \"space\" from `crm-local-completion-map' 
and
 `minibuffer-local-completion-map' in order to be able to insert
 spaces conveniently.
 
-If `TeX-engine' is set to symbol 'default (while
-`TeX-PDF-from-DVI' is set to nil) or 'luatex and `TeX-PDF-mode'
+If `TeX-engine' is set to symbol `default' (while
+`TeX-PDF-from-DVI' is set to nil) or `luatex' and `TeX-PDF-mode'
 is non-nil, add the keys \"page\" and \"pagebox\" to list of
 key-val's."
   (let ((crm-local-completion-map
diff --git a/style/hyperref.el b/style/hyperref.el
index 81a0533c3f..c225359be1 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -1,6 +1,6 @@
 ;;; hyperref.el --- AUCTeX style for `hyperref.sty' v6.83m  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008, 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -42,7 +42,7 @@
                   "font-latex")
 
 (defvar LaTeX-hyperref-package-options-list
-  '(;; See https://www.tug.org/applications/hyperref/manual.html#x1-40003
+  '(;; See 
https://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/hyperref-doc.html#x1-110005
     ;; General options
     ("draft" ("true" "false"))
     ("final" ("true" "false"))
@@ -164,8 +164,7 @@
     ("nextactionraw"))
   "Key=value options for href macro of the hyperref package.")
 
-;; See 
https://www.tug.org/applications/hyperref/ftp/doc/manual.html#x1-220006.2
-
+;; See 
https://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/hyperref-doc.html#x1-600009.2
 (defvar LaTeX-hyperref-forms-options
   '(("accesskey")
     ("align"          ("0" "1" "2"))
@@ -173,16 +172,12 @@
     ("backgroundcolor")
     ("bordercolor")
     ("bordersep")
-    ("borderwidth")
-    ;; "borderstyle" is not mentioned in the original hyperref-doc, it
-    ;; can be seen in action in
-    ;; https://github.com/latex3/hyperref/blob/main/test/testform.tex
-    ;; S=Solid (default), D=Dashed, B=Beveled, I=Inset, U=Underline
     ("borderstyle"    ("S" "D" "B" "I" "U"))
+    ("borderwidth")
     ("calculate")
     ("charsize")
-    ("checkboxsymbol" ("true" "false"))
-    ("checked")
+    ("checkboxsymbol")
+    ("checked"        ("true" "false"))
     ("color")
     ("combo"          ("true" "false"))
     ("default")
@@ -239,7 +234,10 @@
     '("hyperbaseurl" t)
     '("hyperimage" "Image URL" "Text")
     '("hyperdef" "Category" "Name" "Text")
-    '("hyperref" "URL" "Category" "Name" "Text")
+    '("hyperref"
+      (TeX-arg-conditional (y-or-n-p "Insert a label and text? ")
+                           ([TeX-arg-ref] "Text")
+                           ("URL" "Category" "Name" "Text")))
     '("hyperlink" "Name" "Text")
     '("hypertarget" "Name" "Text")
     '("phantomsection" 0)
@@ -273,13 +271,17 @@
     '("MakeCheckField" "Width" "Height")
     '("MakeTextField" "Width" "Height")
     '("MakeChoiceField" "Width" "Height")
-    '("MakeButtonField" "Text"))
+    '("MakeButtonField" "Text")
+    ;; The macro version of the 'Form' environment:
+    '("Form" 0))
 
    ;; Form fields must be inside a "Form"-env, one per file is allowed, cf.
-   ;; https://www.tug.org/applications/hyperref/ftp/doc/manual.html#x1-200006
-   ;; It is up to user to insert [<options>] after \begin{Form}
+   ;; 
https://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/hyperref-doc.html#x1-590009.1
    (LaTeX-add-environments
-    '("Form"))
+    '("Form" LaTeX-env-args [TeX-arg-key-val (("action")
+                                              ("encoding" ("html"))
+                                              ("method"   ("post" "get")))])
+    "NoHyper")
 
    ;; Do not indent the content of the "Form"-env; it is odd if the
    ;; whole document is indented.  Append it to a local version of
@@ -291,13 +293,17 @@
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
-   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
+   ;; "hyperref" macros is not added here since it takes different
+   ;; number of arguments depending on a given optional argument.
+   ;; The first mandatory argument is not necessarily a verbatim one.
+   ;; (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref")
    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "href")
 
-   ;; In hyperref package, \url macro is redefined and \url|...| can't be used,
-   ;; while it's possible when only url package (required by hyperref) is 
loaded
+   ;; In hyperref package, \url macro is redefined and \url|...| can't
+   ;; be used, while it's possible when only url package (required by
+   ;; hyperref) is loaded
    (setq LaTeX-verbatim-macros-with-delims-local
-         (remove "url"  LaTeX-verbatim-macros-with-delims-local))
+         (remove "url" LaTeX-verbatim-macros-with-delims-local))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
@@ -307,7 +313,8 @@
                                 ("hyperbaseurl" "{")
                                 ("hyperimage" "{{")
                                 ("hyperdef" "{{{")
-                                ("hyperref" "{{{{")
+                                ;; Fontify only the minimum set of args:
+                                ("hyperref" "[{")
                                 ("hyperlink" "{{")
                                 ("hypertarget" "{{")
                                 ("autoref" "*{")
diff --git a/style/midfloat.el b/style/ifetex.el
similarity index 60%
copy from style/midfloat.el
copy to style/ifetex.el
index 66d794c2eb..28a1d8ddce 100644
--- a/style/midfloat.el
+++ b/style/ifetex.el
@@ -1,10 +1,10 @@
-;;; midfloat.el --- AUCTeX style for `midfloat.sty' (v1.1)  -*- 
lexical-binding: t; -*-
+;;; ifetex.el --- AUCTeX style for `ifetex.sty' version 1.3.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
-;; Created: 2021-12-11
+;; Created: 2022-04-23
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,26 +26,22 @@
 
 ;;; Commentary:
 
-;; This file adds support for `midfloat.sty' (v1.1) from 2012/05/29.
-;; `midfloat.sty' is part of TeXLive.
+;; This file adds support for `ifetex.sty' 1.3.  The package is now
+;; part of 'iftex' bundle and therefore, the code is now in
+;; 'iftex.el'.
 
 ;;; Code:
 
 (require 'tex)
 
 (TeX-add-style-hook
- "midfloat"
+ "ifetex"
  (lambda ()
-
-   ;; Add the only environment provided by the package:
-   (LaTeX-add-environments
-    '("strip" ["Top/Bottom skip"]))
-
-   ;; This is a glue, in LaTeX set with \setlength:
-   (LaTeX-add-lengths "stripsep"))
+   ;; Run the style hook for 'iftex' which does the work:
+   (TeX-run-style-hooks "iftex"))
  TeX-dialect)
 
-(defvar LaTeX-midfloat-package-options nil
-  "Package options for the midfloat package.")
+(defvar LaTeX-ifetex-package-options nil
+  "Package options for the ifetex package.")
 
-;;; midfloat.el ends here
+;;; ifetex.el ends here
diff --git a/style/ifluatex.el b/style/ifluatex.el
index 86a7638ac9..c909783355 100644
--- a/style/ifluatex.el
+++ b/style/ifluatex.el
@@ -1,6 +1,6 @@
-;;; ifluatex.el --- AUCTeX style for `ifluatex.sty' version 1.3.  -*- 
lexical-binding: t; -*-
+;;; ifluatex.el --- AUCTeX style for `ifluatex.sty' version 1.5.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2014, 2016, 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2022 Free Software Foundation, Inc.
 
 ;; Author: Davide G. M. Salvetti <salve@debian.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -10,22 +10,25 @@
 ;; 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.
+;; 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.
+;; 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, see
-;; <https://www.gnu.org/licenses/>.
+;; 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 `ifluatex.sty' 1.3.
+;; This file adds support for `ifluatex.sty' 1.5.  The package is now
+;; part of 'iftex' bundle and therefore, the code is now in
+;; 'iftex.el'.
 
 ;;; Code:
 
@@ -36,28 +39,20 @@
                   "font-latex"
                   (keywords class))
 
-(defun LaTeX-ifluatex-set-TeX-exit-mark (_optional)
-  "Discard OPTIONAL and set `TeX-exit-mark' to current point."
-  (set-marker TeX-exit-mark (point)))
-
 (TeX-add-style-hook
  "ifluatex"
  (lambda ()
+
+   ;; Run the style hook for 'iftex' which does the work:
+   (TeX-run-style-hooks "iftex")
+
    (TeX-add-symbols
-    '("ifluatex"
-      (TeX-arg-literal "%\n")
-      LaTeX-ifluatex-set-TeX-exit-mark
-      (TeX-arg-literal "\n\\else%\n\\fi%"))
     '("luatexversion" 0)
     '("luatexrevision" 0))
+
    (TeX-declare-expert-macros
     "ifluatex"
-    "ifluatex" "luatexversion" "luatexrevision")
-
-   ;; This package is used to make it possible to compile a document with both
-   ;; LuaTeX and base TeX engines.  By setting `TeX-check-engine-list' to nil
-   ;; we ignore engine restrictions posed by other packages.
-   (setq TeX-check-engine-list nil)
+    "luatexversion" "luatexrevision")
 
    (when (and (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
diff --git a/style/midfloat.el b/style/ifpdf.el
similarity index 61%
copy from style/midfloat.el
copy to style/ifpdf.el
index 66d794c2eb..9c71b3b21a 100644
--- a/style/midfloat.el
+++ b/style/ifpdf.el
@@ -1,10 +1,10 @@
-;;; midfloat.el --- AUCTeX style for `midfloat.sty' (v1.1)  -*- 
lexical-binding: t; -*-
+;;; ifpdf.el --- AUCTeX style for `ifpdf.sty' version 3.4.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
-;; Created: 2021-12-11
+;; Created: 2022-04-23
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,26 +26,22 @@
 
 ;;; Commentary:
 
-;; This file adds support for `midfloat.sty' (v1.1) from 2012/05/29.
-;; `midfloat.sty' is part of TeXLive.
+;; This file adds support for `ifpdf.sty' 3.4.  The package is now
+;; part of 'iftex' bundle and therefore, the code is now in
+;; 'iftex.el'.
 
 ;;; Code:
 
 (require 'tex)
 
 (TeX-add-style-hook
- "midfloat"
+ "ifpdf"
  (lambda ()
-
-   ;; Add the only environment provided by the package:
-   (LaTeX-add-environments
-    '("strip" ["Top/Bottom skip"]))
-
-   ;; This is a glue, in LaTeX set with \setlength:
-   (LaTeX-add-lengths "stripsep"))
+   ;; Run the style hook for 'iftex' which does the work:
+   (TeX-run-style-hooks "iftex"))
  TeX-dialect)
 
-(defvar LaTeX-midfloat-package-options nil
-  "Package options for the midfloat package.")
+(defvar LaTeX-ifpdf-package-options nil
+  "Package options for the ifpdf package.")
 
-;;; midfloat.el ends here
+;;; ifpdf.el ends here
diff --git a/style/iftex.el b/style/iftex.el
new file mode 100644
index 0000000000..284f14b85d
--- /dev/null
+++ b/style/iftex.el
@@ -0,0 +1,189 @@
+;;; iftex.el --- AUCTeX style for `iftex.sty' version 1.0f  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-04-17
+;; 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 `iftex.sty' v1.0f from 2022/02/03.
+;; `iftex.sty' is part of TeXlive.
+
+;;; Code:
+
+(require 'tex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+(defun LaTeX-iftex-set-TeX-exit-mark (_optional)
+  "Ignore OPTIONAL and set `TeX-exit-mark' to current point."
+  (set-marker TeX-exit-mark (point)))
+
+(TeX-add-style-hook
+ "iftex"
+ (lambda ()
+
+   (TeX-add-symbols
+    '("ifetex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifeTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifpdftex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifPDFTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifxetex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifXeTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifluatex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifLuaTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifluahbtex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifLuaHBTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifptex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifpTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifuptex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifupTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifptexng"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifpTeXng"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifvtex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifVTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifalephtex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifAlephTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("iftutex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifTUTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("iftexpadtex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifTexpadTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("iftex"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifTeX"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    '("ifhint"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+    '("ifHINT"
+      LaTeX-iftex-set-TeX-exit-mark
+      (TeX-arg-literal "\\else\\fi"))
+
+    "RequireeTeX"
+    "RequirePDFTeX"
+    "RequireXeTeX"
+    "RequireLuaTeX"
+    "RequireLuaHBTeX"
+    "RequirepTeX"
+    "RequireupTeX"
+    "RequirepTeXng"
+    "RequireVTeX"
+    "RequireAlephTeX"
+    "RequireTUTeX"
+    "RequireTexpadTeX"
+    "RequireHINT")
+
+   ;; This package is used to make it possible to compile a document
+   ;; with different TeX engines.  By setting `TeX-check-engine-list'
+   ;; to nil we ignore engine restrictions posed by other packages.
+   (TeX-check-engine-add-engines nil)
+
+   ;; Fontification:
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("RequireeTeX"      "")
+                                ("RequirePDFTeX"    "")
+                                ("RequireXeTeX"     "")
+                                ("RequireLuaTeX"    "")
+                                ("RequireLuaHBTeX"  "")
+                                ("RequirepTeX"      "")
+                                ("RequireupTeX"     "")
+                                ("RequirepTeXng"    "")
+                                ("RequireVTeX"      "")
+                                ("RequireAlephTeX"  "")
+                                ("RequireTUTeX"     "")
+                                ("RequireTexpadTeX" "")
+                                ("RequireHINT"      ""))
+                              'function)))
+ TeX-dialect)
+
+(defvar LaTeX-iftex-package-options nil
+  "Package options for the iftex package.")
+
+;;; iftex.el ends here
diff --git a/style/midfloat.el b/style/ifvtex.el
similarity index 60%
copy from style/midfloat.el
copy to style/ifvtex.el
index 66d794c2eb..e46a545879 100644
--- a/style/midfloat.el
+++ b/style/ifvtex.el
@@ -1,10 +1,10 @@
-;;; midfloat.el --- AUCTeX style for `midfloat.sty' (v1.1)  -*- 
lexical-binding: t; -*-
+;;; ifvtex.el --- AUCTeX style for `ifvtex.sty' version 1.7.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
-;; Created: 2021-12-11
+;; Created: 2022-04-23
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,26 +26,22 @@
 
 ;;; Commentary:
 
-;; This file adds support for `midfloat.sty' (v1.1) from 2012/05/29.
-;; `midfloat.sty' is part of TeXLive.
+;; This file adds support for `ifvtex.sty' 1.7.  The package is now
+;; part of 'iftex' bundle and therefore, the code is now in
+;; 'iftex.el'.
 
 ;;; Code:
 
 (require 'tex)
 
 (TeX-add-style-hook
- "midfloat"
+ "ifvtex"
  (lambda ()
-
-   ;; Add the only environment provided by the package:
-   (LaTeX-add-environments
-    '("strip" ["Top/Bottom skip"]))
-
-   ;; This is a glue, in LaTeX set with \setlength:
-   (LaTeX-add-lengths "stripsep"))
+   ;; Run the style hook for 'iftex' which does the work:
+   (TeX-run-style-hooks "iftex"))
  TeX-dialect)
 
-(defvar LaTeX-midfloat-package-options nil
-  "Package options for the midfloat package.")
+(defvar LaTeX-ifvtex-package-options nil
+  "Package options for the ifvtex package.")
 
-;;; midfloat.el ends here
+;;; ifvtex.el ends here
diff --git a/style/midfloat.el b/style/ifxetex.el
similarity index 60%
copy from style/midfloat.el
copy to style/ifxetex.el
index 66d794c2eb..a1c8b687a4 100644
--- a/style/midfloat.el
+++ b/style/ifxetex.el
@@ -1,10 +1,10 @@
-;;; midfloat.el --- AUCTeX style for `midfloat.sty' (v1.1)  -*- 
lexical-binding: t; -*-
+;;; ifxetex.el --- AUCTeX style for `ifxetex.sty' version 0.7.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
-;; Created: 2021-12-11
+;; Created: 2022-04-23
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,26 +26,22 @@
 
 ;;; Commentary:
 
-;; This file adds support for `midfloat.sty' (v1.1) from 2012/05/29.
-;; `midfloat.sty' is part of TeXLive.
+;; This file adds support for `ifxetex.sty' 0.7.  The package is now
+;; part of 'iftex' bundle and therefore, the code is now in
+;; 'iftex.el'.
 
 ;;; Code:
 
 (require 'tex)
 
 (TeX-add-style-hook
- "midfloat"
+ "ifxetex"
  (lambda ()
-
-   ;; Add the only environment provided by the package:
-   (LaTeX-add-environments
-    '("strip" ["Top/Bottom skip"]))
-
-   ;; This is a glue, in LaTeX set with \setlength:
-   (LaTeX-add-lengths "stripsep"))
+   ;; Run the style hook for 'iftex' which does the work:
+   (TeX-run-style-hooks "iftex"))
  TeX-dialect)
 
-(defvar LaTeX-midfloat-package-options nil
-  "Package options for the midfloat package.")
+(defvar LaTeX-ifxetex-package-options nil
+  "Package options for the ifxetex package.")
 
-;;; midfloat.el ends here
+;;; ifxetex.el ends here
diff --git a/style/jurabib.el b/style/jurabib.el
index 68c02fc95e..09284cf2e4 100644
--- a/style/jurabib.el
+++ b/style/jurabib.el
@@ -1,6 +1,6 @@
 ;;; jurabib.el --- AUCTeX style for the `jurabib' package  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2004-2022  Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
 ;; Maintainer: auctex-devel@gnu.org
@@ -37,6 +37,7 @@
 
 (require 'tex)
 (require 'tex-style)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/bigstrut.el b/style/keyval.el
similarity index 57%
copy from style/bigstrut.el
copy to style/keyval.el
index 8324da3376..f93e86b11a 100644
--- a/style/bigstrut.el
+++ b/style/keyval.el
@@ -1,9 +1,10 @@
-;;; bigstrut.el --- AUCTeX style for `bigstrut.sty'  -*- lexical-binding: t; 
-*-
+;;; keyval.el --- AUCTeX style for `keyval.sty' version 1.15.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012, 2014--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
-;; Author: Mads Jensen <mje@inducks.org>
+;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-05-29
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -25,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `bigstrut.sty', v2.6 from 2021/01/02.
+;; This file adds support for `keyval.sty' 1.15 from 2014-10-28.
 
 ;;; Code:
 
@@ -37,32 +38,21 @@
                   (keywords class))
 
 (TeX-add-style-hook
- "bigstrut"
+ "keyval"
  (lambda ()
    (TeX-add-symbols
-    '("bigstrut" [ TeX-arg-bigstrut ]))
+    '("define@key" "Family" "Key" [ "Default" ] t)
+    '("setkeys" "Family" t))
 
-   (LaTeX-add-lengths "bigstrutjot")
-
-   ;; Fontification
+   ;; Fontification: Don't fontify arguments which contain code
    (when (and (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("bigstrut" "["))
+     (font-latex-add-keywords '(("define@key" "{{[")
+                                ("setkeys"    "{{"))
                               'function)))
  TeX-dialect)
 
-(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 prompt "Strut to top (t) or bottom (b)")
-    '("t" "b"))
-   optional))
-
-(defvar LaTeX-bigstrut-package-options nil
-  "Package options for the bigstrut package.")
+(defvar LaTeX-keyval-package-options nil
+  "Package options for the keyval package.")
 
-;;; bigstrut.el ends here
+;;; keyval.el ends here
diff --git a/style/kvoptions.el b/style/kvoptions.el
new file mode 100644
index 0000000000..66595dc2b2
--- /dev/null
+++ b/style/kvoptions.el
@@ -0,0 +1,113 @@
+;;; kvoptions.el --- AUCTeX style for `kvoptions.sty' version 3.14.  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-05-27
+;; 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 `kvoptions.sty' 3.14 from 2020-10-07.
+
+;;; Code:
+
+(require 'tex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+(TeX-add-style-hook
+ "kvoptions"
+ (lambda ()
+
+   ;; kvoptions.sty loads kvsetkeys.sty:
+   (TeX-run-style-hooks "kvsetkeys")
+
+   (TeX-add-symbols
+    ;; 2.1.1 \ProcessKeyvalOptions
+    '("ProcessKeyvalOptions" "Family")
+    '("ProcessKeyvalOptions*" 0)
+
+    '("ProcessLocalKeyvalOptions" "Family")
+    '("ProcessLocalKeyvalOptions*" 0)
+
+    '("SetupKeyvalOptions"
+      (TeX-arg-key-val (("family")
+                        ("prefix")
+                        ("setkeys" ("\\setkeys" "\\kvsetkeys")))))
+
+    ;; 2.2.1 \DeclareStringOption
+    '("DeclareStringOption" ["Initial value"] "Key" ["Default value"])
+
+    ;; 2.2.2 \DeclareBoolOption
+    '("DeclareBoolOption" ["Initial value"] "Key")
+
+    ;; 2.2.3 \DeclareComplementaryOption
+    '("DeclareComplementaryOption" "Key" "Parent")
+
+    ;; 2.2.4 \DeclareVoidOption
+    '("DeclareVoidOption" "Key" t)
+
+    ;; 2.2.5 \DeclareDefaultOption
+    '("DeclareDefaultOption" t)
+
+    ;; 2.2.6 Local options
+    '("DeclareLocalOption" "Option")
+    '("DeclareLocalOptions" "Options")
+
+    ;; 2.2.8 \DisableKeyvalOption
+    '("DisableKeyvalOption"
+      [TeX-arg-key-val (("action" ("undef" "warning" "error" "ignore"))
+                        ("global")
+                        ("local")
+                        ("package")
+                        ("class"))]
+      "Family" "Key")
+
+    ;; 2.2.9 \AddToKeyvalOption
+    '("AddToKeyvalOption"  "Family" "Key" t)
+    '("AddToKeyvalOption*" "Key" t))
+
+   ;; Fontification: Don't fontify arguments which contain code
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("ProcessKeyvalOptions"       "*")
+                                ("ProcessLocalKeyvalOptions"  "*")
+                                ("SetupKeyvalOptions"         "{")
+                                ("DeclareStringOption"        "[{[")
+                                ("DeclareBoolOption"          "[{")
+                                ("DeclareComplementaryOption" "{{")
+                                ("DeclareVoidOption"          "{")
+                                ("DeclareDefaultOption"       "")
+                                ("DeclareLocalOption"         "{")
+                                ("DeclareLocalOptions"        "{")
+                                ("DisableKeyvalOption"        "[{{")
+                                ("AddToKeyvalOption"          "*{"))
+                              'function)))
+ TeX-dialect)
+
+(defvar LaTeX-kvoptions-package-options '("patch" "debugshow")
+  "Package options for the kvoptions package.")
+
+;;; kvoptions.el ends here
diff --git a/style/bigstrut.el b/style/kvsetkeys.el
similarity index 57%
copy from style/bigstrut.el
copy to style/kvsetkeys.el
index 8324da3376..4614857e95 100644
--- a/style/bigstrut.el
+++ b/style/kvsetkeys.el
@@ -1,9 +1,10 @@
-;;; bigstrut.el --- AUCTeX style for `bigstrut.sty'  -*- lexical-binding: t; 
-*-
+;;; kvsetkeys.el --- AUCTeX style for `kvsetkeys.sty' version 1.18.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012, 2014--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
-;; Author: Mads Jensen <mje@inducks.org>
+;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-05-29
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -25,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `bigstrut.sty', v2.6 from 2021/01/02.
+;; This file adds support for `kvsetkeys.sty' 1.18 from 2019-12-15.
 
 ;;; Code:
 
@@ -37,32 +38,21 @@
                   (keywords class))
 
 (TeX-add-style-hook
- "bigstrut"
+ "kvsetkeys"
  (lambda ()
    (TeX-add-symbols
-    '("bigstrut" [ TeX-arg-bigstrut ]))
+    '("kvsetkeys" "Family" t)
+    '("kvsetknownkeys" "Family" 2))
 
-   (LaTeX-add-lengths "bigstrutjot")
-
-   ;; Fontification
+   ;; Fontification: Don't fontify arguments which contain code
    (when (and (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("bigstrut" "["))
+     (font-latex-add-keywords '(("kvsetkeys"      "{{")
+                                ("kvsetknownkeys" "{{{"))
                               'function)))
  TeX-dialect)
 
-(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 prompt "Strut to top (t) or bottom (b)")
-    '("t" "b"))
-   optional))
-
-(defvar LaTeX-bigstrut-package-options nil
-  "Package options for the bigstrut package.")
+(defvar LaTeX-kvsetkeys-package-options nil
+  "Package options for the kvsetkeys package.")
 
-;;; bigstrut.el ends here
+;;; kvsetkeys.el ends here
diff --git a/style/l3doc.el b/style/l3doc.el
index e51e83a472..8364e74e94 100644
--- a/style/l3doc.el
+++ b/style/l3doc.el
@@ -48,9 +48,9 @@
 
 (defun LaTeX-env-l3doc-function (environment)
   "Insert the ENVIRONMENT provided by l3doc.cls.
-This function should be used for the environments 'function' and
-'variable' provided by the l3doc class.  Also ask the user if a
-'syntax' environment should be added as well."
+This function should be used for the environments \"function\" and
+\"variable\" provided by the l3doc class.  Also ask the user if a
+\"syntax\" environment should be added as well."
   (let* ((time (format-time-string "%Y-%m-%d" (current-time)))
          (exp-flag (TeX-read-key-val t `(("added" (,time))
                                          ("updated" (,time))
diff --git a/style/listings.el b/style/listings.el
index cfd49687df..43d1c191fa 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -1,6 +1,6 @@
 ;;; listings.el --- AUCTeX style for `listings.sty'  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004, 2005, 2009, 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2009, 2013-2022 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
 ;; Maintainer: auctex-devel@gnu.org
@@ -295,7 +295,7 @@
 (defvar LaTeX-listings-lstdefinestyle-regexp
   '("\\\\lstdefinestyle{\\([^}]+\\)}"
     1 LaTeX-auto-listings-lstdefinestyle)
-  "Matches the argument of '\\lstdefinestyle' from 'listings' package.")
+  "Matches the argument of \\='\\lstdefinestyle\\=' from listings package.")
 
 ;; Setup for parsing the labels inside optional arguments:
 
@@ -306,12 +306,12 @@
   "Matches the label inside an optional argument after \\begin{lstlisting}.")
 
 (defun LaTeX-listings-auto-prepare ()
-  "Clear temporary variable from 'listings' package before parsing."
+  "Clear temporary variable from listings package before parsing."
   (setq LaTeX-auto-listings-lstnewenvironment nil)
   (setq LaTeX-auto-listings-lstdefinestyle    nil))
 
 (defun LaTeX-listings-auto-cleanup ()
-  "Process the parsed results of 'listings' package."
+  "Process the parsed results of listings package."
   (dolist (env-args LaTeX-auto-listings-lstnewenvironment)
     (let ((env  (car   env-args))
           (args (cadr  env-args))
@@ -345,6 +345,16 @@
          `((,env ?l "lst:" "~\\ref{%s}"
                  LaTeX-listings-reftex-label-context-function
                  (regexp "[Ll]isting")))))
+      (when (boundp 'reftex-label-regexps)
+        (add-to-list (make-local-variable 'reftex-label-regexps)
+                     (concat (regexp-quote TeX-esc)
+                             "begin[[:space:]]*"
+                             (regexp-quote TeX-grop)
+                             (regexp-quote env)
+                             (regexp-quote TeX-grcl)
+                             "[[:space:]]*"
+                             (LaTeX-extract-key-value-label nil 1))
+                     t))
       ;; Fontification
       (when (and (fboundp 'font-latex-add-keywords)
                  (eq TeX-install-font-lock 'font-latex-setup))
@@ -462,7 +472,8 @@ caption key is found, an error is issued."
      (font-latex-add-keywords '(("lstalias" "{{")
                                 ("lstdefinestyle" "{{")
                                 ("lstset" "{"))
-                              'variable)))
+                              'variable)
+     (font-latex-set-syntactic-keywords)))
  TeX-dialect)
 
 (defvar LaTeX-listings-package-options '("draft" "final" "savemem"
diff --git a/style/longtable.el b/style/longtable.el
index 8db4083c66..55384bca4c 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -88,11 +88,12 @@ insert line break macro."
       (insert TeX-grop caption)
       ;; ask for a label and insert it
       (LaTeX-label environment 'environment)
-      ;; the longtable `\caption' is equivalent to a
-      ;; `\multicolumn', so it needs a `\\' at the
-      ;; end of the line.  Prior to that, add } to
-      ;; close `\caption{'
-      (insert TeX-grcl "\\\\")
+      ;; the longtable `\caption' is equivalent to a `\multicolumn',
+      ;; so it needs a `\\' at the end of the line.  Prior to that,
+      ;; add } to close `\caption{' and a space:
+      (insert TeX-grcl)
+      (just-one-space)
+      (insert "\\\\")
       ;; fill the caption
       (when auto-fill-function (LaTeX-fill-paragraph))
       ;; Insert a new line and indent
diff --git a/style/ltcaption.el b/style/ltcaption.el
new file mode 100644
index 0000000000..f100b929bd
--- /dev/null
+++ b/style/ltcaption.el
@@ -0,0 +1,120 @@
+;;; ltcaption.el --- AUCTeX style for `ltcaption.sty' version v1.4c  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-05-04
+;; 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 `ltcaption.sty' version v1.4c from
+;; 2021/01/08.  `ltcaption.sty' is part of TeXLive.
+
+;; This style tracks ltcaption.sty which doesn't load longtable.sty
+;; and emits an error when longtable package is missing.  The same
+;; happens here when longtable.el isn't loaded yet where
+;; `LaTeX-item-longtable' is undefined.  The remedy is to load
+;; longtable before ltcaption.  The caption package loads ltcaption
+;; automatically if longtable is loaded.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex" (keywords class))
+(declare-function LaTeX-item-longtable
+                  "longtable" (&optional suppress))
+
+(defun LaTeX-env-longtable* (environment)
+  "Insert a longtable* ENVIRONMENT with a starred caption."
+  (let ((pos (and LaTeX-default-position ; `LaTeX-default-position'
+                                        ; can be nil, i.e. no prompt
+                  (completing-read (TeX-argument-prompt t nil "Position")
+                                   '("l" "r" "c")
+                                   nil nil LaTeX-default-position)))
+        (fmt (TeX-read-string
+              (if (string= LaTeX-default-format "")
+                  "Format: "
+                (format "Format (default %s): " LaTeX-default-format))
+              nil nil
+              (if (string= LaTeX-default-format "")
+                  nil
+                LaTeX-default-format)))
+        (caption (TeX-read-string
+                  (TeX-argument-prompt nil nil "Starred caption"))))
+    (setq LaTeX-default-position pos
+          LaTeX-default-format   fmt)
+    (LaTeX-insert-environment environment
+                              (concat
+                               (unless (zerop (length pos))
+                                 (concat LaTeX-optop pos LaTeX-optcl))
+                               (concat TeX-grop fmt TeX-grcl)))
+    ;; top caption -- do nothing if user skips caption
+    (unless (zerop (length caption))
+      ;; insert '\caption*{text} \\':
+      (insert TeX-esc "caption*" TeX-grop caption TeX-grcl " \\\\")
+      ;; fill the caption
+      (when auto-fill-function (LaTeX-fill-paragraph))
+      ;; Insert a new line and indent
+      (LaTeX-newline)
+      (indent-according-to-mode))
+    ;; Insert suitable number of &'s, suppress line break
+    (LaTeX-item-longtable t)))
+
+(TeX-add-style-hook
+ "ltcaption"
+ (lambda ()
+
+   (TeX-add-symbols
+    "LTcapmarginsfalse"
+    "LTcaptype")
+
+   ;; These parameters are set with \setlength
+   (LaTeX-add-lengths
+    "LTcapskip" "LTcapleft" "LTcapright")
+
+   (LaTeX-add-environments
+    '("longtable*" LaTeX-env-longtable*))
+
+   ;; Use the enhanced table formatting.  Append to
+   ;; `LaTeX-indent-environment-list' in order not to override custom
+   ;; settings.
+   (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+                '("longtable*" LaTeX-indent-tabular) t)
+
+   ;; Append 'longtable*' to `LaTeX-item-list' with `LaTeX-item-longtable':
+   (add-to-list 'LaTeX-item-list '("longtable*" . LaTeX-item-longtable) t)
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("LTcapmarginsfalse" ""))
+                              'function)))
+ TeX-dialect)
+
+(defvar LaTeX-ltcaption-package-options nil
+  "Package options for the ltcaption package.")
+
+;;; ltcaption.el ends here
diff --git a/style/ltxdoc.el b/style/ltxdoc.el
index 16c26e1f39..feeb300d34 100644
--- a/style/ltxdoc.el
+++ b/style/ltxdoc.el
@@ -87,7 +87,7 @@
   (progn
     (TeX-load-style "article")
     (append (remove "a5paper" LaTeX-article-class-options)
-            '("nocfg")))
+            '("nocfg" "doc2")))
   "Class options for the ltxdoc class.
 All options are passed to article class, \"a5paper\" is disabled
 by ltxdoc.  Therefore it is also removed here.")
diff --git a/style/microtype.el b/style/microtype.el
new file mode 100644
index 0000000000..9287ccaac6
--- /dev/null
+++ b/style/microtype.el
@@ -0,0 +1,240 @@
+;;; microtype.el --- AUCTeX style for `microtype.sty'  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-06-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 Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
+
+;;; Commentary:
+
+;; This file adds support for `microtype.sty' v3.0e form 2022-06-20.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+(defvar LaTeX-microtype-key-val-options
+  '(;; 3.1 Enabling the micro-typographic features
+    ("protrusion" ("true" "false" "compatibility" "nocompatibility"
+                   "all"  "alltext" "allmath"
+                   "alltext-nott"   "allmath-nott"
+                   "basictext"      "basicmath"
+                   "smallcaps" "footnotesize" "scriptsize" "normalfont"))
+    ("expansion"  ("true" "false" "compatibility" "nocompatibility"
+                   "all"  "alltext" "allmath"
+                   "alltext-nott"   "allmath-nott"
+                   "basictext"      "basicmath"
+                   "smallcaps" "footnotesize" "scriptsize" "normalfont"))
+    ("activate"   ("true" "false" "compatibility" "nocompatibility"))
+    ("tracking"   ("true" "false"
+                   "all"  "alltext" "allmath"
+                   "alltext-nott"   "allmath-nott"
+                   "basictext"      "basicmath"
+                   "smallcaps" "footnotesize" "scriptsize" "normalfont"))
+    ("kerning"    ("true" "false"
+                   "all"  "alltext" "allmath"
+                   "alltext-nott"   "allmath-nott"
+                   "basictext"      "basicmath"
+                   "smallcaps" "footnotesize" "scriptsize" "normalfont"))
+    ("spacing"    ("true" "false"
+                   "all"  "alltext" "allmath"
+                   "alltext-nott"   "allmath-nott"
+                   "basictext"      "basicmath"
+                   "smallcaps" "footnotesize" "scriptsize" "normalfont"))
+    ;; 3.2 Character protrusion
+    ("factor")
+    ("patch"   ("all" "none" "item" "toc" "footnote" "eqnum"))
+    ("nopatch" ("all" "none" "item" "toc" "footnote" "eqnum"))
+    ("unit")
+    ;; 3.3 Font expansion
+    ("auto" ("true" "false"))
+    ("stretch")
+    ("step")
+    ("selected" ("true" "false"))
+    ;; 3.4 Tracking
+    ("letterspace")
+    ;; 3.5 Miscellaneous options
+    ("disable" ("true" "false" "ifdraft"))
+    ("verbose" ("true" "false" "errors" "silent"))
+    ("babel" ("true" "false"))
+    ;; "config" is allowed only when the package is loaded, so we add
+    ;; it below:
+    ;; ("config")
+    ("DVIoutput" ("true" "false")))
+  "Key=value options for microtype package.")
+
+(TeX-add-style-hook
+ "microtype"
+ (lambda ()
+
+   (TeX-add-symbols
+    '("microtypesetup"
+      (TeX-arg-key-val LaTeX-microtype-key-val-options))
+
+    ;; 4 Selecting fonts for micro-typography
+    '("DeclareMicrotypeSet"
+      [TeX-arg-completing-read-multiple ("protrusion" "expansion"
+                                         "tracking" "kerning" "spacing")
+                                        "Features"]
+      "Set name"
+      (TeX-arg-key-val (("encoding") ("family") ("series")
+                        ("shape")    ("size")   ("font"))))
+
+    '("DeclareMicrotypeSet*"
+      [TeX-arg-completing-read-multiple ("protrusion" "expansion"
+                                         "tracking" "kerning" "spacing")
+                                        "Features"]
+      "Set name"
+      (TeX-arg-key-val (("encoding") ("family") ("series")
+                        ("shape")    ("size")   ("font"))))
+
+    '("UseMicrotypeSet"
+      [TeX-arg-completing-read-multiple ("protrusion" "expansion"
+                                         "tracking" "kerning" "spacing")
+                                        "Features"]
+      "Set name")
+
+    '("DeclareMicrotypeSetDefault"
+      [TeX-arg-completing-read-multiple ("protrusion" "expansion"
+                                         "tracking" "kerning" "spacing")
+                                        "Features"]
+      "Set name")
+
+    ;; 5.1 Character protrusion
+    '("SetProtrusion"
+      [TeX-arg-key-val (("name") ("load") ("factor") ("unit") ("preset")
+                        ("inputenc") ("context"))]
+      2)
+
+    ;; 5.2 Font expansion
+    '("SetExpansion"
+      [TeX-arg-key-val (("name") ("load") ("factor") ("unit") ("preset")
+                        ("inputenc") ("context")
+                        ("auto") ("stretch") ("shrink") ("step"))]
+      2)
+
+    ;; 5.3 Tracking
+    '("SetTracking"
+      [TeX-arg-key-val (("name") ("unit") ("context") ("spacing")
+                        ("outer spacing") ("outer kerning") ("no ligatures"))]
+
+      2)
+
+    ;; 5.4 Additional kerning
+    '("SetExtraKerning"
+      [TeX-arg-key-val (("name") ("load") ("factor") ("preset") ("inputenc")
+                        ("unit") ("context"))]
+      2)
+
+    ;; 5.5 Interword spacing
+    '("SetExtraSpacing"
+      [TeX-arg-key-val (("name") ("load") ("factor") ("preset")
+                        ("inputenc") ("context") ("unit"))]
+      2)
+
+    ;; 5.6 Character inheritance
+    '("DeclareCharacterInheritance"
+      [TeX-arg-key-val (("inputenc"))]
+      2)
+
+    ;; 5.7 Configuration files
+    '("DeclareMicrotypeVariants" t)
+    '("DeclareMicrotypeVariants*" t)
+    '("DeclareMicrotypeAlias" "Font name" "Alias name")
+    '("LoadMicrotypeFile" "Font name")
+
+    ;; 6 Context-sensitive setup
+    '("microtypecontext"
+      (TeX-arg-key-val (("protrusion") ("expansion") ("activate")
+                        ("tracking") ("spacing") ("kerning"))))
+
+    '("textmicrotypecontext"
+      (TeX-arg-key-val (("protrusion") ("expansion") ("activate")
+                        ("tracking") ("spacing") ("kerning")))
+      "Text")
+
+    '("DeclareMicrotypeBabelHook"
+      "Language(s)"
+      (TeX-arg-key-val (("protrusion") ("expansion") ("activate")
+                        ("tracking") ("spacing") ("kerning"))))
+
+    ;; 7 Letterspacing revisited
+    '("textls" ["Amount"] "Text")
+    "lsstyle"
+    '("lslig" "Ligature")
+
+    ;; 8 Disabling ligatures
+    '("DisableLigatures" ["Characters"] t)
+
+    ;; 9 Being pedantic about protrusion
+    '("leftprotrusion" "Text")
+    '("rightprotrusion" "Text")
+    "noprotrusion"
+    "noprotrusionifhmode")
+
+   (LaTeX-add-environments
+    '("microtypecontext" LaTeX-env-args
+      (TeX-arg-key-val (("protrusion") ("expansion") ("activate")
+                        ("tracking") ("spacing") ("kerning")))))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("microtypesetup"      "{")
+                                ("DeclareMicrotypeSet" "*[{{")
+                                ("UseMicrotypeSet"     "[{")
+                                ("DeclareMicrotypeSetDefault"  "[{")
+                                ("SetProtrusion"       "[{{")
+                                ("SetExpansion"        "[{{")
+                                ("SetTracking"         "[{{")
+                                ("SetExtraKerning"     "[{{")
+                                ("SetExtraSpacing"     "[{{")
+                                ("DeclareCharacterInheritance" "[{{")
+                                ("DeclareMicrotypeVariants"    "*{")
+                                ("DeclareMicrotypeAlias"       "{{")
+                                ("LoadMicrotypeFile"   "{")
+                                ("microtypecontext"    "{")
+                                ("DeclareMicrotypeBabelHook"   "{{")
+                                ("DisableLigatures"    "[{"))
+                              'function)
+     (font-latex-add-keywords '(("textmicrotypecontext" "{{")
+                                ("textls"   "*[{"))
+                              'textual)
+     (font-latex-add-keywords '(("textls"   "*[{"))
+                              'type-command)
+     (font-latex-add-keywords '("lsstyle")
+                              'type-declaration)))
+ TeX-dialect)
+
+(defun LaTeX-microtype-package-options ()
+  "Read the microtype package options from the user."
+  (TeX-read-key-val t (append
+                       '((config))
+                       LaTeX-microtype-key-val-options)))
+
+;;; microtype.el ends here
diff --git a/style/midfloat.el b/style/midfloat.el
index 66d794c2eb..38a1e93228 100644
--- a/style/midfloat.el
+++ b/style/midfloat.el
@@ -1,6 +1,6 @@
 ;;; midfloat.el --- AUCTeX style for `midfloat.sty' (v1.1)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021, 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -32,6 +32,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 (TeX-add-style-hook
  "midfloat"
diff --git a/style/multibib.el b/style/multibib.el
new file mode 100644
index 0000000000..f3afa5c036
--- /dev/null
+++ b/style/multibib.el
@@ -0,0 +1,132 @@
+;;; multibib.el --- AUCTeX style for `multibib.sty'  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-01-18
+;; 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 Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
+
+;;; Commentary:
+
+;; This file adds support for `multibib.sty' v1.4 form 2008-12-10.
+
+;; Note for RefTeX users: multibib package allows multiple macro calls
+;; to load bibliography database files.  RefTeX bundled with Emacs
+;; 29.1 is adjusted to recognize this.  For prior Emacs versions, the
+;; following code in the preamble should suffice to "fool" AUCTeX and
+;; RefTeX for multiple bibliography calls:
+;;
+;;  \iffalse
+;;  \usepackage{biblatex}
+;;  \fi
+
+;;; Code:
+
+(require 'tex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+;; Setup for \newcites: Note that the macro is called \newcites and we
+;; choose the name newcite in order to get away with any un-natural
+;; plural form:
+(TeX-auto-add-type "multibib-newcite" "LaTeX")
+
+(defvar LaTeX-multibib-newcites-regexp
+  `(,(concat "\\\\newcites"
+             "[ \t\n\r%]*"
+             "{\\([^}]+\\)}")
+    1 LaTeX-auto-multibib-newcite)
+  "Matches the arguments of \\newcites from multibib package.")
+
+(defun LaTeX-multibib-auto-prepare ()
+  "Clear `LaTeX-auto-multibib-newcite' variables before parsing."
+  (setq LaTeX-auto-multibib-newcite nil))
+
+(defun LaTeX-multibib-auto-cleanup ()
+  "Process the parsed elements from \\newcites macro."
+  (when (LaTeX-multibib-newcite-list)
+    (let (suffix)
+      (dolist (elt (LaTeX-multibib-newcite-list))
+        (push (replace-regexp-in-string "[ %\n\r\t]" "" (car elt)) suffix))
+      (setq suffix (mapconcat #'identity suffix ","))
+      (dolist (elt (split-string suffix "," t))
+        (TeX-add-symbols
+         `(,(concat "cite" elt)
+           (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) ())
+           TeX-arg-cite)
+         `(,(concat "nocite" elt) TeX-arg-cite)
+         `(,(concat "bibliographystyle" elt) TeX-arg-bibstyle)
+         `(,(concat "bibliography" elt) TeX-arg-bibliography))
+        ;; RefTeX: Check if `reftex-bibliography-commands' is bound
+        ;; and append our newly defined entry to a local version of
+        ;; it:
+        (when (boundp 'reftex-bibliography-commands)
+          (add-to-list (make-local-variable 'reftex-bibliography-commands)
+                       (concat "bibliography" elt)
+                       t))
+        ;; Fontification
+        (when (and (featurep 'font-latex)
+                   (eq TeX-install-font-lock 'font-latex-setup))
+          (font-latex-add-keywords `((,(concat "cite" elt)   "[{")
+                                     (,(concat "nocite" elt) "{")
+                                     (,(concat "bibliography" elt) "{"))
+                                   'reference)
+          (font-latex-add-keywords `((,(concat "bibliographystyle" elt) "{"))
+                                   'function))))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-multibib-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-multibib-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(TeX-add-style-hook
+ "multibib"
+ (lambda ()
+
+   ;; Add 'multibib' to the parser:
+   (TeX-auto-add-regexp LaTeX-multibib-newcites-regexp)
+
+   (TeX-add-symbols
+    '("newcites"
+      (TeX-arg-eval
+       (lambda ()
+         (let ((suf (TeX-read-string
+                     (TeX-argument-prompt nil nil "Suffix"))))
+           (LaTeX-add-multibib-newcites suf)
+           (LaTeX-multibib-auto-cleanup)
+           (format "%s" suf))))
+      "Heading")
+    '("setbiblabelwidth" "Label"))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("newcites"         "{{")
+                                ("setbiblabelwidth" "{"))
+                              'function)))
+ TeX-dialect)
+
+(defvar LaTeX-multibib-package-options '("labeled" "resetlabels")
+  "Package options for the multibib package.")
+
+;;; multibib.el ends here
diff --git a/style/multirow.el b/style/multirow.el
index 25d9f96c0d..11ae34e6ba 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--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2018--2022 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <mje@inducks.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -30,6 +30,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/midfloat.el b/style/proc.el
similarity index 54%
copy from style/midfloat.el
copy to style/proc.el
index 66d794c2eb..30b86bed4f 100644
--- a/style/midfloat.el
+++ b/style/proc.el
@@ -1,10 +1,10 @@
-;;; midfloat.el --- AUCTeX style for `midfloat.sty' (v1.1)  -*- 
lexical-binding: t; -*-
+;;; proc.el --- AUCTeX style for `proc.cls'  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
-;; Created: 2021-12-11
+;; Created: 2022-06-12
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -21,31 +21,27 @@
 
 ;; 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.
+;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
 
 ;;; Commentary:
 
-;; This file adds support for `midfloat.sty' (v1.1) from 2012/05/29.
-;; `midfloat.sty' is part of TeXLive.
+;; This file adds support for `proc.cls' v1.3m form 2021-12-09.
 
 ;;; Code:
 
 (require 'tex)
 
+(defvar LaTeX-proc-class-options
+  '("a4paper" "letterpaper" "legalpaper" "executivepaper"
+    "landscape" "10pt" "11pt" "12pt" "oneside" "twoside" "draft" "final"
+    "notitlepage" "twocolumn" "leqno" "fleqn" "openbib")
+  "Package options for the proc class.")
+
 (TeX-add-style-hook
- "midfloat"
+ "proc"
  (lambda ()
-
-   ;; Add the only environment provided by the package:
-   (LaTeX-add-environments
-    '("strip" ["Top/Bottom skip"]))
-
-   ;; This is a glue, in LaTeX set with \setlength:
-   (LaTeX-add-lengths "stripsep"))
+   (TeX-run-style-hooks "article"))
  TeX-dialect)
 
-(defvar LaTeX-midfloat-package-options nil
-  "Package options for the midfloat package.")
-
-;;; midfloat.el ends here
+;;; proc.el ends here
diff --git a/style/scrpage2.el b/style/scrpage2.el
index dca55909e4..b6530afa45 100644
--- a/style/scrpage2.el
+++ b/style/scrpage2.el
@@ -28,6 +28,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
diff --git a/style/shortvrb.el b/style/shortvrb.el
index 5f8df9269a..e6de06080c 100644
--- a/style/shortvrb.el
+++ b/style/shortvrb.el
@@ -1,6 +1,6 @@
 ;;; shortvrb.el --- AUCTeX style for `shortvrb.sty'  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009, 2014, 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2009--2022 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -48,11 +48,19 @@
 (declare-function font-latex-add-to-syntax-alist
                   "font-latex"
                   (list))
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "shortvrb"
  (lambda ()
 
+   (TeX-add-symbols
+    '("MakeShortVerb"   (TeX-arg-string "Character" "\\"))
+    '("MakeShortVerb*"  (TeX-arg-string "Character" "\\"))
+    '("DeleteShortVerb" (TeX-arg-string "Character" "\\")))
+
    ;; Ispell: Add entries to `ispell-tex-skip-alist':
    (when LaTeX-shortvrb-chars
      (TeX-ispell-skip-setcar
@@ -61,13 +69,26 @@
                   (cons str str)))
               LaTeX-shortvrb-chars)))
 
+   ;; Syntax
+   ;; N.B. This doesn't handle backslash just before the closing
+   ;; delimiter like |xyz\| correctly.  We hope we can live with that.
+   (when LaTeX-shortvrb-chars
+     (let ((st (make-syntax-table (syntax-table))))
+       (dolist (c LaTeX-shortvrb-chars)
+         (modify-syntax-entry c "\"" st))
+       (set-syntax-table st)))
+
    ;; Fontification
    (when (and LaTeX-shortvrb-chars
               (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-to-syntax-alist
-      (mapcar (lambda (char) (cons char "|"))
-              LaTeX-shortvrb-chars))))
+      (mapcar (lambda (char) (cons char "\""))
+              LaTeX-shortvrb-chars))
+
+     (font-latex-add-keywords '(("MakeShortVerb"   "*{")
+                                ("DeleteShortVerb" "{"))
+                              'function)))
  TeX-dialect)
 
 ;;; shortvrb.el ends here
diff --git a/style/sidecap.el b/style/sidecap.el
index ff175173e6..0cc55b35d4 100644
--- a/style/sidecap.el
+++ b/style/sidecap.el
@@ -37,7 +37,7 @@
 (defun LaTeX-env-sidecap-float (environment)
   "Create ENVIRONMENT with \\caption and \\label commands.
 This function runs `LaTeX-env-figure' and inserts the first
-optional argument 'relwidth' provided by environments of the
+optional argument \\='relwidth\\=' provided by environments of the
 package sidecap."
   (let ((relwidth (TeX-read-string
                    (TeX-argument-prompt t nil "Relative caption width")))
diff --git a/style/tcolorboxlib-theorems.el b/style/tcolorboxlib-theorems.el
new file mode 100644
index 0000000000..8c4eb7d44c
--- /dev/null
+++ b/style/tcolorboxlib-theorems.el
@@ -0,0 +1,317 @@
+;;; tcolorboxlib-theorems.el --- AUCTeX style for `theorems' lib from 
tcolorbox  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-08-18
+;; 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 `theorems' library from tcolorbox.sty.
+;; It supports automatic parsing of newly defined environments with
+;; the '\newtcbtheorem' and addition of 'label={prefix:value}' to the
+;; optional arguments of environments.  To do so, users must make some
+;; additions to `LaTeX-label-alist' and `reftex-label-alist' if RefTeX
+;; is used (which is of course highly recommended).  Suppose a new
+;; environment 'Theorem' is defined like this:
+
+;; \newtcbtheorem{Theorem}{Theorem}{%
+;;   many key-values,
+;; }{}
+
+;; Note that the last mandatory argument 'prefix' is left empty.
+;; Suppose you want to use the 'thm' prefix for the labels, the
+;; additions look like this:
+;;
+;; For AUCTeX:
+;; (with-eval-after-load 'latex
+;;   (add-to-list 'LaTeX-label-alist '("Theorem" . "thm") t))
+;;
+;; For AUCTeX and RefTeX:
+;; (with-eval-after-load 'latex
+;;   (add-to-list 'LaTeX-label-alist '("Theorem" . "thm") t))
+;;
+;; (with-eval-after-load 'reftex-vars
+;;   (add-to-list 'reftex-label-alist
+;;                '("Theorem" ?m "thm:" "~\\ref{%s}"
+;;                  LaTeX-tcolorbox-lib-theorems-reftex-label-context-function
+;;                  ("Theorem" "theorem") nil)
+;;                t))
+;;
+;; This file defines the function
+;; `LaTeX-tcolorbox-lib-theorems-reftex-label-context-function' which
+;; extracts the context for RefTeX in Select Label buffer.
+
+;;; Code:
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
+(declare-function LaTeX-tcolorbox-keyval-options "tcolorbox" ())
+(defvar LaTeX-tcolorbox-keyval-options-full)
+
+;; Needed for auto-parsing:
+(require 'tex)
+(require 'latex)
+
+(defvar LaTeX-tcolorbox-lib-theorems-keyval-options
+  '(;; 18.2 Option Keys of the Library
+    ("separator sign")
+    ("separator sign colon")
+    ("separator sign dash")
+    ("separator sign none")
+    ("description delimiters" ("{}{}"))
+    ("description delimiters parenthesis")
+    ("description delimiters none")
+    ("description color")
+    ("description font"
+     ("\\rmfamily" "\\sffamily" "\\ttfamily" "\\mdseries" "\\bfseries"
+      "\\upshape" "\\itshape" "\\slshape" "\\scshape"
+      "\\tiny"  "\\scriptsize" "\\footnotesize"
+      "\\small" "\\normalsize" "\\large"
+      "\\Large" "\\LARGE" "\\huge" "\\Huge" "\\normalfont"))
+    ("description formatter")
+    ("terminator sign")
+    ("terminator sign colon")
+    ("terminator sign dash")
+    ("terminator sign none")
+    ("label separator")
+    ("theorem full label supplement")
+    ("theorem label supplement" ("{}"))
+    ("theorem hanging indent")
+    ("theorem name and number")
+    ("theorem number and name")
+    ("theorem name")
+    ("theorem number")
+    ("theorem" ("{}{}{}{}"))
+    ("highlight math")
+    ("highlight math style" ("{}"))
+    ("math upper")
+    ("math lower")
+    ("math")
+    ("ams equation upper")
+    ("ams equation lower")
+    ("ams equation")
+    ("ams equation* upper")
+    ("ams equation* lower")
+    ("ams equation*")
+    ("ams align upper")
+    ("ams align lower")
+    ("ams align")
+    ("ams align* upper")
+    ("ams align* lower")
+    ("ams align*")
+    ("ams gather upper")
+    ("ams gather lower")
+    ("ams gather")
+    ("ams gather* upper")
+    ("ams gather* lower")
+    ("ams gather*")
+    ("ams nodisplayskip upper")
+    ("ams nodisplayskip lower")
+    ("ams nodisplayskip")
+    ("theorem style" ("standard" "change standard"
+                      "plain" "break" "plain apart"
+                      "change" "change break" "change apart"
+                      "margin" "margin break" "margin apart")))
+  "Key=value options for theorems library from tcolorbox.")
+
+(defun LaTeX-tcolorbox-lib-theorems-keyval-options ()
+  "Return an updated list of key=vals for the theorems library."
+  (append
+   ;; `tcolorbox' loads the style `xcolor.el', so we use
+   ;; `LaTeX-xcolor-definecolor-list' right away:
+   (let ((colors (mapcar #'car (LaTeX-xcolor-definecolor-list)))
+         (colkeys '("description color"))
+         result)
+     (dolist (key colkeys result)
+       (push (list key colors) result)))
+   (let ((lengths (cons "auto" (mapcar (lambda (x)
+                                         (concat TeX-esc (car x)))
+                                       (LaTeX-length-list))))
+         (lenkeys '("theorem hanging indent"))
+         result)
+     (dolist (key lenkeys result)
+       (push (list key lengths) result)))
+   LaTeX-tcolorbox-lib-theorems-keyval-options))
+
+(defun LaTeX-tcolorbox-lib--theorems-keyval-options ()
+  "Return key=vals from theorems library incl. standard ones."
+  (append (LaTeX-tcolorbox-keyval-options)
+          (LaTeX-tcolorbox-lib-theorems-keyval-options)))
+
+;; Setup for \newtcbtheorem:
+(TeX-auto-add-type "tcolorbox-lib-theorems-newtcbtheorem" "LaTeX")
+
+(defvar LaTeX-tcolorbox-lib-theorems-newtcbtheorem-regexp
+  `(,(concat "\\\\newtcbtheorem"
+             "[ \t\n\r%]*"
+             ;; Init options:
+             "\\(?:"
+             (LaTeX-extract-key-value-label 'none)
+             "\\)?"
+             "[ \t\n\r%]*"
+             ;; Name of the environment
+             "{\\([^}]+\\)}")
+    1 LaTeX-auto-tcolorbox-lib-theorems-newtcbtheorem)
+  "Matches the name of new env defined with \\newtcbtheorem macro.")
+
+(defun LaTeX-tcolorbox-lib-theorems-auto-prepare ()
+  "Reset `LaTeX-auto-tcolorbox-lib-theorems-newtcbtheorem' before parsing."
+  (setq LaTeX-auto-tcolorbox-lib-theorems-newtcbtheorem nil))
+
+(defun LaTeX-tcolorbox-lib-theorems-auto-cleanup ()
+  "Process user defined theorems with \\newtcbtheorem."
+  (dolist (elt (LaTeX-tcolorbox-lib-theorems-newtcbtheorem-list))
+    (let ((env (car elt)))
+      ;; Add newly defined env's to AUCTeX:
+      (LaTeX-add-environments
+       `(,env LaTeX-env-tcolorbox-lib-theorems)
+       `(,(concat env "*") LaTeX-env-tcolorbox-lib-theorems))
+      ;; RefTeX: Make `reftex-label-regexps' buffer local and add env
+      ;; to it:
+      (when (boundp 'reftex-label-regexps)
+        (make-local-variable 'reftex-label-regexps)
+        (add-to-list 'reftex-label-regexps
+                     (concat
+                      (regexp-quote TeX-esc)
+                      "begin[[:space:]]*"
+                      (regexp-quote TeX-grop)
+                      (regexp-quote env)
+                      (regexp-quote TeX-grcl)
+                      "[[:space:]]*"
+                      (LaTeX-extract-key-value-label "label" 1))
+                     t)))))
+
+(add-hook 'TeX-auto-prepare-hook
+          #'LaTeX-tcolorbox-lib-theorems-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook
+          #'LaTeX-tcolorbox-lib-theorems-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-env-tcolorbox-lib-theorems (environment)
+  "Insert theorems ENVIRONMENT, ask for arguments and insert a label."
+  (LaTeX-insert-environment
+   environment
+   (let ((opts (TeX-read-key-val t 
(LaTeX-tcolorbox-lib--theorems-keyval-options)))
+         (title (TeX-read-string
+                 (TeX-argument-prompt nil nil "Title"))))
+     (concat
+      (when (and opts (not (string= opts "")))
+        (format "[%s]" opts))
+      (concat TeX-grop title TeX-grcl)
+      (unless (string= (substring-no-properties environment -1) "*")
+        (concat TeX-grop TeX-grcl)))))
+  (unless (string= (substring-no-properties environment -1) "*")
+    (LaTeX-env-label-as-keyval nil nil nil environment)))
+
+(defun LaTeX-arg-tcolorbox-lib-theorems-newtcbtheorem (optional)
+  "Query and insert arguments of \\newtcbtheorem macro.
+If OPTIONAL is non-nil, insert the argument in brackets in not
+empty."
+  (let ((env (TeX-read-string
+              (TeX-argument-prompt optional nil "Name")))
+        (disp-name (TeX-read-string
+                    (TeX-argument-prompt optional nil "Display Name")))
+        (opts (TeX-read-key-val optional
+                                
(LaTeX-tcolorbox-lib--theorems-keyval-options))))
+    (LaTeX-add-tcolorbox-lib-theorems-newtcbtheorems env)
+    (LaTeX-tcolorbox-lib-theorems-auto-cleanup)
+    (TeX-argument-insert env optional)
+    (TeX-argument-insert disp-name optional)
+    (TeX-argument-insert opts optional)
+    ;; Our 'prefix' argument is always empty as we insert the 'label'
+    ;; key with a full label value:
+    (insert TeX-grop TeX-grcl)))
+
+(defun LaTeX-tcolorbox-lib-theorems-reftex-label-context-function (env)
+  "Return a context string for RefTeX in ENV."
+  (let* ((envstart (save-excursion
+                     (re-search-backward
+                      (concat (regexp-quote TeX-esc)
+                              "begin[[:space:]]*"
+                              (regexp-quote TeX-grop)
+                              (regexp-quote env)
+                              (regexp-quote TeX-grcl)))))
+         (label-key (save-excursion
+                      (re-search-backward "\\<label[ \t\n\r%]*=[ \t\n\r%]*"
+                                          envstart t))))
+    (if label-key
+        (save-excursion
+          (goto-char label-key)
+          ;; Move out of the optional argument:
+          (up-list)
+          ;; Move until the beginning of the title with {:
+          (skip-chars-forward (concat "^" TeX-grop))
+          ;; Return the title string:
+          (buffer-substring-no-properties (1+ (point))
+                                          (progn
+                                            (forward-list)
+                                            (1- (point)))))
+      (error "No label found"))))
+
+(TeX-add-style-hook
+ "tcolorboxlib-theorems"
+ (lambda ()
+
+   ;; Add the style to the parser
+   (TeX-auto-add-regexp LaTeX-tcolorbox-lib-theorems-newtcbtheorem-regexp)
+
+   ;; Register key-vals from library to `LaTeX-tcolorbox-keyval-options-full':
+   (add-to-list 'LaTeX-tcolorbox-keyval-options-full
+                'LaTeX-tcolorbox-lib-theorems-keyval-options)
+
+   ;; This library loads amsmath:
+   (TeX-run-style-hooks "amsmath")
+
+   (TeX-add-symbols
+    ;; 18.1 Macros of the Library
+    '("newtcbtheorem"
+      [TeX-arg-key-val LaTeX-tcolorbox-init-options]
+      LaTeX-arg-tcolorbox-lib-theorems-newtcbtheorem)
+
+    `("renewtcbtheorem"
+      [TeX-arg-key-val LaTeX-tcolorbox-init-options]
+      (TeX-arg-competing-read (tcolorbox-lib-theorems-newtcbtheorem-list) 
"Name")
+      "Display Name"
+      (TeX-arg-key-val (LaTeX-tcolorbox-lib--theorems-keyval-options))
+      (TeX-arg-literal ,TeX-grop ,TeX-grcl))
+
+    '("tcboxmath"
+      [TeX-arg-key-val (LaTeX-tcolorbox-lib--theorems-keyval-options)]
+      t)
+
+    '("tcbhighmath"
+      [TeX-arg-key-val (LaTeX-tcolorbox-lib--theorems-keyval-options)]
+      t))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("newtcbtheorem"   "[{{{{")
+                                ("renewtcbtheorem" "[{{{{"))
+                              'function)))
+ LaTeX-dialect)
+
+;;; tcolorboxlib-theorems.el ends here
diff --git a/style/tikz.el b/style/tikz.el
index f3a50bc404..565e6b0aa4 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -1,6 +1,6 @@
 ;;; tikz.el --- AUCTeX style for `tikz.sty'  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022  Free Software Foundation, Inc.
 
 ;; Author: Matthew Leach <matthew@mattleach.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -53,8 +53,7 @@
                        `((,(concat "+" key) ,value "+")
                          (,(concat "++" key) ,value "++"))))
                    TeX-TikZ-point-function-map))
-  "`TeX-TikZ-point-function-map' with \"+\" and \"++\" as a
-prefix.")
+  "`TeX-TikZ-point-function-map' with \"+\" and \"++\" as a prefix.")
 
 (defconst TeX-TikZ-path-connector-function-map
   '(("--" identity)
@@ -73,7 +72,7 @@ prefix.")
     ("Arc" TeX-TikZ-arg-arc)
     ("Parabola" TeX-TikZ-arg-parabola)
     ("Grid" TeX-TikZ-arg-grid))
-  "An alist of argument names and functoins for TikZ's \draw.")
+  "An alist of argument names and functions for TikZ's \\draw.")
 
 (defun TeX-TikZ-get-opt-arg-string (arg &optional open close)
   "Return a string for optional arguments.
@@ -199,7 +198,7 @@ is finished."
   "Find TiKZ named points in current enviroment.
 Begin by finding the span of the current TikZ enviroment and then
 searching within that span to find all named-points and return
-them as a list of strings, dropping the '()'."
+them as a list of strings, dropping the \\='()\\='."
   (let* ((env-end (save-excursion
                     (LaTeX-find-matching-end)
                      (point)))
@@ -232,7 +231,7 @@ them as a list of strings, dropping the '()'."
 (defun TeX-TikZ-arg-bend (optional)
   "Prompt the user for a bend argument.
 If OPTIONAL is non-nil and the user doesn't provide a point,
-  return \"\"."
+return \"\"."
   (let ((point
          (TeX-TikZ-single-macro-arg TeX-TikZ-point-function-map
                                     (TeX-argument-prompt optional nil "Bend 
point")
diff --git a/style/ulem.el b/style/ulem.el
index f84fcc60d9..fa9cefb066 100644
--- a/style/ulem.el
+++ b/style/ulem.el
@@ -1,6 +1,6 @@
 ;;; ulem.el --- AUCTeX style for `ulem.sty'  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022  Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <mje@inducks.org>
 ;; Keywords: tex
@@ -29,6 +29,7 @@
 ;;; Code:
 
 (require 'tex)
+(require 'latex)
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
@@ -68,14 +69,15 @@
      ;; Tell font-lock about the update.
      (font-latex-add-keywords '(("useunder" "{{{"))
                               'function)
+     (font-latex-add-keywords '(("sout" "{")
+                                ("xout" "{"))
+                              'textual)
      (font-latex-add-keywords '(("uline" "{")
                                 ("uuline" "{")
                                 ("uwave" "{")
-                                ("sout" "{")
-                                ("xout" "{")
                                 ("dashuline" "{")
                                 ("dotuline" "{"))
-                              'textual)))
+                              'underline-command)))
  TeX-dialect)
 
 (defvar LaTeX-ulem-fontdecl
diff --git a/style/xltabular.el b/style/xltabular.el
index 3fb3e0d220..bcd190b7ce 100644
--- a/style/xltabular.el
+++ b/style/xltabular.el
@@ -87,11 +87,12 @@ nested curly brace pair nor escaped \"}\".")
       (insert TeX-grop caption)
       ;; ask for a label and insert it
       (LaTeX-label environment 'environment)
-      ;; the longtable `\caption' is equivalent to a
-      ;; `\multicolumn', so it needs a `\\' at the
-      ;; end of the line.  Prior to that, add } to
-      ;; close `\caption{'
-      (insert TeX-grcl "\\\\")
+      ;; the longtable `\caption' is equivalent to a `\multicolumn',
+      ;; so it needs a `\\' at the end of the line.  Prior to that,
+      ;; add } to close `\caption{' and a space:
+      (insert TeX-grcl)
+      (just-one-space)
+      (insert "\\\\")
       ;; fill the caption
       (when auto-fill-function (LaTeX-fill-paragraph))
       ;; Insert a new line and indent
diff --git a/style/xparse.el b/style/xparse.el
index fd9bb328b0..b2a2fb051b 100644
--- a/style/xparse.el
+++ b/style/xparse.el
@@ -1,6 +1,6 @@
 ;;; xparse.el --- AUCTeX style for `xparse.sty' version 2020-03-06  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013, 2020, 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2020--2022 Free Software Foundation, Inc.
 
 ;; Maintainer: auctex-devel@gnu.org
 ;; Author: Mosè Giordano <mose@gnu.org>
@@ -311,6 +311,9 @@ TYPE is one of the symbols mac or env."
     '("IfValueTF" 3)
     '("IfValueT" 2)
     '("IfValueF" 2)
+    '("IfBlankTF" 3)
+    '("IfBlankT" 2)
+    '("IfBlankF" 2)
     "BooleanTrue"
     "BooleanFalse"
     ;; Argument processors
diff --git a/tests/latex/doctex-indent-in.dtx b/tests/latex/doctex-indent-in.dtx
index 4f439588a7..8d6081ca8d 100644
--- a/tests/latex/doctex-indent-in.dtx
+++ b/tests/latex/doctex-indent-in.dtx
@@ -33,6 +33,12 @@
 % \DescribeEnv{YOURENV}
 % Put description of |YOURENV| here.
 %
+%\begin{verbatim}
+%              Some
+%verbatim
+%        content
+%\end{verbatim}
+%
 % \StopEventually{\PrintIndex}
 %
 % \section{Implementation}
diff --git a/tests/latex/doctex-indent-out.dtx 
b/tests/latex/doctex-indent-out.dtx
index 2bdcf40cbe..432d969b9b 100644
--- a/tests/latex/doctex-indent-out.dtx
+++ b/tests/latex/doctex-indent-out.dtx
@@ -33,6 +33,12 @@
 % \DescribeEnv{YOURENV}
 % Put description of |YOURENV| here.
 %
+%\begin{verbatim}
+%              Some
+%verbatim
+%        content
+%\end{verbatim}
+%
 % \StopEventually{\PrintIndex}
 %
 % \section{Implementation}
diff --git a/tests/latex/latex-filling-in.tex b/tests/latex/latex-filling-in.tex
index 0d97fcf08b..16c314f95b 100644
--- a/tests/latex/latex-filling-in.tex
+++ b/tests/latex/latex-filling-in.tex
@@ -1,3 +1,7 @@
+\documentclass{article}
+\usepackage{shortvrb}
+\begin{document}
+
 Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod \(0 = 1\) 
tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore magna aliqua.  Ut 
enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit 
laboriosam, nisi ut aliquid ex ea commodi consequatur.
 
 \begin{tabular}{| l | l | l | l |}
@@ -68,3 +72,18 @@ Mauris ac felis vel velit tristique imperdiet.  Vestibulum 
convallis, lorem a te
 Mauris ac felis vel velit tristique imperdiet.  Vestibulum convallis, lorem a 
 tempus semper, dui dui euismod elit, vitae placerat urna tortor vitae lacus.\\
   Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at 
vulputate neque nulla lacinia eros.  Aliquam posuere.  Cum sociis natoque 
penatibus et magnis dis parturient montes, nascetur ridiculus mus.%  
+
+% bug#56160-1 Line break should be suppressed inside \verb|...|.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, \verb|sed do|eiusmod 
tempor
+
+% bug#56160-2 Line break should be suppressed inside shortcuts defined
+% in `LaTeX-shortvrb-chars'.  The variable itself is let-bound to
+% '(?\") in the function `LaTeX-filling' in latex-test.el.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, "sed do"eiusmod tempor
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/tests/latex/latex-filling-out.tex 
b/tests/latex/latex-filling-out.tex
index bf326d16c7..18dec27ccc 100644
--- a/tests/latex/latex-filling-out.tex
+++ b/tests/latex/latex-filling-out.tex
@@ -1,3 +1,7 @@
+\documentclass{article}
+\usepackage{shortvrb}
+\begin{document}
+
 Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod
 \(0 = 1\) tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore
 magna aliqua.  Ut enim ad minim veniam, quis nostrum exercitationem
@@ -76,3 +80,20 @@ Fusce sagittis, libero non molestie mollis, magna orci 
ultrices dolor,
 at vulputate neque nulla lacinia eros.  Aliquam posuere.  Cum sociis
 natoque penatibus et magnis dis parturient montes, nascetur ridiculus
 mus.%
+
+% bug#56160-1 Line break should be suppressed inside \verb|...|.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+\verb|sed do|eiusmod tempor
+
+% bug#56160-2 Line break should be suppressed inside shortcuts defined
+% in `LaTeX-shortvrb-chars'.  The variable itself is let-bound to
+% '(?\") in the function `LaTeX-filling' in latex-test.el.
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+"sed do"eiusmod tempor
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index d5f267e418..c82b240fcd 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -154,7 +154,11 @@
            (with-temp-buffer
              (insert-file-contents LaTeX-filling/in)
              (LaTeX-mode)
-             (let ((fill-column 70))
+             (let ((fill-column 70)
+                   (LaTeX-shortvrb-chars '(?\"))
+                   (TeX-parse-self t))
+               (TeX-update-style t)
+               (search-forward "Lorem")
                (fill-paragraph)
 
                (let ((cmds '("captionsetup" "caption"
@@ -166,7 +170,7 @@
                      (fill-paragraph))))
 
                (while (search-forward "% bug#" nil t)
-                 (forward-line 1)
+                 (TeX-forward-comment-skip 1)
                  (fill-paragraph)))
              (buffer-string))
            (with-temp-buffer
diff --git a/tests/tex/error-parsing.el b/tests/tex/error-parsing.el
index 0bca37d798..afdf3f970b 100644
--- a/tests/tex/error-parsing.el
+++ b/tests/tex/error-parsing.el
@@ -1,6 +1,6 @@
 ;;; error-parsing.el --- tests for error parsing  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2016-2022  Free Software Foundation, Inc.
 
 ;; This file is part of AUCTeX.
 
@@ -34,7 +34,12 @@
              (setq TeX-debug-warnings t
                    TeX-debug-bad-boxes t)
              (insert-file-contents TeX-test-compilation-log)
-             (TeX-parse-all-errors)
+             ;; Set `default-directory' so that `TeX-parse-error' can
+             ;; find dummy file "./test.tex".
+            (let ((default-directory
+                     (expand-file-name
+                      (file-name-directory TeX-test-compilation-log))))
+               (TeX-parse-all-errors))
              TeX-error-list)
            '((warning
               "./nice-class.cls" 32
diff --git a/tests/tex/test.tex b/tests/tex/test.tex
new file mode 100644
index 0000000000..d7d69b4daf
--- /dev/null
+++ b/tests/tex/test.tex
@@ -0,0 +1 @@
+This is a dummy file for `TeX-error-parsing' in error-parsing.el.
diff --git a/tex-bar.el b/tex-bar.el
index a9863f8893..9df6c8700e 100644
--- a/tex-bar.el
+++ b/tex-bar.el
@@ -202,7 +202,7 @@ format of the argument MEANING-ALIST in the mentioned 
function."
         (insert (format "\n\n`%s' provides the following buttons:\n  " (car 
i)))
         (dolist (j (cdr i))
           (insert (format " %s" j)))
-        (fill-region (point-at-bol) (point-at-eol))))
+        (fill-region (line-beginning-position) (line-end-position))))
     (display-buffer "*TeX tool bar buttons*" t)))
 
 ;;; Installation of the tool bar
@@ -342,7 +342,7 @@ format of the argument MEANING-ALIST in the mentioned 
function."
         (insert (format "\n\n`%s' provides the following buttons:\n  " (car 
i)))
         (dolist (j (cdr i))
           (insert (format " %s" j)))
-        (fill-region (point-at-bol) (point-at-eol))))
+        (fill-region (line-beginning-position) (line-end-position))))
     (display-buffer "*TeX tool bar buttons*" t)))
 
 ;;; Installation of the tool bar
diff --git a/tex-fold.el b/tex-fold.el
index 6d50f31404..6f74f75a3c 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -311,8 +311,8 @@ and `TeX-fold-math-spec-list', and environments in 
`TeX-fold-env-spec-list'."
 
 (defun TeX-fold-region-macro-or-env (start end type)
   "Fold all items of type TYPE in region from START to END.
-TYPE can be one of the symbols 'env for environments, 'macro
-for macros and 'math for math macros."
+TYPE can be one of the symbols `env' for environments, `macro'
+for macros and `math' for math macros."
   (save-excursion
     (let (fold-list item-list regexp)
       (dolist (item (cond ((eq type 'env) TeX-fold-env-spec-list-internal)
diff --git a/tex-info.el b/tex-info.el
index 66e57517b8..2ee3d7acc1 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -680,7 +680,6 @@ value of `Texinfo-mode-hook'."
        (concat "@\\("
                (mapconcat #'car texinfo-section-list "\\>\\|")
                "\\>\\)"))
-  (set (make-local-variable 'outline-level) 'texinfo-outline-level)
 
   ;; Mostly AUCTeX stuff
   (set (make-local-variable 'TeX-command-current) #'TeX-command-master)
diff --git a/tex-ispell.el b/tex-ispell.el
index c743bafdad..adf91f879b 100644
--- a/tex-ispell.el
+++ b/tex-ispell.el
@@ -62,6 +62,7 @@
 ;; minted.sty
 ;; nameref.sty
 ;; pythontex.sty
+;; shortvrb.sty
 ;; siunitx.sty
 ;; splitidx.sty
 ;; stabular.sty
@@ -212,6 +213,10 @@
       ("inputpygments" . 1)
       ("setpygmentsfv" . 1)
       ("setpygmentspygopt" . 1)
+      ;; shortvrb.sty
+      ("MakeShortVerb" . 1)
+      ("MakeShortVerb*" . 1)
+      ("DeleteShortVerb" . 1)
       ;; siunitx.sty
       ("num" . 1)
       ("si" . 1)
diff --git a/tex.el b/tex.el
index 747753b319..1497f2281c 100644
--- a/tex.el
+++ b/tex.el
@@ -51,14 +51,11 @@
                   (bus service path interface method &rest args))
 (declare-function dbus-register-signal "ext:dbus"
                   (bus service path interface signal handler &rest args))
-(declare-function LaTeX-environment-list "latex"
-                  nil)
-(declare-function LaTeX-bibliography-list "latex"
-                  nil)
-(declare-function comint-exec
+(declare-function LaTeX-environment-list "latex" nil)
+(declare-function LaTeX-bibliography-list "latex" nil)
+(declare-function comint-exec "ext:comint"
                   (buffer name command startfile switches))
-(declare-function comint-mode
-                  nil)
+(declare-function comint-mode "ext:comint" nil)
 (declare-function tex--prettify-symbols-compose-p "ext:tex-mode"
                   (start end match))
 (declare-function gnuserv-start "ext:gnuserv"
@@ -100,6 +97,7 @@
 (defvar Info-file-list-for-emacs)       ; info.el
 (defvar ispell-parser)                  ; ispell.el
 (defvar compilation-error-regexp-alist) ; compile.el
+(defvar compilation-in-progress)        ; compile.el
 
 (defgroup TeX-file nil
   "Files used by AUCTeX."
@@ -595,6 +593,7 @@ string."
     ;; adds suitable quotes for use in shell command line.
     ("%s" TeX-active-master-with-quotes nil t)
     ("%t" TeX-active-master-with-quotes t t)
+    ("%(s-filename-only)" TeX-active-master-with-quotes nil t nil nil 
file-name-nondirectory)
     ("%(t-filename-only)" TeX-active-master-with-quotes t t nil nil 
file-name-nondirectory)
     ;; If any TeX codes appear in the interval between %` and %', move
     ;; all of them after the interval and supplement " \input".  The
@@ -639,7 +638,7 @@ string."
                   (concat TeX-command-text " \"\\input\""))
               "")))
     ;; The fourth argument of t directs to supply "\detokenize{}" when
-    ;; necessary. See doc string and comment of
+    ;; necessary.  See doc string and comment of
     ;; `TeX-active-master-with-quotes'.
     ("%T" TeX-active-master-with-quotes t t nil t)
     ("%n" TeX-current-line)
@@ -767,53 +766,41 @@ overlays between two existing ones.")
 ;; which results in a void-variable error if crm hasn't been loaded before.
 (require 'crm)
 
-(if (or (and (= emacs-major-version 24) (>= emacs-minor-version 4))
-        (>= emacs-major-version 25))
-    ;; For GNU Emacs 24.4 or later, based on `completing-read-multiple' of
-    ;; git commit b14abca9476cba2f500b5eda89441d593dd0f12b
-    ;;   2013-01-10  * lisp/emacs-lisp/crm.el: Allow any regexp for separators.
-    (defun TeX-completing-read-multiple
-        (prompt table &optional predicate require-match initial-input
-                hist def inherit-input-method)
-      "Like `completing-read-multiple' which see.
+;; For GNU Emacs 24.4 or later, based on `completing-read-multiple' of
+;; git commit b14abca9476cba2f500b5eda89441d593dd0f12b
+;;   2013-01-10  * lisp/emacs-lisp/crm.el: Allow any regexp for separators.
+(defun TeX-completing-read-multiple
+    (prompt table &optional predicate require-match initial-input
+            hist def inherit-input-method)
+  "Like `completing-read-multiple' which see.
 Retain zero-length substrings but ensure that empty input results
 in nil across different emacs versions."
-      (unwind-protect
-          (progn
-            (add-hook 'choose-completion-string-functions
-                      #'crm--choose-completion-string)
-            (let* ((minibuffer-completion-table #'crm--collection-fn)
-                   (minibuffer-completion-predicate predicate)
-                   ;; see completing_read in src/minibuf.c
-                   (minibuffer-completion-confirm
-                    (unless (eq require-match t) require-match))
-                   (crm-completion-table table)
-                   (map (if require-match
-                            crm-local-must-match-map
-                          crm-local-completion-map))
-                   ;; If the user enters empty input, `read-from-minibuffer'
-                   ;; returns the empty string, not DEF.
-                   (input (read-from-minibuffer
-                           prompt initial-input map
-                           nil hist def inherit-input-method))
-                   result)
-              (and def (string-equal input "") (setq input def))
-              (if (equal (setq result (split-string input crm-separator))
-                         '(""))
-                  nil
-                result)))
-        (remove-hook 'choose-completion-string-functions
-                     #'crm--choose-completion-string)))
-  ;; For GNU Emacs <= 24.3.
-  (defun TeX-completing-read-multiple
-      (prompt table &optional predicate require-match initial-input
-              hist def inherit-input-method)
-    "Like `completing-read-multiple' which see.
-Ensures that empty input results in nil across different emacs versions."
-    (let ((result (completing-read-multiple prompt table predicate
-                                            require-match initial-input
-                                            hist def inherit-input-method)))
-      (if (equal result '("")) nil result))))
+  (unwind-protect
+      (progn
+        (add-hook 'choose-completion-string-functions
+                  #'crm--choose-completion-string)
+        (let* ((minibuffer-completion-table #'crm--collection-fn)
+               (minibuffer-completion-predicate predicate)
+               ;; see completing_read in src/minibuf.c
+               (minibuffer-completion-confirm
+                (unless (eq require-match t) require-match))
+               (crm-completion-table table)
+               (map (if require-match
+                        crm-local-must-match-map
+                      crm-local-completion-map))
+               ;; If the user enters empty input, `read-from-minibuffer'
+               ;; returns the empty string, not DEF.
+               (input (read-from-minibuffer
+                       prompt initial-input map
+                       nil hist def inherit-input-method))
+               result)
+          (and def (string-equal input "") (setq input def))
+          (if (equal (setq result (split-string input crm-separator))
+                     '(""))
+              nil
+            result)))
+    (remove-hook 'choose-completion-string-functions
+                 #'crm--choose-completion-string)))
 
 (defun TeX-read-string (prompt &optional initial-input history default-value)
   (read-string prompt initial-input history default-value t))
@@ -1098,7 +1085,7 @@ The following built-in predicates are available:
   :type '(alist :key-type symbol :value-type (group sexp)))
 
 ;; XXX: Atril and xreader are forks of Evince and share an almost
-;; identical interface with it. Instead of having different functions
+;; identical interface with it.  Instead of having different functions
 ;; for each program, we keep the original *-evince-* functions and
 ;; make them accept arguments to specify the actual name of the
 ;; program and the desktop environment, that will be used to set up
@@ -1307,7 +1294,15 @@ viewer."
        ("zathura %o"
         (mode-io-correlate
          " --synctex-forward %n:0:\"%b\" -x \"emacsclient +%{line} 
%{input}\""))
-       "zathura"))))
+       "zathura")
+      ("Sioyek"
+       ("sioyek %o"
+        (mode-io-correlate
+         ,(concat
+           " --forward-search-file \"%b\""
+           " --forward-search-line %n"
+           " --inverse-search \"emacsclient +%2 %1\"")))
+       "sioyek"))))
   "Alist of built-in viewer specifications.
 This variable should not be changed by the user who can use
 `TeX-view-program-list' to add new viewers or overwrite the
@@ -1526,7 +1521,7 @@ Check the `TeX-view-program-selection' variable" viewer)))
     (xetex "XeTeX" "xetex" "xelatex" "xetex")
     ;; Some lualatex versions before 0.71 would use "texput" as file
     ;; name if --jobname were not supplied
-    (luatex "LuaTeX" "luatex" "lualatex --jobname=%s" "luatex")
+    (luatex "LuaTeX" "luatex" "lualatex --jobname=%(s-filename-only)" "luatex")
     (omega "Omega" TeX-Omega-command LaTeX-Omega-command ConTeXt-Omega-engine))
   "Alist of built-in TeX engines and associated commands.
 For a description of the format see `TeX-engine-alist'.")
@@ -1737,8 +1732,8 @@ If this is nil, an empty string will be returned."
           (concat TeX-source-specials-tex-flags
                   (if TeX-source-specials-places
                       ;; -src-specials=WHERE: insert source specials
-                      ;; in certain places of the DVI file. WHERE is a
-                      ;; comma-separated value list: cr display hbox
+                      ;; in certain places of the DVI file.  WHERE is
+                      ;; a comma-separated value list: cr display hbox
                       ;; math par parend vbox
                       (concat "=" (mapconcat #'identity
                                              TeX-source-specials-places ","))))
@@ -2748,10 +2743,10 @@ Used when checking if any files have changed."
 
 (define-obsolete-variable-alias 'LaTeX-dialect 'TeX-dialect "13.0")
 (defconst TeX-dialect :latex
-  "Default dialect for use with function `TeX-add-style-hook' for
-argument DIALECT-EXPR when the hook is to be run only on LaTeX
-file, or any mode derived thereof. See variable
-`TeX-style-hook-dialect'." )
+  "Default dialect for use with function `TeX-add-style-hook'.
+This applies to the argument DIALECT-EXPR when the hook is to be
+run only on LaTeX file, or any mode derived thereof.  See
+variable `TeX-style-hook-dialect'." )
 
 (defvar TeX-style-hook-list nil
   "List of TeX style hooks currently loaded.
@@ -2950,8 +2945,9 @@ found in DIALECT-LIST and return the list thereof."
     ret)))
 
 (defun TeX-unload-style (style &optional dialect-list)
-  "Forget that we once loaded STYLE. If DIALECT-LIST is provided
-the STYLE is only removed for those dialects in DIALECT-LIST.
+  "Forget that we once loaded STYLE.
+If DIALECT-LIST is provided, the STYLE is only removed for those
+dialects in DIALECT-LIST.
 
 See variable `TeX-style-hook-dialect' for supported dialects."
   (let ((style-data (assoc-string style TeX-style-hook-list)))
@@ -3764,12 +3760,20 @@ The algorithm is as follows:
   ;;                           (make-display-table)))
   ;;  (aset buffer-display-table ?\t (apply 'vector (append "<TAB>" nil)))
 
-  ;; Symbol completion.
-  (set (make-local-variable 'TeX-complete-list)
-       (list (list "\\\\\\([a-zA-Z]*\\)"
-                   1 'TeX-symbol-list-filtered
-                   (if TeX-insert-braces "{}"))
-             (list "" TeX-complete-word)))
+  ;; Symbol & length completion.
+  (setq-local TeX-complete-list
+              (list (list "\\\\\\([a-zA-Z]*\\)"
+                          1
+                          (lambda ()
+                            (append (TeX-symbol-list-filtered)
+                                    (when (fboundp 'LaTeX-length-list)
+                                      (LaTeX-length-list))
+                                    (when (fboundp 'LaTeX-counter-list)
+                                      (mapcar (lambda (x)
+                                                `(,(concat "the" (car x))))
+                                              (LaTeX-counter-list)))))
+                          (if TeX-insert-braces "{}"))
+                    (list "" TeX-complete-word)))
 
   (funcall TeX-install-font-lock)
 
@@ -3848,6 +3852,10 @@ The algorithm is as follows:
 (defconst TeX-auto-parser-local 3)
 (defconst TeX-auto-parser-change 4)
 
+(defvar TeX-auto-file nil)
+;; Internal temporal variable.  Don't refer to it in your program
+;; unless you know what you are doing.  Use (TeX-style-list) instead.
+
 (defun TeX-auto-add-information (name entries)
   "For NAME in `TeX-auto-parser' add ENTRIES."
   (let* ((entry (assoc name TeX-auto-parser))
@@ -3966,6 +3974,17 @@ Generated by `TeX-auto-add-type'.")
   :group 'TeX-parse
   :type 'boolean)
 
+(defcustom TeX-auto-save-aggregate t
+  "When non-nil, save parsed information in one directory.
+Each style file of automatically parsed information is saved in
+\"auto\" subdirectory of master file.
+
+When nil, saves in each \"auto\" subdirectory.
+
+Subdirectory name is actually taken from `TeX-auto-local'."
+  :group 'TeX-parse
+  :type 'boolean)
+
 (defun TeX-auto-write ()
   "Save all relevant TeX information from the current buffer."
   (if TeX-auto-untabify
@@ -3976,7 +3995,9 @@ Generated by `TeX-auto-add-type'.")
                      (file-name-as-directory TeX-auto-local)
                      (TeX-strip-extension nil TeX-all-extensions t)
                      ".el")
-                    (TeX-master-directory)))
+                    (if TeX-auto-save-aggregate
+                        (TeX-master-directory)
+                      default-directory)))
              (dir (file-name-directory file)))
         ;; Create auto directory if possible.
         (if (not (file-exists-p dir))
@@ -4234,7 +4255,7 @@ alter the numbering of any ordinary, non-shy groups.")
        1 TeX-auto-symbol)
       (,(concat "\\\\newfont{?\\\\\\(" token "+\\)}?") 1 TeX-auto-symbol)
       (,(concat "\\\\typein\\[\\\\\\(" token "+\\)\\]") 1 TeX-auto-symbol)
-      ("\\\\input +\\(\\.*[^#%\\\\\\.\n\r]+\\)\\(\\.[^#%\\\\\\.\n\r]+\\)?"
+      ("\\\\input +\\([^#}%\"\\\n\r]+?\\)\\(?:\\.[^#}%/\"\\.\n\r]+\\)?"
        1 TeX-auto-file)
       (,(concat "\\\\mathchardef\\\\\\(" token "+\\)[^a-zA-Z@]")
        1 TeX-auto-symbol)))
@@ -5664,7 +5685,7 @@ characters."
 (defun TeX-search-unescaped (pattern
                              &optional direction regexp-flag bound noerror)
   "Search for unescaped PATTERN in a certain DIRECTION.
-DIRECTION can be indicated by the symbols 'forward and 'backward.
+DIRECTION can be indicated by the symbols `forward' and `backward'.
 If DIRECTION is omitted, a forward search is carried out.
 If REGEXP-FLAG is non-nil, PATTERN may be a regular expression,
 otherwise a string.
@@ -6997,7 +7018,6 @@ at bottom if LINE is nil."
 (defvar TeX-parse-function)
 (defvar TeX-sentinel-function)
 (defvar TeX-sentinel-default-function)
-(defvar compilation-in-progress)
 (defvar TeX-current-page)
 (defvar TeX-error-overview-open-after-TeX-run)
 (defvar TeX-error-list)
@@ -7306,19 +7326,19 @@ Pass arguments EXTENSION NONDIRECTORY ASK to 
`TeX-active-master'.
 If the returned file name contains space, enclose it within
 quotes `\"' when \" \\input\" is supplemented (indicated by
 dynamically bound variable `TeX-command-text' having string
-value.) Also enclose the file name within \\detokenize{} when
+value.)  Also enclose the file name within \\detokenize{} when
 the following three conditions are met:
   1. compiling with standard (pdf)LaTeX or upLaTeX
   2. \" \\input\" is supplemented
   3. EXTRA is non-nil (default when expanding \"%T\")
-Adjust dynamically bound variable `TeX-expand-pos' to avoid possible
-infinite loop in `TeX-command-expand'.
+Adjust dynamically bound variable `TeX-expand-pos' to avoid
+possible infinite loop in `TeX-command-expand'.
 If PREPROCESS-FN is non-nil then it is called with the filename
 as an argument and the result is enclosed instead of the
 filename.
 
-Helper function of `TeX-command-expand'. Use only within entries in
-`TeX-expand-list-builtin' and `TeX-expand-list'."
+Helper function of `TeX-command-expand'. Use only within entries
+in `TeX-expand-list-builtin' and `TeX-expand-list'."
   (let* ((raw (TeX-active-master extension nondirectory ask))
          ;; String `TeX-command-text' means that the file name is
          ;; given through \input command.
@@ -7815,6 +7835,7 @@ Return the new process."
           (set-process-filter process #'TeX-command-filter)
           (set-process-sentinel process #'TeX-command-sentinel)
           (set-marker (process-mark process) (point-max))
+          (require 'compile)
           (setq compilation-in-progress (cons process compilation-in-progress))
           process)
       (setq mode-line-process ": run")
@@ -7985,6 +8006,7 @@ run of `TeX-run-format', use
   ;; FIXME: This is just an ad-hoc workaround and it's better to fix
   ;; the regular expression in compile.el properly, if possible.  But
   ;; there was no response to such request in emacs-devel@gnu.org.
+  (require 'compile)
   (with-current-buffer TeX-command-buffer
     (make-local-variable 'compilation-error-regexp-alist)
     ;; Add slightly modified entry of the one associated with `comma'
@@ -8082,6 +8104,7 @@ Error parsing on \\[next-error] should work with a bit of 
luck."
     (TeX-command-mode-line process)
     (set-process-sentinel process #'TeX-command-sentinel)
     (set-marker (process-mark process) (point-max))
+    (require 'compile)
     (setq compilation-in-progress (cons process compilation-in-progress))
     (TeX-parse-reset)
     (setq TeX-parse-function #'TeX-parse-TeX)
@@ -8108,7 +8131,7 @@ This function is *obsolete* and only here for 
compatibility
 reasons.  Use `TeX-run-function' instead."
   (interactive)
   (TeX-ispell-document ""))
-
+(make-obsolete 'TeX-run-ispell-on-document 'TeX-run-function "2006-02-07")
 
 ;;; Command Sentinels
 
@@ -8256,7 +8279,12 @@ Return nil only if no errors were found."
                       (match-string 1 output-file)
                     "dvi")))))))
   (if process (TeX-format-mode-line process))
-  (if (re-search-forward "^\\(!\\|.*:[0-9]+:\\) " nil t)
+  (if (catch 'found
+        (while (re-search-forward "^\\(?:!\\|\\(.+?\\):[0-9]+:\\) " nil t)
+          (if (or (not (match-beginning 1))
+                  ;; Ignore non-error warning. (bug#55065)
+                  (file-exists-p (TeX-match-buffer 1)))
+              (throw 'found t))))
       (progn
         (message "%s errors in `%s'. Use %s to display." name (buffer-name)
                  (substitute-command-keys
@@ -8269,6 +8297,9 @@ Return nil only if no errors were found."
                                             'TeX-current-master))
                          t))
         t)
+    ;; In case that there were only non-error warnings of type
+    ;; bug#55065, restore point to the initial position.
+    (goto-char (point-min))
     (let (dvi2pdf)
         (if (with-current-buffer TeX-command-buffer
            (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
@@ -9272,7 +9303,7 @@ Return non-nil if an error or warning is found."
   (let ((regexp
          (concat
           ;; TeX error
-          "^\\(!\\|\\(.*?\\):[0-9]+:\\) \\|"
+          "^\\(!\\|\\(.+?\\):[0-9]+:\\) \\|"
           ;; New file
           "(\n?\\([^\n()]+\\)\\|"
           ;; End of file.
@@ -9302,17 +9333,25 @@ Return non-nil if an error or warning is found."
           nil)
          ;; TeX error
          ((match-beginning 1)
-          (when (match-beginning 2)
-            (unless TeX-error-file
-              (push nil TeX-error-file)
-              (push nil TeX-error-offset))
-            (unless (car TeX-error-offset)
-              (rplaca TeX-error-file (TeX-match-buffer 2))))
-          (setq error-found t)
-          (if (looking-at "Preview ")
-              t
-            (TeX-error store)
-            nil))
+          (if (or (not (match-beginning 2))
+                  ;; Ignore non-error warning. (bug#55065)
+                  (file-exists-p (TeX-match-buffer 2)))
+              (progn
+                (when (match-beginning 2)
+                  (unless TeX-error-file
+                    (push nil TeX-error-file)
+                    (push nil TeX-error-offset))
+                  (unless (car TeX-error-offset)
+                    (rplaca TeX-error-file (TeX-match-buffer 2))))
+                (setq error-found t)
+                (if (looking-at "Preview ")
+                    t
+                  (TeX-error store)
+                  nil))
+            ;; This wasn't an actual TeX error.  Go to the least
+            ;; possible point to search again.
+            (goto-char (1+ (match-beginning 1)))
+            t))
          ;; LaTeX bad box
          ((match-beginning 7)
           ;; In `TeX-error-list' we collect all warnings, also if they're going



reply via email to

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