auctex-diffs
[Top][All Lists]
Advanced

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

feature/fix-mode-names-overlap ab8f73a1: Merge branch 'master' into feat


From: Ikumi Keita
Subject: feature/fix-mode-names-overlap ab8f73a1: Merge branch 'master' into feature/fix-mode-names-overlap
Date: Wed, 23 Aug 2023 08:49:27 -0400 (EDT)

branch: feature/fix-mode-names-overlap
commit ab8f73a1ccf03bcb314240ae3ef251e9140e6d7d
Merge: a6e53e53 d486947c
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Merge branch 'master' into feature/fix-mode-names-overlap
---
 bib-cite.el                    |   2 -
 context-nl.el                  |   3 +
 context.el                     |   5 +-
 doc/auctex.texi                |   6 +-
 doc/changes.texi               |   4 +-
 font-latex.el                  |  59 +++++----
 latex.el                       | 155 +++++++++++++++++++----
 style/XCharter.el              |  58 ++++-----
 style/algpseudocodex.el        |  47 +++++--
 style/amsthm.el                |  15 +--
 style/babel.el                 |  79 +++++++-----
 style/beamer.el                |  45 ++++---
 style/biblatex.el              |  10 +-
 style/bicaption.el             |  30 ++---
 style/caption.el               |  27 +++--
 style/changes.el               |  66 +++++-----
 style/csquotes.el              | 138 +++++++++++----------
 style/expl3.el                 |  20 +--
 style/fancyvrb.el              |  23 ++++
 style/fontenc.el               |  14 +--
 style/geometry.el              |  11 +-
 style/mdsymbol.el              |   9 +-
 style/menukeys.el              | 270 ++++++++++++++++++-----------------------
 style/microtype.el             |  13 +-
 style/natbib.el                |  31 +++--
 style/newfloat.el              |  15 +--
 style/ntheorem.el              |  65 +++++-----
 style/paralist.el              |  32 ++---
 style/parskip.el               |  18 +--
 style/revtex4-2.el             |  25 ++--
 style/siunitx.el               |  12 +-
 style/subcaption.el            |  13 +-
 style/theorem.el               |  15 +--
 style/wasysym.el               |   3 +
 style/xparse.el                |   6 +-
 tests/latex/font-latex-test.el |  73 ++++++++++-
 tex-fold.el                    |  10 +-
 tex-jp.el                      |   2 +-
 tex-style.el                   |  26 +++-
 tex.el                         |  48 +++++---
 40 files changed, 907 insertions(+), 596 deletions(-)

diff --git a/bib-cite.el b/bib-cite.el
index 9c19be37..5a7de98f 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -1570,8 +1570,6 @@ Does not save excursion."
          "Sorry, could not find an environment or section declaration")))))
 
 (defvar LaTeX-find-label-hist-alist nil "History list for LaTeX-find-label.")
-(defvar LaTeX-label-list nil "Used by AUCTeX to store label names.")
-
 
 (defun create-alist-from-list (the-list)
   "Return a single list from a THE-LIST that may contain either items or lists.
diff --git a/context-nl.el b/context-nl.el
index c473874e..956c132f 100644
--- a/context-nl.el
+++ b/context-nl.el
@@ -138,6 +138,9 @@ List should be in logical order.")
     ("subsubsubsubject" 4))
   "List of the names of ConTeXt unnumbered sections for its nl interface.")
 
+(defvar ConTeXt-section-list-nl
+  (append ConTeXt-numbered-section-list-nl ConTeXt-unnumbered-section-list-nl))
+
 (defvar ConTeXt-text-nl "tekst"
   "The ConTeXt nl interface body text group.")
 
diff --git a/context.el b/context.el
index a7c2b839..362515a3 100644
--- a/context.el
+++ b/context.el
@@ -312,7 +312,7 @@ The following variables can be set to customize:
 ;; (May 3, 2023) The above comment is wrong.  Here "large" refers to
 ;; coarseness of document structure grouping.  That is, "chapter" is
 ;; larger than "section", "section" is larger than "subsection" etc.
-;; On the ohter hand, the corresponding levels are numbered in the
+;; On the other hand, the corresponding levels are numbered in the
 ;; reversed order.  That is, "chapter" is level 1, "section" is level
 ;; 2 etc.  Hence the largest _section_ has the smallest _level_.
 ;; That's the reason we use `max' rather than `min' here.
@@ -1879,6 +1879,7 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
   (use-local-map ConTeXt-mode-map)
   (setq ConTeXt-menu-changed t)
 
+  ;; FIXME: Isn't `activate-menubar-hook' obsolete?
   (add-hook 'activate-menubar-hook #'ConTeXt-menu-update nil t)
 
   (setq-local beginning-of-defun-function #'ConTeXt-find-matching-start)
@@ -1886,7 +1887,7 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
 
   ;; Outline support
   (require 'outline)
-  (set (make-local-variable 'outline-level) 'ConTeXt-outline-level)
+  (set (make-local-variable 'outline-level) #'ConTeXt-outline-level)
   (set (make-local-variable 'outline-regexp) (ConTeXt-outline-regexp t))
   ;;(make-local-variable 'outline-heading-end-regexp)
   (setq TeX-header-end (ConTeXt-header-end)
diff --git a/doc/auctex.texi b/doc/auctex.texi
index b396e397..8d5b282f 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -12,7 +12,7 @@ This manual is for @AUCTeX{}
 (version @value{VERSION} from @value{UPDATED}),
 a sophisticated @TeX{} environment for Emacs.
 
-Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2022
+Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2023
 Free Software Foundation, Inc.
 
 @quotation
@@ -2317,11 +2317,11 @@ described above.  You can disable these defaults per 
class by
 customizing the variable @code{font-latex-deactivated-keyword-classes}.
 This is a list of strings for keyword classes to be deactivated.  Valid
 entries are "warning", "variable", "biblatexnoarg", "biblatex",
-"reference", "function" , "sectioning-0", "sectioning-1",
+"reference", "function", "function-noarg", "sectioning-0", "sectioning-1",
 "sectioning-2", "sectioning-3", "sectioning-4", "sectioning-5",
 "slide-title", "textual", "bold-command", "italic-command",
 "underline-command", "math-command", "type-command", "bold-declaration",
-"italic-declaration", "type-declaration".
+"italic-declaration" or "type-declaration".
 
 You can also get rid of certain keywords only.  For example if you want
 to remove highlighting of footnotes as references you can put the
diff --git a/doc/changes.texi b/doc/changes.texi
index 467af2a5..f9e7ee58 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -1,5 +1,5 @@
 @c This is part of the AUCTeX manual.
-@c Copyright (C) 1994-2002, 2004-2010, 2012-2022 Free Software
+@c Copyright (C) 1994-2002, 2004-2010, 2012-2023 Free Software
 @c Foundation, Inc.
 @c See file auctex.texi for copying conditions.
 @include macros.texi
@@ -14,6 +14,8 @@
 @item
 @AUCTeX{} now requires GNU Emacs 26.1 or higher.
 
+@item
+Now @LaTeX{} abbreves are available in doc@TeX{} mode buffers.
 @end itemize
 
 @heading News in 13.2
diff --git a/font-latex.el b/font-latex.el
index 29b5c888..71a5b25a 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1,6 +1,6 @@
 ;;; font-latex.el --- LaTeX fontification for Font Lock mode.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1996-2022  Free Software Foundation, Inc.
+;; Copyright (C) 1996-2023  Free Software Foundation, Inc.
 
 ;; Authors:    Peter S. Galbraith <psg@debian.org>
 ;;             Simon Marshall <Simon.Marshall@esrin.esa.it>
@@ -365,22 +365,22 @@ variable `font-latex-fontify-sectioning'." ',num)
       ("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" "")
-      ("bigskip" "") ("medskip" "")  ("smallskip" "")
-      ("thinspace" "")  ("negthinspace" "")
-      ("thicklines" "") ("thinlines" "")
-      ("noindent" "") ("hline" "") ("ldots" "")
-      ("centering" "") ("raggedright" "") ("raggedleft" "")
-      ("raggedbottom" "") ("flushbottom" "")
-      ("TeX" "") ("LaTeX" "") ("LaTeXe" "")
-      ("normalfont" "") ("normalshape" "")
-      ("tableofcontents" "") ("listoffigures" "") ("listoftables" "")
-      ("maketitle" "") ("makeindex" "") ("makeglossary" "")
-      ("sloppy" "") ("fussy" ""))
+      ("NewMarkClass" "{"))
      font-lock-function-name-face 2 command)
+    ("function-noarg"
+     ("enspace" "enskip" "quad" "qquad" "nonumber"
+      "bigskip" "medskip"  "smallskip"
+      "thinspace"  "negthinspace"
+      "thicklines" "thinlines"
+      "noindent" "hline" "ldots"
+      "centering" "raggedright" "raggedleft"
+      "raggedbottom" "flushbottom"
+      "TeX" "LaTeX" "LaTeXe"
+      "normalfont" "normalshape"
+      "tableofcontents" "listoffigures" "listoftables"
+      "maketitle" "makeindex" "makeglossary"
+      "sloppy" "fussy")
+     font-lock-keyword-face 2 noarg)
     ("sectioning-0"
      (("part" "*[{"))
      (if (eq font-latex-fontify-sectioning 'color)
@@ -482,12 +482,13 @@ will match macros of the form \"\\foo[bar]{baz}\"."))
   "List of strings for built-in keyword classes to be deactivated.
 
 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\", \"underline-command\",
-\"math-command\", \"type-command\", \"bold-declaration\",
-\"italic-declaration\", \"type-declaration\".
+\"biblatex\", \"reference\", \"function\", \"function-noarg\",
+\"sectioning-0\", \"sectioning-1\", \"sectioning-2\",
+\"sectioning-3\", \"sectioning-4\", \"sectioning-5\",
+\"slide-title\", \"textual\", \"bold-command\",
+\"italic-command\", \"underline-command\", \"math-command\",
+\"type-command\", \"bold-declaration\", \"italic-declaration\" or
+\"type-declaration\".
 
 You have to restart Emacs for a change of this variable to take effect."
   :group 'font-latex-keywords
@@ -914,7 +915,7 @@ Generated by `font-latex-make-user-keywords'.")))
 KEYWORDS is a list of keywords or keywords with syntax specs.
 CLASS corresponds to a keyword class and can be one of the
 symbols `warning', `variable', `reference', `biblatexnoarg',
-`biblatex', `function', `sectioning-0', `sectioning-1',
+`biblatex', `function', `function-noarg', `sectioning-1',
 `sectioning-2', `sectioning-3', `sectioning-4', `sectioning-5',
 `slide-title', `textual', `bold-command', `italic-command',
 `underline-command', `math-command', `type-command',
@@ -1096,8 +1097,16 @@ have changed."
                   ;; Some macros take an optional argument.  This is
                   ;; the same line as above for environments.
                   "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
-                  "\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)")
-         (1 "|") (2 "|")))))
+                  ;; Within verb macros with braces, only balanced
+                  ;; pairs of braces are allowed; so we respect this
+                  ;; and allow one level of balanced braces.  Give
+                  ;; escape char(s) at the end of the verbatim
+                  ;; construct punctuation syntax.
+                  "\\({\\)[^}{]*?"
+                  "\\(?:{[^}{]*}[^}{]*?\\)*"
+                  "\\(" (regexp-quote TeX-esc) "*\\)"
+                  "\\(}\\)")
+         (1 "|") (2 ".") (3 "|")))))
   (when font-latex-syntactic-keywords-extra
     (nconc font-latex-syntactic-keywords font-latex-syntactic-keywords-extra))
   ;; ;; Cater for docTeX mode.
diff --git a/latex.el b/latex.el
index 8da3a61c..f414fd6c 100644
--- a/latex.el
+++ b/latex.el
@@ -33,7 +33,10 @@
 (require 'tex-ispell)
 (require 'latex-flymake)
 (eval-when-compile
-  (require 'cl-lib))
+  (require 'cl-lib)
+  ;; Require subr-x.el for `string-trim' which wasn't autoloaded:
+  (when (< emacs-major-version 29)
+    (require 'subr-x)))
 
 ;; Silence the compiler for functions:
 (declare-function outline-level "ext:outline"
@@ -2835,8 +2838,7 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string."
   (TeX-argument-insert
    (completing-read (TeX-argument-prompt optional prompt "Position")
-                    '("l" "r" "t" "b" "tl" "tr" "bl" "br")
-                    nil t)
+                    '("l" "r" "t" "b" "tl" "tr" "bl" "br"))
    optional))
 
 (defun TeX-arg-lr (optional &optional prompt)
@@ -2846,15 +2848,14 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string."
   (TeX-argument-insert
    (completing-read (TeX-argument-prompt optional prompt "Position")
-                    '("l" "r")
-                    nil t)
+                    '("l" "r"))
    optional))
 
 (defun TeX-arg-tb (optional &optional prompt poslist)
   "Prompt for a LaTeX side with completion.
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument, otherwise as a mandatory one.  Use PROMPT as the prompt
-string.  POSLIST contains the positioning characters offered for
+string.  POSLIST controls the positioning characters offered for
 completion.  It can be the symbols `center', `stretch' or nil
 with the following completion list:
   center   t, b, c
@@ -2867,8 +2868,7 @@ with the following completion list:
                           ((eq poslist 'stretch)
                            '("t" "b" "c" "s"))
                           (t
-                           '("t" "b")))
-                    nil t)
+                           '("t" "b"))))
    optional))
 
 (defcustom TeX-date-format "%Y/%m/%d"
@@ -6455,14 +6455,16 @@ char."
 (defcustom LaTeX-fold-macro-spec-list nil
   "List of display strings and macros to fold in LaTeX mode."
   :type '(repeat (group (choice (string :tag "Display String")
-                                (integer :tag "Number of argument" :value 1))
+                                (integer :tag "Number of argument" :value 1)
+                                (function :tag "Function to execute"))
                         (repeat :tag "Macros" (string))))
   :group 'TeX-fold)
 
 (defcustom LaTeX-fold-env-spec-list nil
   "List of display strings and environments to fold in LaTeX mode."
   :type '(repeat (group (choice (string :tag "Display String")
-                                (integer :tag "Number of argument" :value 1))
+                                (integer :tag "Number of argument" :value 1)
+                                (function :tag "Function to execute"))
                         (repeat :tag "Environments" (string))))
   :group 'TeX-fold)
 
@@ -6488,7 +6490,8 @@ char."
                     ,@LaTeX-math-default)))
   "List of display strings and math macros to fold in LaTeX mode."
   :type '(repeat (group (choice (string :tag "Display String")
-                                (integer :tag "Number of argument" :value 1))
+                                (integer :tag "Number of argument" :value 1)
+                                (function :tag "Function to execute"))
                         (repeat :tag "Math Macros" (string))))
   :group 'TeX-fold)
 
@@ -7598,6 +7601,93 @@ COLLECTION is an list of strings."
                    (lambda (_)
                      collection)))))
 
+(defun LaTeX-completion-documentclass-usepackage (entry)
+  "Return completion candidates for \\usepackage and \\documentclass arguments.
+ENTRY is the value returned by `LaTeX-what-macro'.  This function
+provides completion for class/package names if point is inside
+the mandatory argument and class/package options if inside the
+first optional argument.  The completion for class/package names
+is provided only if the value of `TeX-arg-input-file-search' is
+set to t."
+  (let ((cls-or-sty (if (member (car entry) '("usepackage" "RequirePackage"
+                                              "RequirePackageWithOptions"))
+                        'sty
+                      'cls)))
+    (cond ((and (eq (nth 3 entry) 'mandatory)
+                (eq TeX-arg-input-file-search t))
+           (if (eq cls-or-sty 'cls)
+               (progn
+                 (unless LaTeX-global-class-files
+                   (let ((TeX-file-extensions '("cls")))
+                     (message "Searching for LaTeX classes...")
+                     (setq LaTeX-global-class-files
+                           (mapcar #'list (TeX-search-files-by-type 'texinputs 
'global t t)))
+                     (message "Searching for LaTeX classes...done")))
+                 (LaTeX-completion-candidates-completing-read
+                  LaTeX-global-class-files))
+             (unless LaTeX-global-package-files
+               (let ((TeX-file-extensions '("sty")))
+                 (message "Searching for LaTeX packages...")
+                 (setq LaTeX-global-package-files
+                       (mapcar #'list (TeX-search-files-by-type 'texinputs 
'global t t)))
+                 (message "Searching for LaTeX packages...done")))
+             (LaTeX-completion-candidates-completing-read-multiple
+              LaTeX-global-package-files)))
+          ;; We have to be more careful for the optional argument
+          ;; since the macros can look like this:
+          ;; \usepackage[opt1]{mand}[opt2].  So we add an extra check
+          ;; if we are inside the first optional arg:
+          ((and (eq (nth 3 entry) 'optional)
+                (= (nth 2 entry) 1))
+           (let ((syntax (TeX-search-syntax-table ?\[ ?\]))
+                 style style-opts)
+             ;; We have to find out about the package/class name:
+             (save-excursion
+               (with-syntax-table syntax
+                 (condition-case nil
+                     (let ((forward-sexp-function nil))
+                       (up-list))
+                   (error nil)))
+               (skip-chars-forward "^[:alnum:]")
+               (setq style (thing-at-point 'symbol t)))
+             ;; Load the style file; may fail but that's Ok for us
+             (TeX-load-style style)
+             ;; Now we have to find out how the options are available:
+             ;; This is usually a variable called
+             ;; `LaTeX-<class|package>-package-options'.  If it is a
+             ;; function, then the options are stored either in a
+             ;; variable or a function called
+             ;; `LaTeX-<class|package>-package-options-list:'
+             (when (setq style-opts
+                         (intern-soft (format
+                                       (concat "LaTeX-%s-"
+                                               (if (eq cls-or-sty 'cls)
+                                                   "class"
+                                                 "package")
+                                               "-options")
+                                       style)))
+               (cond ((and (boundp style-opts)
+                           (symbol-value style-opts))
+                      (LaTeX-completion-candidates-completing-read-multiple
+                       (symbol-value style-opts)))
+                     ((and (setq style-opts
+                                 (intern-soft (format
+                                               (concat "LaTeX-%s-"
+                                                       (if (eq cls-or-sty 'cls)
+                                                           "class"
+                                                         "package")
+                                                       "-options-list")
+                                               style)))
+                           (boundp style-opts)
+                           (symbol-value style-opts))
+                      (LaTeX-completion-candidates-key-val
+                       (symbol-value style-opts)))
+                     ((fboundp style-opts)
+                      (LaTeX-completion-candidates-key-val
+                       (funcall style-opts)))
+                     (t nil)))))
+          (t nil))))
+
 (defun LaTeX-completion-parse-args (entry)
   "Return the match of buffer position ENTRY with AUCTeX macro definitions.
 ENTRY is generated by the function `LaTeX-what-macro'.  This
@@ -7635,7 +7725,7 @@ or `LaTeX-environment-list' and returns it."
     ;; cases, but will also fail for example in hyperref.el.  This
     ;; decision should revisited at a later stage:
     (when (assq 'TeX-arg-conditional arg-list)
-      (cl-letf (((symbol-function 'y-or-n-p) #'always))
+      (cl-flet ((y-or-n-p #'TeX-always))
         (while (and arg-list
                     (setq arg (car arg-list)))
           (if (and (listp arg) (eq (car arg) 'TeX-arg-conditional))
@@ -7708,7 +7798,7 @@ or `LaTeX-environment-list' and returns it."
           (t nil))
     result))
 
-(defvar LaTeX-completion-function-map-alist-keyval '()
+(defvar LaTeX-completion-function-map-alist-keyval nil
   "Alist mapping style funcs to completion-candidates counterparts.
 Each element is a cons with the name of the function used in an
 AUCTeX style file which queries and inserts something in the
@@ -7720,6 +7810,7 @@ key=val completions.  See also
 (defvar LaTeX-completion-function-map-alist-cr
   `((TeX-arg-counter . LaTeX-counter-list)
     (TeX-arg-pagestyle . LaTeX-pagestyle-list)
+    (TeX-arg-environment . LaTeX-environment-list)
     (TeX-arg-length . ,(lambda () (mapcar (lambda (x)
                                             (concat TeX-esc (car x)))
                                           (LaTeX-length-list)))))
@@ -7812,7 +7903,13 @@ function `TeX--completion-at-point' which should come 
first in
   (when (and (LaTeX-completion-find-argument-boundries)
              (not (nth 4 (syntax-ppss))))
     (let ((entry (LaTeX-what-macro)))
-      (cond ((or (and entry
+      (cond ((and entry
+                  (member (car entry) '("usepackage" "RequirePackage"
+                                        "RequirePackageWithOptions"
+                                        "documentclass" "LoadClass"
+                                        "LoadClassWithOptions")))
+             (LaTeX-completion-documentclass-usepackage entry))
+            ((or (and entry
                       (eq (nth 1 entry) 'mac)
                       (assoc (car entry) (TeX-symbol-list)))
                  (and entry
@@ -7952,6 +8049,12 @@ runs the hooks in `docTeX-mode-hook'."
   (TeX-set-mode-name)
   (funcall TeX-install-font-lock))
 
+;; Enable LaTeX abbrevs in docTeX mode buffer.
+(let ((p (abbrev-table-get docTeX-mode-abbrev-table :parents)))
+  (or (memq LaTeX-mode-abbrev-table p)
+      (abbrev-table-put docTeX-mode-abbrev-table :parents
+                        (cons LaTeX-mode-abbrev-table p))))
+
 (defcustom docTeX-clean-intermediate-suffixes
   TeX-clean-default-intermediate-suffixes
   "List of regexps matching suffixes of files to be deleted.
@@ -8179,14 +8282,20 @@ function would return non-nil and `(match-string 1)' 
would return
      [ TeX-arg-define-macro-arguments ] 2)
    '("renewenvironment*" TeX-arg-environment
      [ TeX-arg-define-macro-arguments ] 2)
+   ;; \newtheorem comes in 3 flavors:
+   ;; \newtheorem{name}{title} or
+   ;; \newtheorem{name}[numbered_like]{title} or
+   ;; \newtheorem{name}{title}[numbered_within]
+   ;; Both optional args are not allowed
    '("newtheorem" TeX-arg-define-environment
      [ TeX-arg-environment "Numbered like" ]
-     t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                       (backward-char 2)
-                                       (preceding-char)) ?\])
-                                 ()
-                               (TeX-arg-counter t "Within counter"))
-                       "") ])
+     "Title"
+     (TeX-arg-conditional (save-excursion
+                            (skip-chars-backward (concat "^" TeX-grcl))
+                            (backward-list)
+                            (= (preceding-char) ?\]))
+         ()
+       ([TeX-arg-counter "Within counter"])))
    '("newfont" TeX-arg-define-macro t)
    '("circle" "Diameter")
    '("circle*" "Diameter")
@@ -8274,9 +8383,9 @@ function would return non-nil and `(match-string 1)' 
would return
    '("date" TeX-arg-date)
    '("thanks" t)
    '("title" t)
-   '("pagenumbering" (TeX-arg-eval
-                      completing-read "Numbering style: "
-                      '(("arabic") ("roman") ("Roman") ("alph") ("Alph"))))
+   '("pagenumbering" (TeX-arg-completing-read
+                      ("arabic" "roman" "Roman" "alph" "Alph")
+                      "Numbering style"))
    '("pagestyle" TeX-arg-pagestyle)
    '("markboth" t nil)
    '("markright" t)
diff --git a/style/XCharter.el b/style/XCharter.el
index 4edb5a37..8838d292 100644
--- a/style/XCharter.el
+++ b/style/XCharter.el
@@ -1,6 +1,6 @@
 ;;; XCharter.el --- AUCTeX style for `XCharter.sty' (v1.24)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2014--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -134,32 +134,36 @@
                               'textual)))
  TeX-dialect)
 
+(defun LaTeX-XCharter-package-options-list ()
+  "Return an alist of package options for XCharter package."
+  (append
+   (when (memq TeX-engine '(xetex luatex))
+     '(("nofontspec" ("true" "false"))
+       ("type1text" ("true" "false"))
+       ("type1" ("true" "false"))
+       ("defaultfeatures")))
+   '(("scaled")
+     ("scale")
+     ("lining" ("true" "false"))
+     ("lf" ("true" "false"))
+     ("oldstyle" ("true" "false"))
+     ("osf" ("true" "false"))
+     ("proportional" ("true" "false"))
+     ("p" ("true" "false"))
+     ("tabular" ("true" "false"))
+     ("t" ("true" "false"))
+     ("oldstyleI" ("true" "false"))
+     ("osfI" ("true" "false"))
+     ("sups")
+     ("scosf")
+     ("serbianc")
+     ("theoremfont")
+     ("thmlining")
+     ("oldSS")
+     ("notextnu"))))
+
 (defun LaTeX-XCharter-package-options ()
-  "Read the XCharter package options."
-  (TeX-read-key-val t (append
-                       (when (memq TeX-engine '(xetex luatex))
-                         '(("nofontspec" ("true" "false"))
-                           ("type1text" ("true" "false"))
-                           ("type1" ("true" "false"))
-                           ("defaultfeatures")))
-                       '(("scaled")
-                         ("scale")
-                         ("lining" ("true" "false"))
-                         ("lf" ("true" "false"))
-                         ("oldstyle" ("true" "false"))
-                         ("osf" ("true" "false"))
-                         ("proportional" ("true" "false"))
-                         ("p" ("true" "false"))
-                         ("tabular" ("true" "false"))
-                         ("t" ("true" "false"))
-                         ("oldstyleI" ("true" "false"))
-                         ("osfI" ("true" "false"))
-                         ("sups")
-                         ("scosf")
-                         ("serbianc")
-                         ("theoremfont")
-                         ("thmlining")
-                         ("oldSS")
-                         ("notextnu")))))
+  "Prompt for package options for the XCharter package."
+  (TeX-read-key-val t (LaTeX-XCharter-package-options-list)))
 
 ;;; XCharter.el ends here
diff --git a/style/algpseudocodex.el b/style/algpseudocodex.el
index d2b9848d..810e0315 100644
--- a/style/algpseudocodex.el
+++ b/style/algpseudocodex.el
@@ -1,6 +1,6 @@
 ;;; algpseudocodex.el --- AUCTeX style for `algpseudocodex.sty' (v1.0.2)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2022 Free Software Foundation, Inc.
+;; Copyright (C) 2022--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Created: 2022-10-10
@@ -136,6 +136,25 @@ the number of arguments."
     ;; 2.2 Boxes Inside Single Line
     '("BoxedString" ["options"] t)
 
+    ;; 4.3 Changing Keywords
+    "algorithmicend"
+    "algorithmicdo"
+    "algorithmicwhile"
+    "algorithmicfor"
+    "algorithmicforall"
+    "algorithmicloop"
+    "algorithmicrepeat"
+    "algorithmicuntil"
+    "algorithmicprocedure"
+    "algorithmicfunction"
+    "algorithmicif"
+    "algorithmicthen"
+    "algorithmicelse"
+    "algorithmicrequire"
+    "algorithmicensure"
+    "algorithmicreturn"
+    "algorithmicoutput"
+
     '("algrenewcommand"
       (TeX-arg-completing-read ("algorithmicend"
                                 "algorithmicdo"
@@ -200,17 +219,21 @@ the number of arguments."
                               'function)))
  TeX-dialect)
 
+(defvar LaTeX-algpseudocodex-package-options-list
+  '(("noEnd" ("true" "false"))
+    ("indLines" ("true" "false"))
+    ("spaceRequire" ("true" "false"))
+    ("italicComments" ("true" "false"))
+    ("rightComments" ("true" "false"))
+    ("commentColor")
+    ("beginComment")
+    ("endComment")
+    ("beginLComment")
+    ("endLComment"))
+  "Package options for the algpseudocodex package.")
+
 (defun LaTeX-algpseudocodex-package-options ()
-  "Package options for the algpseudocodex package."
-  (TeX-read-key-val t '(("noEnd" ("true" "false"))
-                        ("indLines" ("true" "false"))
-                        ("spaceRequire" ("true" "false"))
-                        ("italicComments" ("true" "false"))
-                        ("rightComments" ("true" "false"))
-                        ("commentColor")
-                        ("beginComment")
-                        ("endComment")
-                        ("beginLComment")
-                        ("endLComment"))))
+  "Prompt for package options for the algpseudocodex package."
+  (TeX-read-key-val t LaTeX-algpseudocodex-package-options-list))
 
 ;;; algpseudocodex.el ends here
diff --git a/style/amsthm.el b/style/amsthm.el
index ad06ff89..8305ed56 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -1,6 +1,6 @@
 ;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997--2022  Free Software Foundation, Inc.
+;; Copyright (C) 1997--2023  Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
 ;; Maintainer: auctex-devel@gnu.org
@@ -98,12 +98,13 @@ make them available as new environments."
            (LaTeX-add-environments (list nthm #'LaTeX-env-label-args 
["Heading"]))
            (TeX-argument-insert nthm optional)))
       [ TeX-arg-environment "Numbered like" ]
-      t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                        (backward-char 2)
-                                        (preceding-char)) ?\])
-                                  ()
-                                (TeX-arg-counter t "Within counter"))
-                        "") ])
+      "Title"
+      (TeX-arg-conditional (save-excursion
+                             (skip-chars-backward (concat "^" TeX-grcl))
+                             (backward-list)
+                             (= (preceding-char) ?\]))
+          ()
+        ([TeX-arg-counter "Within counter"])))
 
     `("newtheorem*"
       ,(lambda (optional)
diff --git a/style/babel.el b/style/babel.el
index 70cc5658..495e9f64 100644
--- a/style/babel.el
+++ b/style/babel.el
@@ -1,6 +1,6 @@
-;;; babel.el --- AUCTeX style for `babel.sty' version 3.31.  -*- 
lexical-binding: t; -*-
+;;; babel.el --- AUCTeX style for `babel.sty' version 3.88.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2005-2023  Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
 ;; Maintainer: auctex-devel@gnu.org
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `babel.sty' version 3.31 from 2019/05/04.
+;; This file adds support for `babel.sty' version 3.88 from 2023/04/18.
 
 ;;; Code:
 
@@ -43,6 +43,7 @@
 (declare-function LaTeX-fontspec-auto-cleanup
                   "fontspec"
                   ())
+(defvar LaTeX-fontenc-package-options)
 
 (defvar LaTeX-babel-language-list
   '("afrikaans"
@@ -255,6 +256,7 @@
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language"))
     '("foreignlanguage"
+      [TeX-arg-completing-read-multiple ("date" "captions")]
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language")
       t)
@@ -363,6 +365,7 @@
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language"))
     '("otherlanguage*" LaTeX-env-args
+      [TeX-arg-completing-read-multiple ("date" "captions")]
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language"))
     '("hyphenrules" LaTeX-env-args
@@ -373,7 +376,6 @@
    (when (and (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("selectlanguage"     "{")
-                                ("foreignlanguage"    "{{")
                                 ("babeltags"          "{")
                                 ("babelensure"        "{{")
                                 ("shorthandon"        "{")
@@ -393,38 +395,49 @@
      (font-latex-add-keywords '(("defineshorthand"    "[{{")
                                 ("aliasshorthand"     "{{")
                                 ("languageattribute"  "{{"))
-                              'variable)))
+                              'variable)
+     (font-latex-add-keywords '(("foreignlanguage"    "[{{"))
+                              'textual)))
  TeX-dialect)
 
+(defvar LaTeX-babel-package-options-list
+  (progn
+    (TeX-load-style "fontenc")
+    (append
+     `(("KeepShorthandsActive")
+       ("activeacute")
+       ("activegrave")
+       ("shorthands" ("off"))
+       ("safe" ("none" "ref" "bib"))
+       ("math" ("active" "normal"))
+       ("config")
+       ("main" ,LaTeX-babel-language-list)
+       ("headfoot" ,LaTeX-babel-language-list)
+       ("noconfigs")
+       ("nocase")
+       ("silent")
+       ("showlanguages")
+       ("nocase")
+       ("silent")
+       ("strings" ,(append
+                    LaTeX-fontenc-package-options
+                    '("generic" "unicode" "encoded")))
+       ("hyphenmap" ("off" "first" "select"
+                     "other" "other*"))
+       ("bidi" ("default" "basic" "basic-r"
+                "bidi-l" "bidi-r"))
+       ("layout" ("sectioning" "counters" "lists"
+                  "contents" "footnotes"  "captions"
+                  "columns" "graphics" "extras"))
+       ("provide" ("*"))
+       ("provide+" ("*"))
+       ("provide*" ("*"))
+       ("base"))
+     (mapcar #'list LaTeX-babel-language-list)))
+  "Package options for the babel package.")
+
 (defun LaTeX-babel-package-options ()
   "Prompt for package options for the babel package."
-  (TeX-read-key-val
-   t
-   (append
-    '(("KeepShorthandsActive")
-      ("activeacute")
-      ("activegrave")
-      ("shorthands" ("off"))
-      ("safe" ("none" "ref" "bib"))
-      ("math" ("active" "normal"))
-      ("config")
-      ("main" LaTeX-babel-language-list)
-      ("headfoot" LaTeX-babel-language-list)
-      ("noconfigs")
-      ("nocase")
-      ("silent")
-      ("showlanguages")
-      ("nocase")
-      ("silent")
-      ("strings" ("generic" "unicode" "encoded"
-                  "OT1" "OT2" "OT3" "OT4" "OT6"
-                  "T1"  "T2A" "T2B" "T2C" "T3" "T4" "T5"
-                  "X2"  "LY1" "LV1" "LGR"))
-      ("hyphenmap" ("off" "first" "select" "other" "other*"))
-      ("bidi" ("default" "basic" "basic-r" "bidi-l" "bidi-r"))
-      ("layout" ("sectioning" "counters" "lists" "contents" "footnotes"
-                 "captions"  "columns" "graphics" "extras"))
-      ("base"))
-    (mapcar #'list LaTeX-babel-language-list))))
+  (TeX-read-key-val t LaTeX-babel-package-options-list))
 
 ;;; babel.el ends here
diff --git a/style/beamer.el b/style/beamer.el
index 765519b9..d0d2e627 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -1,6 +1,6 @@
 ;;; beamer.el --- AUCTeX style for the latex-beamer class  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2023  Free Software Foundation, Inc.
 
 ;; Author: Thomas Baumann <thomas.baumann@ch.tum.de>
 ;; Maintainer: auctex-devel@gnu.org
@@ -37,6 +37,9 @@
 (declare-function font-latex-add-keywords
                   "font-latex"
                   (keywords class))
+(defvar LaTeX-hyperref-package-options-list)
+(defvar LaTeX-color-package-options)
+(defvar LaTeX-xcolor-package-options)
 
 (defun LaTeX-beamer-after-insert-env (env start _end)
   "Do beamer-specific stuff after the insertion of an environment."
@@ -608,22 +611,30 @@ also be a string.  Then the length of the string is used."
     (and (fboundp 'reftex-notice-new-section)
          (reftex-notice-new-section))))
 
+(defvar LaTeX-beamer-class-options-list
+  (progn
+    (TeX-load-style "hyperref")
+    (TeX-load-style "color")
+    (TeX-load-style "xcolor")
+    `(("usepdftitle" ("false")) ("envcountsect")
+      ("notheorems") ("noamsthm") ("compress") ("t") ("c")
+      ("leqno") ("fleqn") ("handout") ("trans")
+      ("ignorenonframetext") ("onlytextwidth")
+      ("noamssymb") ("bigger") ("smaller") ("8pt") ("9pt")
+      ("10pt") ("11pt") ("12pt") ("14pt") ("17pt") ("20pt")
+      ("draft") ("CJK") ("cjk") ("pgf")
+      ;; Take only the keys from `LaTeX-hyperref-package-options-list'
+      ;; since a new alist doesn't make sense here and isn't
+      ;; recognized as such:
+      ("hyperref" ,(mapcar #'car LaTeX-hyperref-package-options-list))
+      ("color" ,LaTeX-color-package-options)
+      ("xcolor" ,LaTeX-xcolor-package-options)
+      ("ucs") ("utf8x") ("utf8")
+      ("aspectratio" ("2013" "1610" "169" "149" "141" "54" "43" "32"))))
+  "Class options for the beamer class.")
+
 (defun LaTeX-beamer-class-options ()
-  "Read the beamer class options from the user."
-  (TeX-load-style "hyperref")
-  (TeX-load-style "color")
-  (TeX-load-style "xcolor")
-  (TeX-read-key-val t '(("usepdftitle" ("false")) ("envcountsect")
-                        ("notheorems") ("noamsthm") ("compress") ("t") ("c")
-                        ("leqno") ("fleqn") ("handout") ("trans")
-                        ("ignorenonframetext") ("onlytextwidth")
-                        ("noamssymb") ("bigger") ("smaller") ("8pt") ("9pt")
-                        ("10pt") ("11pt") ("12pt") ("14pt") ("17pt") ("20pt")
-                        ("draft") ("CJK") ("cjk") ("pgf")
-                        ("hyperref" LaTeX-hyperref-package-options-list)
-                        ("color" LaTeX-color-package-options)
-                        ("xcolor" LaTeX-xcolor-package-options)
-                        ("ucs") ("utf8x") ("utf8")
-                        ("aspectratio" ("2013" "1610" "169" "149" "141" "54" 
"43" "32")))))
+  "Prompt for the class options for the beamer class."
+  (TeX-read-key-val t LaTeX-beamer-class-options-list))
 
 ;;; beamer.el ends here
diff --git a/style/biblatex.el b/style/biblatex.el
index 3254ce85..52e9e2ec 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -203,8 +203,8 @@ for citation keys."
          (TeX-argument-insert
           (TeX-read-string (TeX-argument-prompt t nil "Global postnote"))
           (equal prenote ""))))
-  (let ((items t) (noinsert nil))
-    (while items
+  (let ((items t) (noinsert nil) (reftex--done nil))
+    (while (and items (not reftex--done))
       ;; Prompt for prenote and postnote of the current keys.
       (and TeX-arg-cite-note-p (not current-prefix-arg)
            (let ((TeX-arg-opening-brace "[")
@@ -221,7 +221,11 @@ for citation keys."
                            (fboundp 'reftex-plug-flag)
                            (reftex-plug-flag 3))
                       ;; Use RefTeX when enabled.
-                      (reftex-citation t)
+                      (prog1
+                          (reftex-citation t)
+                        ;; Don't loop when RefTeX citation is done.
+                        ;; (bug#64921)
+                        (setq reftex--done t))
                     ;; Multiple citation keys in each argument are allowed.
                     (TeX-completing-read-multiple
                      (TeX-argument-prompt optional prompt "Key(s)")
diff --git a/style/bicaption.el b/style/bicaption.el
index 245b4541..c0ed9773 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -1,6 +1,6 @@
 ;;; bicaption.el --- AUCTeX style for `bicaption.sty' (v1.1-158)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2016--2020 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -187,20 +187,22 @@ square brackets."
                               'textual)))
  TeX-dialect)
 
+(defun LaTeX-bicaption-package-options-list ()
+  "Return an alist of package options for bicaption package."
+  (TeX-load-style "caption")
+  (append `(,(list "language"
+                   (cond ((and (member "babel" (TeX-style-list))
+                               (LaTeX-babel-active-languages))
+                          (butlast (LaTeX-babel-active-languages)))
+                         ((and (member "polyglossia" (TeX-style-list))
+                               (LaTeX-polyglossia-active-languages))
+                          (butlast (LaTeX-babel-active-languages)))
+                         (t nil))))
+          LaTeX-bicaption-key-val-options
+          LaTeX-caption-key-val-options))
+
 (defun LaTeX-bicaption-package-options ()
   "Prompt for package options for the bicaption package."
-  (TeX-load-style "caption")
-  (TeX-read-key-val t
-                    (append
-                     `(,(list "language"
-                              (cond ((and (member "babel" (TeX-style-list))
-                                          (LaTeX-babel-active-languages))
-                                     (butlast (LaTeX-babel-active-languages)))
-                                    ((and (member "polyglossia" 
(TeX-style-list))
-                                          (LaTeX-polyglossia-active-languages))
-                                     (butlast (LaTeX-babel-active-languages)))
-                                    (t nil))))
-                     LaTeX-bicaption-key-val-options
-                     LaTeX-caption-key-val-options)))
+  (TeX-read-key-val t (LaTeX-bicaption-package-options-list)))
 
 ;;; bicaption.el ends here
diff --git a/style/caption.el b/style/caption.el
index 073dff4e..db745142 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--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -384,16 +384,16 @@ STAR is non-nil, do not query for a short-caption and a 
label."
 
     '("captionsetup"
       (TeX-arg-conditional (member "bicaption" (TeX-style-list))
-                           ([LaTeX-arg-bicaption-captionsetup])
-                           ([TeX-arg-completing-read
-                             LaTeX-caption-supported-float-types "Float 
type"]))
+          ([LaTeX-arg-bicaption-captionsetup])
+        ([TeX-arg-completing-read
+          LaTeX-caption-supported-float-types "Float type"]))
       (TeX-arg-key-val (LaTeX-caption-key-val-options)))
 
     '("captionsetup*"
       (TeX-arg-conditional (member "bicaption" (TeX-style-list))
-                           ([LaTeX-arg-bicaption-captionsetup])
-                           ([TeX-arg-completing-read
-                             LaTeX-caption-supported-float-types "Float 
type"]))
+          ([LaTeX-arg-bicaption-captionsetup])
+        ([TeX-arg-completing-read
+          LaTeX-caption-supported-float-types "Float type"]))
       (TeX-arg-key-val (LaTeX-caption-key-val-options)))
 
     '("clearcaptionsetup"
@@ -476,12 +476,15 @@ STAR is non-nil, do not query for a short-caption and a 
label."
                               'function)) )
  TeX-dialect)
 
+(defvar LaTeX-caption-package-options-list
+  (append '(("compatibility"  ("true" "false"))
+            ("figureposition" ("top" "above" "bottom" "below"))
+            ("tableposition"  ("top" "above" "bottom" "below")))
+          LaTeX-caption-key-val-options)
+  "Package options for the caption package.")
+
 (defun LaTeX-caption-package-options ()
   "Prompt for package options for the caption package."
-  (TeX-read-key-val t
-                    (append '(("compatibility"  ("true" "false")))
-                            '(("figureposition" ("top" "above" "bottom" 
"below")))
-                            '(("tableposition"  ("top" "above" "bottom" 
"below")))
-                            LaTeX-caption-key-val-options)))
+  (TeX-read-key-val t LaTeX-caption-package-options-list))
 
 ;;; caption.el ends here
diff --git a/style/changes.el b/style/changes.el
index b0277686..96ca2c23 100644
--- a/style/changes.el
+++ b/style/changes.el
@@ -1,6 +1,6 @@
 ;;; changes.el --- AUCTeX style for `changes.sty'  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2021--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -172,39 +172,41 @@
                               'reference)))
  TeX-dialect)
 
-(defun LaTeX-changes-package-options ()
-  "Prompt for package options for the changes package."
+(defun LaTeX-changes-package-options-list ()
+  "Return an alist of package options for changes package."
   (TeX-load-style "xcolor")
   (TeX-load-style "truncate")
   (TeX-load-style "ulem")
-  (TeX-read-key-val
-   t
-   (append
-    `(("defaultcolor"
-       ,(if (and (fboundp 'LaTeX-xcolor-definecolor-list)
-                 (LaTeX-xcolor-definecolor-list))
-            (mapcar #'car (LaTeX-xcolor-definecolor-list))
-          LaTeX-xcolor-base-colors)))
-    `(("draft")
-      ("final")
-      ("commandnameprefix" ("none" "ifneeded" "always"))
-      ("markup" ("default" "underlined" "bfit" "nocolor"))
-      ("addedmarkup" ("colored" "uline" "uuline" "uwave"
-                      "dashuline" "dotuline"
-                      "bf" "it" "sl" "em"))
-      ("deletedmarkup" ("sout" "xout" "colored"
-                        "uline" "uuline" "uwave"
-                        "dashuline" "dotuline"
-                        "bf" "it" "sl" "em"))
-      ("highlightmarkup" ("background" "uuline" "uwave"))
-      ("commentmarkup" ("todo" "margin" "footnote" "uwave"))
-      ("authormarkup" ("superscript" "subscript" "brackets"
-                       "footnote" "none"))
-      ("authormarkupposition" ("right" "left"))
-      ("authormarkuptext" ("id" "name"))
-      ("todonotes")
-      ("truncate" ,LaTeX-truncate-package-options)
-      ("ulem" ,LaTeX-ulem-package-options)
-      ("xcolor" ,LaTeX-xcolor-package-options)))))
+  (append
+   `(("defaultcolor"
+      ,(if (and (fboundp 'LaTeX-xcolor-definecolor-list)
+                (LaTeX-xcolor-definecolor-list))
+           (mapcar #'car (LaTeX-xcolor-definecolor-list))
+         LaTeX-xcolor-base-colors)))
+   `(("draft")
+     ("final")
+     ("commandnameprefix" ("none" "ifneeded" "always"))
+     ("markup" ("default" "underlined" "bfit" "nocolor"))
+     ("addedmarkup" ("colored" "uline" "uuline" "uwave"
+                     "dashuline" "dotuline"
+                     "bf" "it" "sl" "em"))
+     ("deletedmarkup" ("sout" "xout" "colored"
+                       "uline" "uuline" "uwave"
+                       "dashuline" "dotuline"
+                       "bf" "it" "sl" "em"))
+     ("highlightmarkup" ("background" "uuline" "uwave"))
+     ("commentmarkup" ("todo" "margin" "footnote" "uwave"))
+     ("authormarkup" ("superscript" "subscript" "brackets"
+                      "footnote" "none"))
+     ("authormarkupposition" ("right" "left"))
+     ("authormarkuptext" ("id" "name"))
+     ("todonotes")
+     ("truncate" ,LaTeX-truncate-package-options)
+     ("ulem" ,LaTeX-ulem-package-options)
+     ("xcolor" ,LaTeX-xcolor-package-options))))
+
+(defun LaTeX-changes-package-options ()
+  "Prompt for package options for the changes package."
+  (TeX-read-key-val t (LaTeX-changes-package-options-list)))
 
 ;;; changes.el ends here
diff --git a/style/csquotes.el b/style/csquotes.el
index 9caf2a3b..a736f2e5 100644
--- a/style/csquotes.el
+++ b/style/csquotes.el
@@ -1,6 +1,6 @@
 ;;; csquotes.el --- AUCTeX style for `csquotes.sty' (v5.2j)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2004--2023 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -342,73 +342,77 @@ retrieve the active languages."
                                 'variable))))
  TeX-dialect)
 
+(defvar LaTeX-csquotes-package-options-list
+  '(("strict"     ("true" "false"))
+    ("style"      ("american"
+                   "australian"
+                   "austrian"
+                   "brazil"
+                   "brazilian"
+                   "british"
+                   "canadian"
+                   "croatian"
+                   "czech"
+                   "danish"
+                   "dutch"
+                   "english"
+                   "finnish"
+                   "french"
+                   "german"
+                   "greek"
+                   "italian"
+                   "mexican"
+                   "naustrian"
+                   "newzealand"
+                   "ngerman"
+                   "norsk"
+                   "norwegian"
+                   "nswissgerman"
+                   "nynorsk"
+                   "portuges"
+                   "portuguese"
+                   "russian"
+                   "serbian"
+                   "spanish"
+                   "swedish"
+                   "swiss"
+                   "swissgerman"
+                   "UKenglish"
+                   "USenglish"))
+    ("autostyle"  ("true" "false" "try" "once" "tryonce"))
+    ("austrian"   ("quotes" "guillemets"))
+    ("croatian"   ("quotes" "guillemets" "guillemets*"))
+    ("czech"      ("quotes" "guillemets"))
+    ("danish"     ("quotes" "guillemets" "topquotes"))
+    ("english"    ("american" "british"))
+    ("estonian")
+    ("french"     ("quotes" "quotes*" "guillemets" "guillemets*"))
+    ("galician"   ("quotes" "guillemets"))
+    ("german"     ("quotes" "guillemets" "swiss"))
+    ("hungarian")
+    ("italian"    ("guillemets" "quotes"))
+    ("latvian")
+    ("norwegian"  ("guillemets" "quotes"))
+    ("polish"     ("guillemets" "guillemets*"))
+    ("portuguese" ("portuguese" "brazilian"))
+    ("serbian"    ("quotes" "guillemets" "german"))
+    ("spanish"    ("spanish" "mexican"))
+    ("swedish"    ("quotes" "guillemets" "guillemets*"))
+    ("maxlevel")
+    ("autopunct"     ("true" "false"))
+    ("threshold")
+    ("thresholdtype" ("lines" "words"))
+    ("parthreshold"  ("true" "false"))
+    ("splitcomp"     ("true" "false"))
+    ("csdisplay"     ("true" "false"))
+    ("debug"         ("true" "false"))
+    ;; "babel" key is deprecated, replaced by "autostyle":
+    ;; ("babel" ("true" "false" "try" "once" "tryonce"))
+    ("version"       ("4.4" "3.6" "3.0")))
+  "Package options for the csquotes package.")
+
 (defun LaTeX-csquotes-package-options ()
   "Prompt for package options for the csquotes package."
-  (TeX-read-key-val t '(("strict"     ("true" "false"))
-                        ("style"      ("american"
-                                       "australian"
-                                       "austrian"
-                                       "brazil"
-                                       "brazilian"
-                                       "british"
-                                       "canadian"
-                                       "croatian"
-                                       "czech"
-                                       "danish"
-                                       "dutch"
-                                       "english"
-                                       "finnish"
-                                       "french"
-                                       "german"
-                                       "greek"
-                                       "italian"
-                                       "mexican"
-                                       "naustrian"
-                                       "newzealand"
-                                       "ngerman"
-                                       "norsk"
-                                       "norwegian"
-                                       "nswissgerman"
-                                       "nynorsk"
-                                       "portuges"
-                                       "portuguese"
-                                       "russian"
-                                       "serbian"
-                                       "spanish"
-                                       "swedish"
-                                       "swiss"
-                                       "swissgerman"
-                                       "UKenglish"
-                                       "USenglish"))
-                        ("autostyle"  ("true" "false" "try" "once" "tryonce"))
-                        ("austrian"   ("quotes" "guillemets"))
-                        ("croatian"   ("quotes" "guillemets" "guillemets*"))
-                        ("czech"      ("quotes" "guillemets"))
-                        ("danish"     ("quotes" "guillemets" "topquotes"))
-                        ("english"    ("american" "british"))
-                        ("estonian")
-                        ("french"     ("quotes" "quotes*" "guillemets" 
"guillemets*"))
-                        ("galician"   ("quotes" "guillemets"))
-                        ("german"     ("quotes" "guillemets" "swiss"))
-                        ("hungarian")
-                        ("italian"    ("guillemets" "quotes"))
-                        ("latvian")
-                        ("norwegian"  ("guillemets" "quotes"))
-                        ("polish"     ("guillemets" "guillemets*"))
-                        ("portuguese" ("portuguese" "brazilian"))
-                        ("serbian"    ("quotes" "guillemets" "german"))
-                        ("spanish"    ("spanish" "mexican"))
-                        ("swedish"    ("quotes" "guillemets" "guillemets*"))
-                        ("maxlevel")
-                        ("autopunct"     ("true" "false"))
-                        ("threshold")
-                        ("thresholdtype" ("lines" "words"))
-                        ("parthreshold"  ("true" "false"))
-                        ("splitcomp"     ("true" "false"))
-                        ("csdisplay"     ("true" "false"))
-                        ("debug"         ("true" "false"))
-                        ;; "babel" key is deprecated, replaced by "autostyle":
-                        ;; ("babel" ("true" "false" "try" "once" "tryonce"))
-                        ("version"       ("4.4" "3.6" "3.0")))))
+  (TeX-read-key-val t LaTeX-csquotes-package-options-list))
 
 ;;; csquotes.el ends here
diff --git a/style/expl3.el b/style/expl3.el
index 51250bd8..4326f95b 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -83,14 +83,18 @@
                               'function)))
  TeX-dialect)
 
+(defvar LaTeX-expl3-package-options-list
+  '(("check-declarations" ("true" "false"))
+    ("log-functions" ("true" "false"))
+    ("enable-debug" ("true" "false"))
+    ("backend" ("dvips"   "dvipdfmx"
+                "dvisvgm" "luatex"
+                "pdftex"  "xetex"))
+    ("suppress-backend-headers" ("true" "false")))
+  "Package options for the expl3 package.")
+
 (defun LaTeX-expl3-package-options ()
-  "Read the expl3 package options from the user."
-  (TeX-read-key-val t '(("check-declarations" ("true" "false"))
-                        ("log-functions" ("true" "false"))
-                        ("enable-debug" ("true" "false"))
-                        ("backend" ("dvips"   "dvipdfmx"
-                                    "dvisvgm" "luatex"
-                                    "pdftex"  "xetex"))
-                        ("suppress-backend-headers" ("true" "false")))))
+  "Prompt for package options for the expl3 package."
+  (TeX-read-key-val t LaTeX-expl3-package-options-list))
 
 ;;; expl3.el ends here
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 56f5172b..530b0621 100644
--- a/style/fancyvrb.el
+++ b/style/fancyvrb.el
@@ -806,6 +806,14 @@ a list of strings."
    (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
    (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb*")
 
+   ;; Ispell: Add entries to `ispell-tex-skip-alist':
+   (when LaTeX-fancyvrb-chars
+     (TeX-ispell-skip-setcar
+      (mapcar (lambda (char)
+                (let ((str (char-to-string char)))
+                  (cons str str)))
+              LaTeX-fancyvrb-chars)))
+
    ;; Fontification
    (when (and (fboundp 'font-latex-add-keywords)
               (fboundp 'font-latex-set-syntactic-keywords)
@@ -838,6 +846,21 @@ a list of strings."
      (when (member "fvextra" (TeX-style-list))
        (LaTeX-fancyvrb-add-syntactic-keywords-extra 'brace
                                                     "SaveVerb"))
+
+     ;; Use `font-latex-syntactic-keywords-extra' instead of
+     ;; `font-latex-add-to-syntax-alist' so we can catch a backslash
+     ;; within the shortverb delimiters and make things like |xyz\|
+     ;; work correctly:
+     (when LaTeX-fancyvrb-chars
+       (dolist (c LaTeX-fancyvrb-chars)
+         (let ((s (char-to-string c)))
+           (add-to-list 'font-latex-syntactic-keywords-extra
+                        `(,(concat "\\(" s "\\)"
+                                   ".*?"
+                                   "\\(" (regexp-quote TeX-esc) "*\\)"
+                                   "\\(" s "\\)")
+                          (1 "\"") (2 ".") (3 "\""))))))
+
      ;; Tell font-lock about the update
      (font-latex-set-syntactic-keywords)))
  TeX-dialect)
diff --git a/style/fontenc.el b/style/fontenc.el
index ba430db8..abbd6a2a 100644
--- a/style/fontenc.el
+++ b/style/fontenc.el
@@ -1,6 +1,6 @@
 ;;; fontenc.el --- AUCTeX style for `fontenc.sty' (v1.99g)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2015--2023  Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -31,9 +31,7 @@
 
 ;;; Code:
 
-(require 'tex)
-
-(defvar LaTeX-fontenc-package-options-list
+(defvar LaTeX-fontenc-package-options
   '(;; 128+ glyph encodings (text)
     "OT1" "OT2" "OT3" "OT4" "OT6"
     ;; 256 glyph encodings (text)
@@ -44,12 +42,4 @@
     "LY1" "LV1" "LGR")
   "Package options for the fontenc package.")
 
-(defun LaTeX-fontenc-package-options ()
-  "Prompt for package options for the fontenc package."
-  (mapconcat #'identity
-             (TeX-completing-read-multiple
-              "Encoding(s): "
-              LaTeX-fontenc-package-options-list)
-             ","))
-
 ;;; fontenc.el ends here
diff --git a/style/geometry.el b/style/geometry.el
index f1cab730..aa169ce8 100644
--- a/style/geometry.el
+++ b/style/geometry.el
@@ -1,6 +1,6 @@
 ;;; geometry.el --- AUCTeX style for `geometry.sty' (v5.6)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -148,10 +148,13 @@ package.")
        (setq TeX-PDF-from-DVI "Dvipdfmx")))
  TeX-dialect)
 
+(defvar LaTeX-geometry-package-options-list
+  (append LaTeX-geometry-preamble-key-val-options
+          LaTeX-geometry-always-key-val-options)
+  "Package options for the geometry package.")
+
 (defun LaTeX-geometry-package-options ()
   "Prompt for package options for the geometry package."
-  (TeX-read-key-val t
-                    (append LaTeX-geometry-preamble-key-val-options
-                            LaTeX-geometry-always-key-val-options)))
+  (TeX-read-key-val t LaTeX-geometry-package-options-list))
 
 ;;; geometry.el ends here
diff --git a/style/mdsymbol.el b/style/mdsymbol.el
index d82f87ee..dfc89e9f 100644
--- a/style/mdsymbol.el
+++ b/style/mdsymbol.el
@@ -1,6 +1,6 @@
 ;;; mdsymbol.el --- AUCTeX style for `mdsymbol.sty' (v0.5)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2014, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -85,9 +85,8 @@
       '("lambdaslash"))))
  TeX-dialect)
 
-(defvar LaTeX-mdsymbol-package-options
-  '(;;
-    ("normalweight"  ("Light" "Regular" "autolight" "autoregular"))
+(defvar LaTeX-mdsymbol-package-options-list
+  '(("normalweight"  ("Light" "Regular" "autolight" "autoregular"))
     ("boldweight"    ("Semibold" "Bold" "autosemibold"))
     ("onlysansmath"  ("true" "false"))
     ("retainmissing" ("true" "false"))
@@ -97,6 +96,6 @@
 
 (defun LaTeX-mdsymbol-package-options nil
   "Prompt for package options for the mdsymbol package."
-  (TeX-read-key-val t LaTeX-mdsymbol-package-options))
+  (TeX-read-key-val t LaTeX-mdsymbol-package-options-list))
 
 ;;; mdsymbol.el ends here
diff --git a/style/menukeys.el b/style/menukeys.el
index 72b5560d..62c905d8 100644
--- a/style/menukeys.el
+++ b/style/menukeys.el
@@ -1,6 +1,6 @@
 ;;; menukeys.el --- AUCTeX style for `menukeys.sty' (v1.4)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2016--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -220,62 +220,57 @@ macro.  If RENEW is non-nil, query for an already defined 
macro."
 
     ;; 4.2.2 Declaring styles
     ;; \newmenustylesimple*{<name>}[<pre>]{<style>}[<sep>][<post>]{<theme>}
-    '("newmenustylesimple"
-      (TeX-arg-eval
-       (lambda ()
+    `("newmenustylesimple"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenustyles name)
-           (format "%s" name))))
+           (TeX-argument-insert name optional)))
       [ t ] nil [ nil ] [ nil ]
       (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
                                "Color theme"))
 
-    '("newmenustylesimple*"
-      (TeX-arg-eval
-       (lambda ()
+    `("newmenustylesimple*"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenustyles name)
-           (format "%s" name))))
+           (TeX-argument-insert name optional)))
       [ t ] nil [ nil ] [ nil ]
-      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list) "Color 
theme"))
+      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
+                               "Color theme"))
 
     ;; 
\newmenustyle*{<name>}[<pre>]{<first>}[<sep>]{<mid>}{<last>}{<single>}[<post>]{<theme>}
-    '("newmenustyle"
-      (TeX-arg-eval
-       (lambda ()
+    `("newmenustyle"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenustyles name)
-           (format "%s" name))))
+           (TeX-argument-insert name optional)))
       [ t ] nil [ nil ] nil nil nil [ nil ]
-      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list) "Color 
theme"))
+      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
+                               "Color theme"))
 
-    '("newmenustyle*"
-      (TeX-arg-eval
-       (lambda ()
+    `("newmenustyle*"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenustyles name)
-           (format "%s" name))))
+           (TeX-argument-insert name optional)))
       [ t ] nil [ nil ] nil nil nil [ nil ]
-      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list) "Color 
theme"))
+      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
+                               "Color theme"))
 
     '("CurrentMenuElement" 0)
 
     ;; 4.2.3 Copying styles
-    '("copymenustyle"
-      (TeX-arg-eval
-       (lambda ()
+    `("copymenustyle"
+      ,(lambda (optional)
          (let ((copy (TeX-read-string
-                      (TeX-argument-prompt nil nil "Copy")))
-               (orig (completing-read
-                      (TeX-argument-prompt nil nil "Original")
-                      (LaTeX-menukeys-newmenustyle-list))))
+                      (TeX-argument-prompt optional nil "Copy"))))
            (LaTeX-add-menukeys-newmenustyles copy)
-           (TeX-argument-insert copy nil)
-           (format "%s" orig)))))
+           (TeX-argument-insert copy optional)))
+      (TeX-arg-completing-read (LaTeX-menukeys-newmenustyle-list) "Original"))
 
     ;; 4.2.4 Changing styles
     ;; \changemenuelement*{name}{element}{definition}
@@ -294,13 +289,12 @@ macro.  If RENEW is non-nil, query for an already defined 
macro."
       (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
                                "Color theme"))
 
-    '("providemenustylesimple"
-      (TeX-arg-eval
-       (lambda ()
+    `("providemenustylesimple"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenustyles name)
-           (format "%s" name))))
+           (TeX-argument-insert name optional)))
       [ t ] nil [ nil ] [ nil ]
       (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
                                "Color theme"))
@@ -312,13 +306,12 @@ macro.  If RENEW is non-nil, query for an already defined 
macro."
       (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
                                "Color theme"))
 
-    '("renewmenustyle"
-      (TeX-arg-eval
-       (lambda ()
+    `("renewmenustyle"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenustyles name)
-           (format "%s" name))))
+           (TeX-argument-insert name optional)))
       [ t ] nil [ nil ] nil nil nil [ nil ]
       (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
                                "Color theme"))
@@ -326,116 +319,96 @@ macro.  If RENEW is non-nil, query for an already 
defined macro."
     ;; 4.3 Color themes
     ;; 4.3.2 Create a theme
     ;; \newmenucolortheme{<name>}{<model>}{<bg>}{<br>}{<txt>}[<a>][<b>][<c>]
-    '("newmenucolortheme"
-      (TeX-arg-eval
-       (lambda ()
+    `("newmenucolortheme"
+      ,(lambda (optional)
          (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
+                      (TeX-argument-prompt optional nil "Name"))))
            (LaTeX-add-menukeys-newmenucolorthemes name)
-           (format "%s" name))))
-      (TeX-arg-eval
-       (lambda ()
-         (let ((model (completing-read
-                       (TeX-argument-prompt nil nil "Model")
-                       (LaTeX-xcolor-color-models))))
-           (TeX-argument-insert model nil)
-           (if (string= model "named")
-               (let ((bg (completing-read
-                          (TeX-argument-prompt nil nil "Node background color")
-                          (LaTeX-xcolor-definecolor-list)))
-                     (br (completing-read
-                          (TeX-argument-prompt nil nil "Node border color")
-                          (LaTeX-xcolor-definecolor-list)))
-                     (txt (completing-read
-                           (TeX-argument-prompt nil nil "Node text color")
-                           (LaTeX-xcolor-definecolor-list))))
-                 (TeX-argument-insert bg nil)
-                 (TeX-argument-insert br nil)
-                 (format "%s" txt))
-             (let ((bg (TeX-read-string
-                        (TeX-argument-prompt nil nil "Node background color 
spec")))
-                   (br (TeX-read-string
-                        (TeX-argument-prompt nil nil "Node border color 
spec")))
-                   (txt (TeX-read-string
-                         (TeX-argument-prompt nil nil "Node text color 
spec"))))
-               (TeX-argument-insert bg nil)
-               (TeX-argument-insert br nil)
-               (format "%s" txt))))))
+           (TeX-argument-insert name optional)))
+      (TeX-arg-completing-read (LaTeX-xcolor-color-models) "Model")
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\newmenucolortheme{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list)
+                                    "Node background color"))
+        ("Node background color spec"))
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\newmenucolortheme{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list)
+                                    "Node border color"))
+        ("Node border color spec"))
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\newmenucolortheme{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list)
+                                    "Node text color"))
+        ("Node text color spec"))
       (TeX-arg-conditional (y-or-n-p "With additional optional arguments? ")
-                           ( [ 3 ] )
-                           (ignore)))
+          ( [ 3 ] )
+        (ignore)))
 
     ;; 4.3.3 Copy a theme
-    '("copymenucolortheme"
-      (TeX-arg-eval
-       (lambda ()
+    `("copymenucolortheme"
+      ,(lambda (optional)
          (let ((copy (TeX-read-string
-                      (TeX-argument-prompt nil nil "Copy")))
-               (orig (completing-read
-                      (TeX-argument-prompt nil nil "Original")
-                      (LaTeX-menukeys-newmenucolortheme-list))))
+                      (TeX-argument-prompt optional nil "Copy"))))
            (LaTeX-add-menukeys-newmenucolorthemes copy)
-           (TeX-argument-insert copy nil)
-           (format "%s" orig)))))
+           (TeX-argument-insert copy optional)))
+      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
+                               "Original"))
 
     ;; 4.3.4 Change a theme
     '("changemenucolor"
       (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list) "Name")
       (TeX-arg-completing-read ("bg" "br" "txt") "Element")
-      (TeX-arg-eval
-       (lambda ()
-         (let ((model (completing-read
-                       (TeX-argument-prompt nil nil "Model")
-                       (LaTeX-xcolor-color-models))))
-           (TeX-argument-insert model nil)
-           (if (string= model "named")
-               (let ((color (completing-read
-                             (TeX-argument-prompt nil nil "Color")
-                             (LaTeX-xcolor-definecolor-list))))
-                 (format "%s" color))
-             (let ((color (TeX-read-string
-                           (TeX-argument-prompt nil nil "Color spec"))))
-               (format "%s" color)))))))
+      (TeX-arg-completing-read (LaTeX-xcolor-color-models) "Model")
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\changemenucolor{[^}]+}{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list) "Color"))
+        ("Color spec")))
 
     ;; Same arguments as \newmenucolortheme
     '("renewmenucolortheme"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Name"))))
-           (LaTeX-add-menukeys-newmenucolorthemes name)
-           (format "%s" name))))
-      (TeX-arg-eval
-       (lambda ()
-         (let ((model (completing-read
-                       (TeX-argument-prompt nil nil "Model")
-                       (LaTeX-xcolor-color-models))))
-           (TeX-argument-insert model nil)
-           (if (string= model "named")
-               (let ((bg (completing-read
-                          (TeX-argument-prompt nil nil "Node background color")
-                          (LaTeX-xcolor-definecolor-list)))
-                     (br (completing-read
-                          (TeX-argument-prompt nil nil "Node border color")
-                          (LaTeX-xcolor-definecolor-list)))
-                     (txt (completing-read
-                           (TeX-argument-prompt nil nil "Node text color")
-                           (LaTeX-xcolor-definecolor-list))))
-                 (TeX-argument-insert bg nil)
-                 (TeX-argument-insert br nil)
-                 (format "%s" txt))
-             (let ((bg (TeX-read-string
-                        (TeX-argument-prompt nil nil "Node background color 
spec")))
-                   (br (TeX-read-string
-                        (TeX-argument-prompt nil nil "Node border color 
spec")))
-                   (txt (TeX-read-string
-                         (TeX-argument-prompt nil nil "Node text color 
spec"))))
-               (TeX-argument-insert bg nil)
-               (TeX-argument-insert br nil)
-               (format "%s" txt))))))
+      (TeX-arg-completing-read (LaTeX-menukeys-newmenucolortheme-list)
+                               "Name")
+      (TeX-arg-completing-read (LaTeX-xcolor-color-models) "Model")
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\renewmenucolortheme{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list)
+                                    "Node background color"))
+        ("Node background color spec"))
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\renewmenucolortheme{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list)
+                                    "Node border color"))
+        ("Node border color spec"))
+      (TeX-arg-conditional (save-excursion
+                             (re-search-backward
+                              "\\\\renewmenucolortheme{[^}]+}{\\([^}]+\\)}"
+                              (line-beginning-position) t)
+                             (string= (match-string-no-properties 1) "named"))
+          ((TeX-arg-completing-read (LaTeX-xcolor-definecolor-list)
+                                    "Node text color"))
+        ("Node text color spec"))
       (TeX-arg-conditional (y-or-n-p "With additional optional arguments? ")
-                           ( [ 3 ] )
-                           (ignore)))
+          ( [ 3 ] )
+        (ignore)))
 
     ;; 4.4 Menu macros
     ;; 4.4.2 Defining or changing menu macros
@@ -463,18 +436,17 @@ macro.  If RENEW is non-nil, query for an already defined 
macro."
            (os '("mac" "win"))
            collector)
        (dolist (cmd keycmds)
-         (cond
-          ((= (cdr cmd) 0)
-           (push (car cmd) collector))
-          ((= (cdr cmd) 1)
-           (push (list (car cmd) '(TeX-arg-completing-read
-                                   ("^" "v" ">" "<")
-                                   "Direction"))
-                 collector))
-          ((= (cdr cmd) 2)
-           (push (car cmd) collector)
-           (dolist (x os)
-             (push (concat (car cmd) x) collector)))))
+         (cond ((= (cdr cmd) 0)
+                (push (car cmd) collector))
+               ((= (cdr cmd) 1)
+                (push (list (car cmd)
+                            '(TeX-arg-completing-read  ("^" "v" ">" "<")
+                                                       "Direction"))
+                      collector))
+               ((= (cdr cmd) 2)
+                (push (car cmd) collector)
+                (dolist (x os)
+                  (push (concat (car cmd) x) collector)))))
        (apply #'TeX-add-symbols collector)))
 
    ;; Fontification:
diff --git a/style/microtype.el b/style/microtype.el
index 9287ccaa..528ad5a2 100644
--- a/style/microtype.el
+++ b/style/microtype.el
@@ -1,6 +1,6 @@
 ;;; microtype.el --- AUCTeX style for `microtype.sty'  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2022 Free Software Foundation, Inc.
+;; Copyright (C) 2022--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -231,10 +231,13 @@
                               'type-declaration)))
  TeX-dialect)
 
+(defvar LaTeX-microtype-package-options-list
+  (append '((config))
+          LaTeX-microtype-key-val-options)
+  "Package options for the microtype package.")
+
 (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)))
+  "Prompt for package options for the microtype package."
+  (TeX-read-key-val t LaTeX-microtype-package-options-list))
 
 ;;; microtype.el ends here
diff --git a/style/natbib.el b/style/natbib.el
index 3cac5960..b7eb9838 100644
--- a/style/natbib.el
+++ b/style/natbib.el
@@ -74,7 +74,9 @@
            ;; Pre and post notes
            (list
             (car cmd)
-            '(TeX-arg-conditional TeX-arg-cite-note-p 
([LaTeX-arg-natbib-notes]) nil)
+            '(TeX-arg-conditional TeX-arg-cite-note-p
+                 (["Pre-note"] LaTeX-arg-natbib-notes)
+               nil)
             #'TeX-arg-cite))))
        citecmds))
 
@@ -173,21 +175,18 @@
      (reftex-set-cite-format 'natbib)))
  TeX-dialect)
 
-(defun LaTeX-arg-natbib-notes (optional)
-  "Prompt for two note arguments a natbib citation command.
-If OPTIONAL is non-nil, insert them in brackets, otherwise in
-braces."
-  (let ((pre (TeX-read-string
-              (TeX-argument-prompt optional nil "Pre-note")))
-        (post (TeX-read-string
-               (TeX-argument-prompt optional nil "Post-note"))))
-    (TeX-argument-insert pre optional)
-    (TeX-argument-insert post optional)
-    ;; pre is given, post is empty: Make sure that we insert an
-    ;; extra pair of `[]', otherwise pre becomes post
-    (when (and pre (not (string= pre ""))
-               (string= post ""))
-      (insert LaTeX-optop LaTeX-optcl))))
+(defun LaTeX-arg-natbib-notes (_optional)
+  "Prompt for the post-note argument of a natbib citation command.
+OPTIONAL is ignored."
+  (let ((post (TeX-read-string
+               (TeX-argument-prompt t nil "Post-note")))
+        (TeX-arg-opening-brace LaTeX-optop)
+        (TeX-arg-closing-brace LaTeX-optcl))
+    ;; Pre-note is given, Post-note is empty: Make sure that we insert
+    ;; an extra pair of `[]', otherwise pre becomes post
+    (if (and (string-empty-p post) (= (preceding-char) ?\]))
+        (insert LaTeX-optop LaTeX-optcl)
+      (TeX-argument-insert post t))))
 
 (defvar LaTeX-natbib-package-options '("numbers" "super" "authoryear"
                                        "round" "square" "angle" "curly"
diff --git a/style/newfloat.el b/style/newfloat.el
index 50b0a4e0..f90b6148 100644
--- a/style/newfloat.el
+++ b/style/newfloat.el
@@ -200,14 +200,15 @@ If `caption.el' is loaded, add the new floating 
environment to
                               'function)))
  TeX-dialect)
 
+(defun LaTeX-newfloat-package-options-list ()
+  "Return an alist of package options for the newfloat package."
+  (append '(("chapterlistsgap"))
+          (if (< (LaTeX-largest-level) 2)
+              '(("within" ("chapter" "section" "none")))
+            '(("within" ("section" "none"))))))
+
 (defun LaTeX-newfloat-package-options ()
   "Prompt for package options for the newfloat package."
-  (TeX-read-key-val
-   t
-   (append
-    '(("chapterlistsgap"))
-    (if (< (LaTeX-largest-level) 2)
-        '(("within" ("chapter" "section" "none")))
-      '(("within" ("section" "none")))))))
+  (TeX-read-key-val t (LaTeX-newfloat-package-options-list)))
 
 ;;; newfloat.el ends here
diff --git a/style/ntheorem.el b/style/ntheorem.el
index 59455b99..7396970d 100644
--- a/style/ntheorem.el
+++ b/style/ntheorem.el
@@ -1,6 +1,6 @@
 ;;; ntheorem.el --- AUCTeX style for `ntheorem.sty' (v1.33)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2015-2023  Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -122,13 +122,9 @@ make them available as new environments.  Update
  (lambda ()
 
    (TeX-auto-add-regexp
-    `(,(concat "\\\\newtheorem{\\(" TeX-token-char "+\\)}")
-      1 LaTeX-auto-ntheorem-newtheorem))
-   (TeX-auto-add-regexp
-    `(,(concat "\\\\newframedtheorem{\\(" TeX-token-char "+\\)}")
-      1 LaTeX-auto-ntheorem-newtheorem))
-   (TeX-auto-add-regexp
-    `(,(concat "\\\\newshadedtheorem{\\(" TeX-token-char "+\\)}")
+    `(,(concat "\\\\"
+               (regexp-opt '("newtheorem" "newframedtheorem" 
"newshadedtheorem"))
+               "{\\(" TeX-token-char "+\\)}")
       1 LaTeX-auto-ntheorem-newtheorem))
    (TeX-auto-add-regexp
     `(,(concat "\\\\newtheoremstyle{\\(" TeX-token-char "+\\)}")
@@ -151,23 +147,25 @@ make them available as new environments.  Update
                                          #'LaTeX-env-label-args ["Heading"]))
            (TeX-argument-insert nthm optional)))
       [ TeX-arg-environment "Numbered like" ]
-      t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                        (backward-char 2)
-                                        (preceding-char)) ?\])
-                                  ()
-                                (TeX-arg-counter t "Within counter"))
-                        "") ])
+      "Title"
+      (TeX-arg-conditional (save-excursion
+                             (skip-chars-backward (concat "^" TeX-grcl))
+                             (backward-list)
+                             (= (preceding-char) ?\]))
+          ()
+        ([TeX-arg-counter "Within counter"])))
 
     '("renewtheorem"
       (TeX-arg-completing-read (LaTeX-ntheorem-newtheorem-list)
                                "Environment")
       [ TeX-arg-environment "Numbered like" ]
-      t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                        (backward-char 2)
-                                        (preceding-char)) ?\])
-                                  ()
-                                (TeX-arg-counter t "Within counter"))
-                        "") ])
+      "Title"
+      (TeX-arg-conditional (save-excursion
+                             (skip-chars-backward (concat "^" TeX-grcl))
+                             (backward-list)
+                             (= (preceding-char) ?\]))
+          ()
+        ([TeX-arg-counter "Within counter"])))
 
     ;; 2.3 Defining the Layout of Theorem Sets
     '("theoremstyle"
@@ -245,12 +243,13 @@ make them available as new environments.  Update
                                          #'LaTeX-env-label-args ["Heading"]))
            (TeX-argument-insert nthm optional)))
       [ TeX-arg-environment "Numbered like" ]
-      t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                        (backward-char 2)
-                                        (preceding-char)) ?\])
-                                  ()
-                                (TeX-arg-counter t "Within counter"))
-                        "") ])
+      "Title"
+      (TeX-arg-conditional (save-excursion
+                             (skip-chars-backward (concat "^" TeX-grcl))
+                             (backward-list)
+                             (= (preceding-char) ?\]))
+          ()
+        ([TeX-arg-counter "Within counter"])))
 
     `("newshadedtheorem"
       ,(lambda (optional)
@@ -263,12 +262,14 @@ make them available as new environments.  Update
                                          #'LaTeX-env-label-args ["Heading"]))
            (TeX-argument-insert nthm optional)))
       [ TeX-arg-environment "Numbered like" ]
-      t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                        (backward-char 2)
-                                        (preceding-char)) ?\])
-                                  ()
-                                (TeX-arg-counter t "Within counter"))
-                        "") ])
+      "Title"
+      (TeX-arg-conditional (save-excursion
+                             (skip-chars-backward (concat "^" TeX-grcl))
+                             (backward-list)
+                             (= (preceding-char) ?\]))
+          ()
+        ([TeX-arg-counter "Within counter"])))
+
     `("shadecolor"
       (TeX-arg-conditional (TeX-member "\\`x?color\\'" (TeX-style-list) 
#'string-match)
           ((TeX-arg-completing-read ,(lambda ()
diff --git a/style/paralist.el b/style/paralist.el
index ee5cef83..38920ca9 100644
--- a/style/paralist.el
+++ b/style/paralist.el
@@ -1,6 +1,6 @@
 ;;; paralist.el -- AUCTeX style for paralist.sty  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2005, 2014, 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2023 Free Software Foundation, Inc.
 
 ;; Author:   Ralf Angeli <angeli@iwi.uni-sb.de>
 ;; Maintainer: auctex-devel@gnu.org
@@ -38,20 +38,6 @@
                   "font-latex"
                   (keywords class))
 
-;; Insert an itemize-ish environment and ask for an optional label
-(defun LaTeX-paralist-env-item-opt-label (environment)
-  "Insert ENVIRONMENT, an optional label and the first item."
-  (LaTeX-insert-environment
-   environment
-   (let ((label (TeX-read-string "(Optional) Label: ")))
-     (concat (unless (zerop (length label))
-               (format "[%s]" label)))))
-  (LaTeX-find-matching-begin)
-  (end-of-line 1)
-  (delete-char 1)
-  (delete-horizontal-space)
-  (LaTeX-insert-item))
-
 (TeX-add-style-hook
  "paralist"
  (lambda ()
@@ -74,21 +60,21 @@
 
    ;; New environments
    (LaTeX-add-environments
-    '("asparaenum" LaTeX-paralist-env-item-opt-label)
-    '("inparaenum" LaTeX-paralist-env-item-opt-label)
-    '("compactenum" LaTeX-paralist-env-item-opt-label)
-    '("asparaitem" LaTeX-paralist-env-item-opt-label)
-    '("inparaitem" LaTeX-paralist-env-item-opt-label)
-    '("compactitem" LaTeX-paralist-env-item-opt-label)
+    '("asparaenum" LaTeX-env-item-args ["Label"])
+    '("inparaenum" LaTeX-env-item-args ["Label"])
+    '("compactenum" LaTeX-env-item-args ["Label"])
+    '("asparaitem" LaTeX-env-item-args ["Label"])
+    '("inparaitem" LaTeX-env-item-args ["Label"])
+    '("compactitem" LaTeX-env-item-args ["Label"])
     '("compactdesc" LaTeX-env-item))
    ;; Environments (re)defined only when the package is loaded with particular
    ;; options.
    (unless (LaTeX-provided-package-options-member "paralist" "olditem")
      (LaTeX-add-environments
-      '("itemize" LaTeX-paralist-env-item-opt-label)))
+      '("itemize" LaTeX-env-item-args ["Label"])))
    (unless (LaTeX-provided-package-options-member "paralist" "oldenum")
      (LaTeX-add-environments
-      '("enumerate" LaTeX-paralist-env-item-opt-label)))
+      '("enumerate" LaTeX-env-item-args ["Label"])))
    (when (LaTeX-provided-package-options-member "paralist" "defblank")
      (LaTeX-add-environments
       '("asparablank" LaTeX-env-item)
diff --git a/style/parskip.el b/style/parskip.el
index 861d4698..cafca0cb 100644
--- a/style/parskip.el
+++ b/style/parskip.el
@@ -1,6 +1,6 @@
 ;;; parskip.el --- AUCTeX style for `parskip.sty' (v2.0h)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2022 Free Software Foundation, Inc.
+;; Copyright (C) 2022--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -37,14 +37,18 @@
 (require 'tex)
 (require 'latex)
 
-(defun LaTeX-parskip-package-options ()
-  "Prompt for package options for the parskip package."
+(defun LaTeX-parskip-package-options-list ()
+  "Return an alist of package options for the parskip package."
   (let ((len (mapcar (lambda (x)
                        (concat TeX-esc (car x)))
                      (LaTeX-length-list))))
-    (TeX-read-key-val t `(("skip"    ,len)
-                          ("tocskip" ,len)
-                          ("indent"  ,len)
-                          ("parfill" ,len)))))
+    `(("skip"    ,len)
+      ("tocskip" ,len)
+      ("indent"  ,len)
+      ("parfill" ,len))))
+
+(defun LaTeX-parskip-package-options ()
+  "Prompt for package options for the parskip package."
+  (TeX-read-key-val t (LaTeX-parskip-package-options-list)))
 
 ;;; parskip.el ends here
diff --git a/style/revtex4-2.el b/style/revtex4-2.el
index 26a5eff5..13020afb 100644
--- a/style/revtex4-2.el
+++ b/style/revtex4-2.el
@@ -1,6 +1,6 @@
 ;;; revtex4-2.el --- AUCTeX style for `revtex4-2.cls' (v4.2c)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2020--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -38,6 +38,8 @@
 (declare-function font-latex-add-keywords
                   "font-latex"
                   (keywords class))
+(declare-function font-latex-set-syntactic-keywords
+                  "font-latex")
 (defvar LaTeX-natbib-package-options)
 (defvar LaTeX-url-package-options)
 
@@ -132,10 +134,14 @@ provided by REVTeX class."
 
     ;; VIII.1. Citing a reference
     '("onlinecite"
-      (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
+      (TeX-arg-conditional TeX-arg-cite-note-p
+          (["Pre-note"] LaTeX-arg-natbib-notes)
+        nil)
       TeX-arg-cite)
     '("textcite"
-      (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
+      (TeX-arg-conditional TeX-arg-cite-note-p
+          (["Pre-note"] LaTeX-arg-natbib-notes)
+        nil)
       TeX-arg-cite)
 
     ;; IX.2 video environment
@@ -192,13 +198,14 @@ provided by REVTeX class."
               (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("fbox"          "*[{")
                                 ("keywords"      "{")
-                                ("preprint"      "")
-                                ("onecolumngrid" "")
-                                ("twocolumngrid" "")
-                                ("squeezetable"  "")
                                 ("printtables"   "*")
                                 ("printfigures"  "*"))
                               'function)
+     (font-latex-add-keywords '("preprint"
+                                "onecolumngrid"
+                                "twocolumngrid"
+                                "squeezetable")
+                              'function-noarg)
      (font-latex-add-keywords '(("affiliation"    "{")
                                 ("noaffiliation"  "")
                                 ("collaboration"  "{")
@@ -211,7 +218,9 @@ provided by REVTeX class."
                                 ("setfloatlink" ""))
                               'reference)
      (font-latex-add-keywords '(("appendix*" ""))
-                              'warning)))
+                              'warning)
+     ;; Tell font-lock about the update
+     (font-latex-set-syntactic-keywords)))
  TeX-dialect)
 
 (defvar LaTeX-revtex4-2-class-options
diff --git a/style/siunitx.el b/style/siunitx.el
index da09a7e3..cec13b59 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -1,6 +1,6 @@
 ;;; siunitx.el --- AUCTeX style for `siunitx.sty' version 3.3.36.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2023  Free Software Foundation, Inc.
 
 ;; Maintainer: auctex-devel@gnu.org
 ;; Author: Mosè Giordano <mose@gnu.org>
@@ -512,11 +512,13 @@ string."
                                   'function)))))
  TeX-dialect)
 
+(defvar LaTeX-siunitx-package-options-list
+  (append '(("table-column-type")) ; 'table-column-type' is a preamble only
+          LaTeX-siunitx-package-options)
+  "Package options for the siunitx package.")
+
 (defun LaTeX-siunitx-package-options nil
   "Prompt for package options for the siunitx package."
-  (TeX-read-key-val t (append
-                       ;; 'table-column-type' is a preamble only:
-                       '(("table-column-type"))
-                       LaTeX-siunitx-package-options)))
+  (TeX-read-key-val t LaTeX-siunitx-package-options-list))
 
 ;; siunitx.el ends here
diff --git a/style/subcaption.el b/style/subcaption.el
index c98596a5..67b96e4f 100644
--- a/style/subcaption.el
+++ b/style/subcaption.el
@@ -1,6 +1,6 @@
 ;;; subcaption.el --- AUCTeX style for `subcaption.sty' (v1.3)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -196,10 +196,15 @@ caption, insert only a caption."
                               'function)) )
  TeX-dialect)
 
+(defvar LaTeX-subcaption-package-options-list
+  (progn
+    (TeX-load-style "caption")
+    (append LaTeX-subcaption-key-val-options
+            LaTeX-caption-key-val-options))
+  "Package options for the subcaption package.")
+
 (defun LaTeX-subcaption-package-options ()
   "Prompt for package options for the subcaption package."
-  (TeX-load-style "caption")
-  (TeX-read-key-val t (append LaTeX-subcaption-key-val-options
-                              LaTeX-caption-key-val-options)))
+  (TeX-read-key-val t LaTeX-subcaption-package-options-list))
 
 ;;; subcaption.el ends here
diff --git a/style/theorem.el b/style/theorem.el
index 52aea651..91a3d391 100644
--- a/style/theorem.el
+++ b/style/theorem.el
@@ -1,6 +1,6 @@
 ;;; theorem.el --- AUCTeX style for `theorem.sty' (v2.2c)  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2015-2023  Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -94,12 +94,13 @@ make them available as new environments."
            (LaTeX-add-environments (list nthm #'LaTeX-env-label-args 
["Heading"]))
            (TeX-argument-insert nthm optional)))
       [ TeX-arg-environment "Numbered like" ]
-      t [ (TeX-arg-eval progn (if (eq (save-excursion
-                                        (backward-char 2)
-                                        (preceding-char)) ?\])
-                                  ()
-                                (TeX-arg-counter t "Within counter"))
-                        "") ])
+      "Title"
+      (TeX-arg-conditional (save-excursion
+                             (skip-chars-backward (concat "^" TeX-grcl))
+                             (backward-list)
+                             (= (preceding-char) ?\]))
+          ()
+        ([TeX-arg-counter "Within counter"])))
 
     '("theoremstyle"
       (TeX-arg-completing-read LaTeX-theorem-theoremstyle-list "Style"))
diff --git a/style/wasysym.el b/style/wasysym.el
index 8ac47d9d..8fef61c9 100644
--- a/style/wasysym.el
+++ b/style/wasysym.el
@@ -30,6 +30,9 @@
 
 ;;; Code:
 
+(require 'tex)
+(require 'latex)
+
 (TeX-add-style-hook
  "wasysym"
  (lambda ()
diff --git a/style/xparse.el b/style/xparse.el
index 9961cc6a..e71e456d 100644
--- a/style/xparse.el
+++ b/style/xparse.el
@@ -351,8 +351,12 @@ TYPE is one of the symbols mac or env."
                               'function)))
  TeX-dialect)
 
+(defvar LaTeX-xparse-package-options-list
+  '(("log-declarations" ("true" "false")))
+  "Package options for the xparse package.")
+
 (defun LaTeX-xparse-package-options ()
   "Read the xparse package options from the user."
-  (TeX-read-key-val t '(("log-declarations" ("true" "false")))))
+  (TeX-read-key-val t LaTeX-xparse-package-options-list))
 
 ;;; xparse.el ends here
diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 7ec3d6df..40f9633a 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -1,6 +1,6 @@
 ;;; font-latex-test.el --- tests for font-latex  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2020-2023  Free Software Foundation, Inc.
 
 ;; This file is part of AUCTeX.
 
@@ -405,4 +405,75 @@ foo \"xyz\\\" bar
       (search-forward "ba" nil t)
       (should-not (get-text-property (point) 'face)))))
 
+(ert-deftest font-latex-verb-macros-with-braces ()
+  "Test fontification for verb macros with argument in braces."
+  (with-temp-buffer
+    (let ((TeX-install-font-lock #'font-latex-setup)
+          (TeX-parse-self t))
+      (insert "\
+\\documentclass{article}
+\\usepackage{fvextra}
+\\usepackage{hyperref}
+\\begin{document}
+foo \\Verb[commandchars=\\\\\\{\\}]{Pre \fbox{Middle} Post} bar
+foo \\Verb{w{o}r{k}s} bar
+foo \\Verb{b{r}eak{s}} bar
+foo \\href[ismap=false]{text \\cmd{test} text}{more text} bar
+foo \\path{C:\\path\\to\\} bar
+\\end{document}")
+      (LaTeX-mode)
+      (TeX-update-style t)
+      (syntax-ppss-flush-cache (point-min))
+      (font-lock-ensure)
+      (goto-char (point-min))
+
+      (re-search-forward "^f" nil t)
+      (should-not (get-text-property (point) 'face))
+      (search-forward "commandc")
+      (should (font-latex-faces-present-p 'font-lock-variable-name-face))
+      (search-forward "Mid")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "Po")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "ba")
+      (should-not (get-text-property (point) 'face))
+
+      (re-search-forward "^f" nil t)
+      (should-not (get-text-property (point) 'face))
+      (search-forward "k")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "ba")
+      (should-not (get-text-property (point) 'face))
+
+      (re-search-forward "^f" nil t)
+      (should-not (get-text-property (point) 'face))
+      (search-forward "s")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "ba")
+      (should-not (get-text-property (point) 'face))
+
+      (re-search-forward "^f" nil t)
+      (should-not (get-text-property (point) 'face))
+      (search-forward "ismap")
+      (should (font-latex-faces-present-p 'font-lock-variable-name-face))
+      (search-forward "text")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "cmd{t")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "text")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "more")
+      (should (font-latex-faces-present-p 'font-lock-constant-face))
+      (search-forward "ba")
+      (should-not (get-text-property (point) 'face))
+
+      (re-search-forward "^f" nil t)
+      (should-not (get-text-property (point) 'face))
+      (search-forward "C:")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "to")
+      (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+      (search-forward "ba")
+      (should-not (get-text-property (point) 'face)))))
+
 ;;; font-latex-test.el ends here
diff --git a/tex-fold.el b/tex-fold.el
index f1c261eb..21c74f47 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -131,7 +131,8 @@ and <mode-prefix>-fold-macro-spec-list.")
   '(("[comment]" ("comment")))
   "List of display strings and environments to fold."
   :type '(repeat (group (choice (string :tag "Display String")
-                                (integer :tag "Number of argument" :value 1))
+                                (integer :tag "Number of argument" :value 1)
+                                (function :tag "Function to execute"))
                         (repeat :tag "Environments" (string)))))
 
 (defvar TeX-fold-env-spec-list-internal nil
@@ -145,7 +146,8 @@ and <mode-prefix>-fold-env-spec-list.")
 (defcustom TeX-fold-math-spec-list nil
   "List of display strings and math macros to fold."
   :type '(repeat (group (choice (string :tag "Display String")
-                                (integer :tag "Number of argument" :value 1))
+                                (integer :tag "Number of argument" :value 1)
+                                (function :tag "Function to execute"))
                         (repeat :tag "Math Macros" (string)))))
 
 (defvar TeX-fold-math-spec-list-internal nil
@@ -511,8 +513,8 @@ TYPE is a symbol which is used to describe the content to 
hide
 and may be `macro' for macros, `math' for math macro and `env' for
 environments.
 DISPLAY-STRING-SPEC is the original specification of the display
-string in the variables `TeX-fold-macro-spec-list' or
-`TeX-fold-env-spec-list' and may be a string or an integer."
+string in the variables `TeX-fold-macro-spec-list' and alikes.
+See its doc string for detail."
   ;; Calculate priority before the overlay is instantiated.  We don't
   ;; want `TeX-overlay-prioritize' to pick up a non-prioritized one.
   (let ((priority (TeX-overlay-prioritize ov-start ov-end))
diff --git a/tex-jp.el b/tex-jp.el
index 3b91c4c3..01ee6138 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -498,7 +498,7 @@ Set `japanese-TeX-mode' to t, and enter `LaTeX-mode'."
 
 (defun japanese-LaTeX-guess-engine ()
   "Guess Japanese TeX engine and set it to `TeX-engine'.
-Document class and its option is considered in the guess.  Do not
+Document class and its option are taken into account.  Do not
 overwrite the value already set locally."
   ;; `TeX-engine' may be set by the file local variable or by the menu
   ;; Command->TeXing Options manually.  Don't override the user
diff --git a/tex-style.el b/tex-style.el
index d273ea08..615f49a1 100644
--- a/tex-style.el
+++ b/tex-style.el
@@ -1,6 +1,6 @@
 ;;; tex-style.el --- Customizable variables for AUCTeX style files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2005-2021  Free Software Foundation, Inc.
+;; Copyright (C) 2005-2023  Free Software Foundation, Inc.
 
 ;; Author: Reiner Steib <Reiner.Steib@gmx.de>
 ;; Keywords: tex, wp, convenience
@@ -283,6 +283,30 @@ is initialized to ?x."
   "Default prefix to labels in environments of exam class."
   :type 'string)
 
+;; style/fancyvrb.el
+
+(defcustom LaTeX-fancyvrb-chars nil
+  "List of characters toggling verbatim mode.
+When your document uses the fancyvrb package and you have a
+\\DefineShortVerb{\\|} in your file to write verbatim text as
+|text|, then set this variable to the list (?|).  Then AUCTeX
+fontifies |text| as verbatim.
+
+Preferably, you should do this buffer-locally using a file
+variable near the end of your document like so:
+
+  %% Local Variables:
+  %% LaTeX-fancyvrb-chars: (?|)
+  %% End:
+
+When you customize this variable to a non-nil value, then it
+becomes the default value meaning that verbatim fontification is
+always performed for the characters in the list, no matter if
+your document actually defines shortverb chars using
+\\DefineShortVerb."
+  :type '(repeat character))
+(put 'LaTeX-fancyvrb-chars 'safe-local-variable #'listp)
+
 ;; style/fontspec.el
 
 (defcustom LaTeX-fontspec-arg-font-search t
diff --git a/tex.el b/tex.el
index 52c61f6e..d3fdfced 100644
--- a/tex.el
+++ b/tex.el
@@ -4790,6 +4790,16 @@ Return nil if ELT is not a member of LIST."
 (make-obsolete 'TeX-assoc
                "use (assoc-string KEY LIST t) instead." "AUCTeX 13.0")
 
+(if (>= emacs-major-version 28)
+    (defalias 'TeX-always #'always)
+  (defun TeX-always (&rest _arguments)
+    "Ignore ARGUMENTS, do nothing and return t.
+This function accepts any number of arguments in ARGUMENTS.
+Also see `ignore'.
+
+This is a compatibility function for Emacs versions prior to v.28."
+    t))
+
 (defun TeX-match-buffer (n)
   "Return the substring corresponding to the N'th match.
 See `match-data' for details."
@@ -5496,7 +5506,10 @@ additional characters."
                         (setq count (- count TeX-brace-indent-level)))
                        ((eq char ?\\)
                         (when (< (point) limit)
-                          (forward-char)
+                          ;; ?\\ in verbatim constructs doesn't escape
+                          ;; the next char
+                          (unless (TeX-verbatim-p)
+                            (forward-char))
                           t))))))
       count)))
 
@@ -5519,7 +5532,7 @@ It should be accessed through the function 
`TeX-search-syntax-table'.")
   "Return a syntax table for searching purposes.
 ARGS may be a list of characters.  For each of them the
 respective predefined syntax is set.  Currently the parenthetical
-characters ?{, ?}, ?[, ?], ?\(, ?\), ?<, and ?> are supported.
+characters ?{, ?}, ?[, ?], ?(, ?), ?<, and ?> are supported.
 The syntax of each of these characters not specified will be
 reset to \" \"."
   (let ((char-syntax-alist '((?\{ . "(}") (?\} . "){")
@@ -6133,14 +6146,15 @@ With optional argument ARG, also reload the style 
hooks."
   (if arg
       (dolist (var TeX-normal-mode-reset-list)
         (set var nil)))
-  (let ((TeX-auto-save t))
-    (if (buffer-modified-p)
-        (save-buffer)
-      (TeX-auto-write)))
-  (normal-mode)
-  ;; See also addition to `find-file-hook' in `VirTeX-common-initialization'.
-  (when (eq TeX-master 'shared) (TeX-master-file nil nil t))
-  (TeX-update-style t))
+  (let ((gc-cons-percentage 0.5))
+    (let ((TeX-auto-save t))
+      (if (buffer-modified-p)
+          (save-buffer)
+        (TeX-auto-write)))
+    (normal-mode)
+    ;; See also addition to `find-file-hook' in `VirTeX-common-initialization'.
+    (when (eq TeX-master 'shared) (TeX-master-file nil nil t))
+    (TeX-update-style t)))
 
 (defgroup TeX-quote nil
   "Quoting in AUCTeX."
@@ -8276,16 +8290,17 @@ errors or warnings to show."
       (progn
         (if TeX-parse-all-errors
             (TeX-parse-all-errors))
-        (if (and TeX-error-overview-open-after-TeX-run
+        (if (and (with-current-buffer TeX-command-buffer
+                   TeX-error-overview-open-after-TeX-run)
                  (TeX-error-overview-make-entries
                   (TeX-master-directory) (TeX-active-buffer)))
             (TeX-error-overview)))
     (message (concat name ": formatted " (TeX-current-pages)))
     (let (dvi2pdf)
-        (if (with-current-buffer TeX-command-buffer
-           (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
-         (setq TeX-command-next dvi2pdf)
-       (setq TeX-command-next TeX-command-Show)))))
+      (if (with-current-buffer TeX-command-buffer
+            (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+          (setq TeX-command-next dvi2pdf)
+        (setq TeX-command-next TeX-command-Show)))))
 
 (defun TeX-current-pages ()
   "Return string indicating the number of pages formatted."
@@ -8391,7 +8406,8 @@ Open the error overview if
 errors or warnings to show."
   (if TeX-parse-all-errors
       (TeX-parse-all-errors))
-  (if (and TeX-error-overview-open-after-TeX-run
+  (if (and (with-current-buffer TeX-command-buffer
+             TeX-error-overview-open-after-TeX-run)
            (TeX-error-overview-make-entries
             (TeX-master-directory) (TeX-active-buffer)))
       (TeX-error-overview))



reply via email to

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