auctex-diffs
[Top][All Lists]
Advanced

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

main 24023ba2 235/257: Merge remote-tracking branch 'origin/master' into


From: Tassilo Horn
Subject: main 24023ba2 235/257: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Fri, 19 Apr 2024 15:37:05 -0400 (EDT)

branch: main
commit 24023ba246e37f31020cb15e6143dd4335b6ee4c
Merge: bc75884d 1792a414
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 Makefile.in               |   2 +-
 admin/release-process.org |  16 ++-
 doc/changes.texi          |   6 +
 font-latex.el             |  18 ++-
 latex.el                  | 318 ++++++++++++++++++++++++++++++++++++++++-----
 preview.el                |   5 +-
 style/fvextra.el          |  54 ++++++--
 style/graphicx.el         |  18 ++-
 style/minted.el           | 211 ++++++++++++++++--------------
 style/newfloat.el         |   8 +-
 style/pythontex.el        |  43 +++---
 style/refcount.el         |  90 +++++++++++++
 style/splitidx.el         |  24 ++--
 style/titleps.el          |  49 ++++---
 style/titletoc.el         |  35 +++--
 style/xparse.el           | 323 +---------------------------------------------
 tex-fold.el               |   3 +-
 tex-info.el               |  29 ++---
 tex.el                    |  48 ++++---
 texmathp.el               |   2 +-
 20 files changed, 714 insertions(+), 588 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 18c79222..f98f2949 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -197,7 +197,7 @@ STYLESRC = style/prosper.el \
           style/proc.el      style/microtype.el style/tcolorboxlib-theorems.el 
\
           style/amsaddr.el   style/parskip.el   style/catchfilebetweentags.el \
           style/physics.el   style/soul.el      style/algpseudocodex.el \
-          style/wasysym.el
+          style/wasysym.el   style/refcount.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/admin/release-process.org b/admin/release-process.org
index 624d323e..3348cf07 100644
--- a/admin/release-process.org
+++ b/admin/release-process.org
@@ -40,7 +40,7 @@ everything goes well, before actually doing the release.
 
   - The instructions may mention how to build the XEmacs and Windows packages,
     but you do not need to do that if you decided to stop providing those
-    packages
+    packages.
   - Make sure that the patch for =gendocs.sh= in the =www-docs= target applies
     correctly, otherwise you will need to update it. Remember to update it in
     the =gendocspath= branch of the AUCTeX remote repository too.
@@ -81,7 +81,7 @@ You can also browse the 
[[http://web.cvs.savannah.gnu.org/viewvc/auctex/][conten
 - [ ] Update AUCTeX version and date in files in =src/= directory. When you are
   done, run the script =./genpages.sh=
 - [ ] Update the =ChangeLog=
-- [ ] Register all changes. You can use for example =vc-mode= in Emacs: [0/2]
+- [ ] Register all changes. You can use for example =vc-mode= in Emacs: [0/3]
 
   - [ ] Register all new files with =i=
   - [ ] Select all files in the same state with =m= and do check in/out with 
=v=
@@ -172,7 +172,7 @@ AUCTeX is kept in the ~externals/auctex~ branch of the ELPA 
repository.
 3. Merge the commits which have taken place in the normal auctex development on
    the ~master~ branch using ~git merge origin/master~.
 4. In case of conflicts, edit, and commit.
-5. Check that everything compiles by running ~make -f GNUMakefile~.
+5. Check that everything compiles by running ~make -f GNUmakefile~.
 6. Push your changes to the elpa remote (~git push~).
 
 Just updating the ~externals/auctex~ branch by merging in the changes from the
@@ -181,7 +181,7 @@ Emacs' package manager.  To do an actual release which will 
be published, you
 have to do the following steps in addition.
 
 7. Edit the line ~;; Version: X.Y.Z~ in the file ~auctex.el~.  For ELPA
-   releases, Y and Y match the latest AUCTeX version and Z is incremented for
+   releases, X and Y match the latest AUCTeX version and Z is incremented for
    every ELPA release of that AUCTeX version.  Z starts with 0, so AUCTeX
    12.2.0 should be (almost) identical to the AUCTeX release 12.2.
 8. Commit that change with this Git commit message (but do not push yet!).  The
@@ -194,7 +194,7 @@ Release GNU AUCTeX X.Y.Z
 * GNU AUCTeX Version X.Y.Z released.
 #+END_EXAMPLE
 
-9. Run ~make -f GNUMakefile~ again.  In the output you should see that the
+9. Run ~make -f GNUmakefile~ again.  In the output you should see that the
    above version is inserted into several files, e.g., the info documentation.
    The version change is gotten from the current HEAD of the branch.  That's
    the reason the commit message has to be in exactly this format.
@@ -258,3 +258,9 @@ Other files to be updated accordingly:
   at least XX.X.=.
 - [ ] =RELEASE= :: Update the version of GNU Emacs in the
   "Requirements" section.
+
+For ELPA releases:
+
+- [ ] =auctex.el= :: Since this file is not regenerated, the required
+  Emacs version must be adjusted manually in the GNU ELPA Git
+  repository.
diff --git a/doc/changes.texi b/doc/changes.texi
index cbb341c6..3489318a 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -16,6 +16,12 @@
 
 @item
 Now @LaTeX{} abbrevs are available in doc@TeX{} mode buffers.
+
+@item
+Macros provided by the @file{xparse} package are part of @LaTeX{} kernel
+since October 2020.  @AUCTeX{} tracks this change and the content of
+@file{xparse.el} is moved into @file{latex.el} and @file{font-latex.el}
+respectively.
 @end itemize
 
 @heading News in 13.2
diff --git a/font-latex.el b/font-latex.el
index 1f5b2988..7deb9ec6 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -240,7 +240,7 @@ variable `font-latex-fontify-sectioning'." ',num)
   '(("warning"
      ("nopagebreak" "pagebreak" "newpage" "clearpage" "cleardoublepage"
       "enlargethispage" "nolinebreak" "linebreak" "newline" "-" "\\" "\\*"
-      "appendix" "displaybreak" "allowdisplaybreaks" "tabularnewline" "include"
+      "appendix" "displaybreak" "allowdisplaybreaks" "tabularnewline"
       "backmatter" "frontmatter" "mainmatter"
       "makeatletter" "makeatother" "newblock" "suppressfloats" "endinput")
      font-latex-warning-face 1 noarg)
@@ -365,7 +365,19 @@ variable `font-latex-fontify-sectioning'." ',num)
       ("labelformat" "{{") ("linespread" "{")
       ("AddToHook" "{[{") ("RemoveFromHook" "{[") ("AddToHookNext" "{{")
       ("ProvidesClass" "{[") ("ProvidesPackage" "{[") ("ProvidesFile" "{[")
-      ("NewMarkClass" "{"))
+      ("NewMarkClass" "{")
+      ("DeclareDocumentCommand" "|{\\{{")
+      ("NewDocumentCommand"     "|{\\{{")
+      ("ProvideDocumentCommand" "|{\\{{")
+      ("RenewDocumentCommand"   "|{\\{{")
+      ("DeclareExpandableDocumentCommand" "|{\\{{")
+      ("NewExpandableDocumentCommand"     "|{\\{{")
+      ("ProvideExpandableDocumentCommand" "|{\\{{")
+      ("RenewExpandableDocumentCommand"   "|{\\{{")
+      ("DeclareDocumentEnvironment" "{{{{")
+      ("NewDocumentEnvironment"     "{{{{")
+      ("ProvideDocumentEnvironment" "{{{{")
+      ("RenewDocumentEnvironment"   "{{{{"))
      font-lock-function-name-face 2 command)
     ("function-noarg"
      ("enspace" "enskip" "quad" "qquad" "nonumber"
@@ -379,7 +391,7 @@ variable `font-latex-fontify-sectioning'." ',num)
       "normalfont" "normalshape"
       "tableofcontents" "listoffigures" "listoftables"
       "maketitle" "makeindex" "makeglossary"
-      "sloppy" "fussy")
+      "sloppy" "fussy" "par")
      font-lock-keyword-face 2 noarg)
     ("sectioning-0"
      (("part" "*[{"))
diff --git a/latex.el b/latex.el
index f56b5189..c7ff151c 100644
--- a/latex.el
+++ b/latex.el
@@ -1721,6 +1721,12 @@ right number."
 (defvar LaTeX-auto-optional nil)
 (defvar LaTeX-auto-env-args nil)
 (defvar LaTeX-auto-env-args-with-opt nil)
+(defvar LaTeX-auto-xparse-macro nil
+  "Information about user defined macros in the current buffer.
+This variable contains information after parsing the buffer.")
+(defvar LaTeX-auto-xparse-environment nil
+  "Information about user defined enviroments in the current buffer.
+This variable contains information after parsing the buffer.")
 
 (TeX-auto-add-type "label" "LaTeX")
 (TeX-auto-add-type "bibitem" "LaTeX")
@@ -1734,12 +1740,12 @@ right number."
 
 (defvar LaTeX-auto-minimal-regexp-list
   '(("\\\\document\\(style\\|class\\)\
-\\(\\[\\(\\([^#\\%]\\|%[^\n\r]*[\n\r]\\)*\\)\\]\\)?\
+\\(?:\\[\\(\\(?:[^#\\%]\\|%[^\n\r]*[\n\r]\\)*\\)\\]\\)?\
 {\\([^#\\.\n\r]+?\\)}"
-     (3 5 1) LaTeX-auto-style)
-    ("\\\\use\\(package\\)\\(\\[\\([^]]*\\)\\]\\)?\
+     (2 3 1) LaTeX-auto-style)
+    ("\\\\use\\(package\\)\\(?:\\[\\([^]]*\\)\\]\\)?\
 {\\(\\([^#}\\.%]\\|%[^\n\r]*[\n\r]\\)+?\\)}"
-     (3 4 1) LaTeX-auto-style))
+     (2 3 1) LaTeX-auto-style))
   "Minimal list of regular expressions matching LaTeX macro definitions.")
 
 (defvar LaTeX-auto-label-regexp-list
@@ -1761,15 +1767,15 @@ This is necessary since index entries may contain 
commands and stuff.")
 
 (defvar LaTeX-auto-class-regexp-list
   `(;; \RequirePackage[<options>]{<package>}[<date>]
-    ("\\\\Require\\(Package\\)\\(\\[\\([^]]*\\)\\]\\)?\
+    ("\\\\Require\\(Package\\)\\(?:\\[\\([^]]*\\)\\]\\)?\
 {\\([^#\\.\n\r]+?\\)}"
-     (3 4 1) LaTeX-auto-style)
+     (2 3 1) LaTeX-auto-style)
     ;; \RequirePackageWithOptions{<package>}[<date>],
     ("\\\\Require\\(Package\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}"
      (2 3 1) LaTeX-auto-style)
     ;; \LoadClass[<options>]{<package>}[<date>]
-    ("\\\\Load\\(Class\\)\\(\\[\\([^]]*\\)\\]\\)?{\\([^#\\.\n\r]+?\\)}"
-     (3 4 1) LaTeX-auto-style)
+    ("\\\\Load\\(Class\\)\\(?:\\[\\([^]]*\\)\\]\\)?{\\([^#\\.\n\r]+?\\)}"
+     (2 3 1) LaTeX-auto-style)
     ;; \LoadClassWithOptions{<package>}[<date>]
     ("\\\\Load\\(Class\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}"
      (2 3 1) LaTeX-auto-style)
@@ -1827,12 +1833,33 @@ This is necessary since index entries may contain 
commands and stuff.")
         (2 3 1) LaTeX-auto-arguments)
        (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token 
"+\\)}?")
         1 TeX-auto-symbol)
+       (,(concat
+          "\\\\\\(New\\|Renew\\|Provide\\|Declare\\)"
+          "\\(?:Expandable\\)?"
+          "DocumentCommand"
+          "[ \t\n\r]*"
+          "{?"
+          "[ \t\n\r]*"
+          "\\\\\\(" token "+\\)"
+          "[ \t\n\r]*"
+          "}?"
+          "[ \t\n\r]*"
+          
"{\\([^}{]*\\(?:{[^}{]*\\(?:{[^}{]*\\(?:{[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}")
+        (0 2 3 1) LaTeX-auto-xparse-macro)
        ("\\\\\\(re\\)?newenvironment\\*?{\\([^}]+\\)}\\[\\([0-9]+\\)\\]\\["
         (2 3 1) LaTeX-auto-env-args-with-opt)
        ("\\\\\\(re\\)?newenvironment\\*?{\\([^}]+\\)}\\[\\([0-9]+\\)\\]"
         (2 3 1) LaTeX-auto-env-args)
        ("\\\\newenvironment\\*?{\\([^}]+\\)}"
         1 LaTeX-auto-environment)
+       (,(concat
+          "\\\\\\(New\\|Renew\\|Provide\\|Declare\\)"
+          "DocumentEnvironment"
+          "[ \t\n\r]*"
+          "{\\([^}]+\\)}"
+          "[ \t\n\r]*"
+          
"{\\([^}{]*\\(?:{[^}{]*\\(?:{[^}{]*\\(?:{[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}")
+        (0 2 3 1) LaTeX-auto-xparse-environment)
        (,(concat "\\\\newtheorem{\\(" token "+\\)}") 1 LaTeX-auto-environment)
        ("\\\\input{\"?\\([^#}%\"\\\n\r]+?\\)\\(?:\\.[^#}%/\"\\.\n\r]+\\)?\"?}"
         1 TeX-auto-file)
@@ -1876,7 +1903,9 @@ Split the string at commas and remove Biber file 
extensions."
         LaTeX-auto-optional nil
         LaTeX-auto-env-args nil
         LaTeX-auto-style nil
-        LaTeX-auto-end-symbol nil))
+        LaTeX-auto-end-symbol nil
+        LaTeX-auto-xparse-macro nil
+        LaTeX-auto-xparse-environment nil))
 
 (add-hook 'TeX-auto-prepare-hook #'LaTeX-auto-prepare)
 
@@ -1962,6 +1991,165 @@ See also `LaTeX-provided-class-options'.")
 The value is actually the tail of the list of options given to PACKAGE."
   (member option (cdr (assoc package LaTeX-provided-package-options))))
 
+(defun LaTeX-arg-xparse-embellishment (_optional embellish)
+  "Special insert function for embellishments.
+Compatibility argument OPTIONAL is ignored.  EMBELLISH is a
+string with parsed elements inserted in the buffer.  This
+function also sets the value of `TeX-exit-mark' where the point
+will be once the insertion is completed."
+  (let (p)
+    (just-one-space)
+    (setq p (point))
+    (insert embellish)
+    (set-marker TeX-exit-mark (1+ p))))
+
+(defun LaTeX-xparse-macro-parse (type)
+  "Process parsed macro and environment definitions.
+TYPE is one of the symbols mac or env."
+  (dolist (xcmd (if (eq type 'mac)
+                    LaTeX-auto-xparse-macro
+                  LaTeX-auto-xparse-environment))
+    (let ((name (string-trim (nth 1 xcmd) "[ \t\r\n%]+" "[ \t\r\n%]+"))
+          (spec (nth 2 xcmd))
+          (what (nth 3 xcmd))
+          (case-fold-search nil)
+          (syntax (TeX-search-syntax-table ?\{ ?\}))
+          args opt-star opt-token)
+      (with-temp-buffer
+        (set-syntax-table LaTeX-mode-syntax-table)
+        (insert (replace-regexp-in-string "[ \t\r\n%]" "" spec))
+        (goto-char (point-min))
+        (while (looking-at-p "[+!>=bmrRvodODsteE]")
+          (cond ((looking-at-p "[+!b]")
+                 ;; + or !: Long argument or space aware: Move over
+                 ;; them.  b is special; only available for
+                 ;; enviroments
+                 (forward-char 1))
+                ;; Argument processors and key-val modifier: Move
+                ;; over [>=] and a balanced {}
+                ((looking-at-p "[>=]")
+                 (forward-char 1)
+                 (with-syntax-table syntax (forward-sexp)))
+                ;; Mandatory arguments:
+                ;; m: Ask for input with "Text" as prompt
+                ((looking-at-p "m")
+                 (forward-char 1)
+                 (push "Text" args))
+                ;; r<token1><token2>
+                ((looking-at-p "r")
+                 (re-search-forward "r\\(.\\)\\(.\\)" (+ (point) 3) t)
+                 (push `(TeX-arg-string nil nil nil nil
+                                        ,(match-string-no-properties 1)
+                                        ,(match-string-no-properties 2))
+                       args))
+                ;; R<token1><token2>{default}
+                ((looking-at-p "R")
+                 (re-search-forward "R\\(.\\)\\(.\\)" (+ (point) 3) t)
+                 (with-syntax-table syntax (forward-sexp))
+                 (push `(TeX-arg-string nil nil nil nil
+                                        ,(match-string-no-properties 1)
+                                        ,(match-string-no-properties 2))
+                       args))
+                ;; v: Use `TeX-arg-verb-delim-or-brace'
+                ((looking-at-p "v")
+                 (forward-char 1)
+                 (push #'TeX-arg-verb-delim-or-brace args))
+                ;; Optional arguments:
+                ;; o standard LaTeX optional in square brackets
+                ((looking-at-p "o")
+                 (forward-char 1)
+                 (push (vector "Text") args))
+                ;; d<token1><token2>
+                ((looking-at-p "d")
+                 (re-search-forward "d\\(.\\)\\(.\\)" (+ (point) 3) t)
+                 (push (vector #'TeX-arg-string nil nil nil nil
+                               (match-string-no-properties 1)
+                               (match-string-no-properties 2))
+                       args))
+                ;; O{default}
+                ((looking-at-p "O")
+                 (forward-char 1)
+                 (with-syntax-table syntax (forward-sexp))
+                 (push (vector "Text") args))
+                ;; D<token1><token2>{default}
+                ((looking-at-p "D")
+                 (re-search-forward "D\\(.\\)\\(.\\)" (+ (point) 3) t)
+                 (with-syntax-table syntax (forward-sexp))
+                 (push (vector #'TeX-arg-string nil nil nil nil
+                               (match-string-no-properties 1)
+                               (match-string-no-properties 2))
+                       args))
+                ;; s: optional star
+                ((looking-at-p "s")
+                 (forward-char 1)
+                 (setq opt-star t))
+                ;; t: optional <token>
+                ((looking-at-p "t")
+                 (re-search-forward "t\\(.\\)" (+ (point) 2) t)
+                 (setq opt-token (match-string-no-properties 1)))
+                ;; e{tokes} a set of optional embellishments
+                ((looking-at-p "e")
+                 (forward-char)
+                 (if (looking-at-p TeX-grop)
+                     (re-search-forward "{\\([^}]+\\)}" nil t)
+                   (re-search-forward "\\(.\\)" (1+ (point)) t))
+                 (push `(LaTeX-arg-xparse-embellishment
+                         ,(match-string-no-properties 1))
+                       args))
+                ;; E{tokes}{defaults}
+                ((looking-at-p "E")
+                 (forward-char)
+                 (if (looking-at-p TeX-grop)
+                     (re-search-forward "{\\([^}]+\\)}" nil t)
+                   (re-search-forward "\\(.\\)" (1+ (point)) t))
+                 (push `(LaTeX-arg-xparse-embellishment
+                         ,(match-string-no-properties 1))
+                       args)
+                 (when (looking-at-p TeX-grop)
+                   (with-syntax-table syntax (forward-sexp))))
+                ;; Finished:
+                (t nil))))
+      (if (eq type 'env)
+          ;; Parsed enviroments: If we are Renew'ing or Delare'ing, we
+          ;; delete the enviroment first from `LaTeX-environment-list'
+          ;; before adding the new one.  We have to sort the value of
+          ;; `LaTeX-environment-list' by running the function of the
+          ;; same name:
+          (progn
+            (when (member what '("Renew" "Declare"))
+              (setq LaTeX-auto-environment
+                    (assq-delete-all (car (assoc name LaTeX-auto-environment))
+                                     LaTeX-auto-environment)))
+            (add-to-list 'LaTeX-auto-environment
+                         (if args
+                             `(,name LaTeX-env-args ,@(reverse args))
+                           (list name))))
+        ;; Parsed macros: If we are Renew'ing or Delare'ing, we delete
+        ;; the macros first from `TeX-symbol-list' before adding the
+        ;; new ones.  We have to sort the value of `TeX-symbol-list'
+        ;; by running the function of the same name:
+        (when (member what '("Renew" "Declare"))
+          (setq TeX-auto-symbol
+                (assq-delete-all (car (assoc name TeX-auto-symbol))
+                                 TeX-auto-symbol))
+          (when opt-star
+            (setq TeX-auto-symbol
+                  (assq-delete-all (car (assoc (concat name "*")
+                                               TeX-auto-symbol))
+                                   TeX-auto-symbol)))
+          (when opt-token
+            (setq TeX-auto-symbol
+                  (assq-delete-all (car (assoc (concat name opt-token)
+                                               TeX-auto-symbol))
+                                   TeX-auto-symbol))))
+        (add-to-list 'TeX-auto-symbol (cons name (reverse args)))
+        (when opt-star
+          (add-to-list 'TeX-auto-symbol (cons (concat name "*")
+                                              (reverse args))))
+        (when opt-token
+          (add-to-list 'TeX-auto-symbol (cons (concat name opt-token)
+                                              (reverse args))))))))
+
 (defun LaTeX-auto-cleanup ()
   "Cleanup after LaTeX parsing."
 
@@ -2057,6 +2245,9 @@ The value is actually the tail of the list of options 
given to PACKAGE."
                              (string-to-number (nth 1 entry)))))
         LaTeX-auto-arguments)
 
+  ;; Cleanup for marcos defined with former xparse commands:
+  (LaTeX-xparse-macro-parse 'mac)
+
   ;; Cleanup default optional arguments
   (mapc (lambda (entry)
           ;; If we're renewcommand-ing and there is already an entry
@@ -2103,6 +2294,9 @@ The value is actually the tail of the list of options 
given to PACKAGE."
                              (1- (string-to-number (nth 1 entry))))))
         LaTeX-auto-env-args-with-opt)
 
+  ;; Cleanup for enviroments defined with former xparse commands:
+  (LaTeX-xparse-macro-parse 'env)
+
   ;; Cleanup use of def to add environments
   ;; NOTE: This uses an O(N^2) algorithm, while an O(N log N)
   ;; algorithm is possible.
@@ -3308,7 +3502,8 @@ which see."
                         complete)
    (cond ((and (listp key-val-alist)
                (symbolp (car key-val-alist))
-               (fboundp (car key-val-alist)))
+               (fboundp (car key-val-alist))
+               (not (eq (car key-val-alist) 'lambda)))
           (funcall (car key-val-alist)))
          ((functionp key-val-alist)
           (funcall key-val-alist))
@@ -3396,7 +3591,8 @@ INHERIT-INPUT-METHOD are passed to `completing-read', 
which see."
                         complete)
    (cond ((and (listp collection)
                (symbolp (car collection))
-               (fboundp (car collection)))
+               (fboundp (car collection))
+               (not (eq (car collection) 'lambda)))
           (funcall (car collection)))
          ((functionp collection)
           (funcall collection))
@@ -3460,7 +3656,8 @@ INHERIT-INPUT-METHOD are passed to
                         complete)
    (cond ((and (listp table)
                (symbolp (car table))
-               (fboundp (car table)))
+               (fboundp (car table))
+               (not (eq (car table) 'lambda)))
           (funcall (car table)))
          ((functionp table)
           (funcall table))
@@ -3868,21 +4065,22 @@ of the macro argument as cons."
 The macro body (\"\\verb\") and its delimiters, including
 optional argument if any, aren't considered as component of a
 verbatim-like construct."
-  (when pos (goto-char pos))
-  (save-match-data
-    ;; TODO: Factor out syntax propertize facility from font-latex.el
-    ;; and re-implement as major mode feature.  Then we can drop the
-    ;; fallback code below.
-    (if (eq TeX-install-font-lock 'font-latex-setup)
-        (progn
-          (syntax-propertize (point))
-          (nth 3 (syntax-ppss)))
-      ;; Fallback for users who stay away from font-latex.
-      (or
-       (let ((region (LaTeX-verbatim-macro-boundaries t)))
-         (and region
-              (<= (car region) (point) (cdr region))))
-       (member (LaTeX-current-environment) (LaTeX-verbatim-environments))))))
+  (save-excursion
+    (when pos (goto-char pos))
+    (save-match-data
+      ;; TODO: Factor out syntax propertize facility from font-latex.el
+      ;; and re-implement as major mode feature.  Then we can drop the
+      ;; fallback code below.
+      (if (eq TeX-install-font-lock 'font-latex-setup)
+          (progn
+            (syntax-propertize (point))
+            (nth 3 (syntax-ppss)))
+        ;; Fallback for users who stay away from font-latex.
+        (or
+         (let ((region (LaTeX-verbatim-macro-boundaries t)))
+           (and region
+                (<= (car region) (point) (cdr region))))
+         (member (LaTeX-current-environment) 
(LaTeX-verbatim-environments)))))))
 
 
 ;;; Formatting
@@ -7733,7 +7931,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-flet ((y-or-n-p #'TeX-always))
+      (cl-letf (((symbol-function '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))
@@ -7853,8 +8051,9 @@ ARG is the entry for the current argument in buffer 
stored in
            (fun1 (lambda (elt)
                    (cond ((and (listp elt)
                                (symbolp (car elt))
-                               (fboundp (car elt)))
-                          ;; It is a function call:
+                               (fboundp (car elt))
+                               (not (eq (car elt) 'lambda)))
+                          ;; It is a named function and not anonymous:
                           (funcall (car elt)))
                          ;; It is a function object
                          ((functionp elt)
@@ -8703,6 +8902,65 @@ function would return non-nil and `(match-string 1)' 
would return
 
      '("linespread" "Factor")
 
+     ;; Macros for document-command parser, aka xparse added to LaTeX
+     ;; kernel with 2020-10-01 release:
+     '("DeclareDocumentCommand"
+       TeX-arg-define-macro "Argument specification" t)
+     '("NewDocumentCommand"
+       TeX-arg-define-macro "Argument specification" t)
+     '("RenewDocumentCommand"
+       TeX-arg-macro "Argument specification" t)
+     '("ProvideDocumentCommand"
+       TeX-arg-define-macro "Argument specification" t)
+
+     ;; Declaring environments
+     '("DeclareDocumentEnvironment" TeX-arg-define-environment
+       "Argument specification" t t)
+     '("NewDocumentEnvironment" TeX-arg-define-environment
+       "Argument specification" t t)
+     '("RenewDocumentEnvironment" TeX-arg-environment
+       "Argument specification" t t)
+     '("ProvideDocumentEnvironment" TeX-arg-define-environment
+       "Argument specification" t t)
+
+     ;; Fully-expandable document commands
+     '("DeclareExpandableDocumentCommand"
+       TeX-arg-define-macro "Argument specification" t)
+     '("NewExpandableDocumentCommand"
+       TeX-arg-define-macro "Argument specification" t)
+     '("RenewExpandableDocumentCommand"
+       TeX-arg-macro "Argument specification" t)
+     '("ProvideExpandableDocumentCommand"
+       TeX-arg-define-macro "Argument specification" t)
+
+     ;; Testing special values
+     '("IfBooleanTF" 3)
+     '("IfBooleanT" 2)
+     '("IfBooleanF" 2)
+     '("IfNoValueTF" 3)
+     '("IfNoValueT" 2)
+     '("IfNoValueF" 2)
+     '("IfValueTF" 3)
+     '("IfValueT" 2)
+     '("IfValueF" 2)
+     '("IfBlankTF" 3)
+     '("IfBlankT" 2)
+     '("IfBlankF" 2)
+     "BooleanTrue"
+     "BooleanFalse"
+     ;; Argument processors
+     "ProcessedArgument"
+     "ReverseBoolean"
+     '("SplitArgument" "Number" "Token")
+     '("SplitList" "Token")
+     "TrimSpaces"
+     '("ProcessList" "List" "Function")
+     ;; Access to the argument specification
+     '("GetDocumentCommandArgSpec" TeX-arg-macro)
+     '("GetDocumentEnvironmmentArgSpec" TeX-arg-environment)
+     '("ShowDocumentCommandArgSpec" TeX-arg-macro)
+     '("ShowDocumentEnvironmentArgSpec" TeX-arg-environment)
+
      ;; LaTeX hook macros:
      '("AddToHook"      TeX-arg-hook [ "Label" ] t)
      '("RemoveFromHook" TeX-arg-hook [ "Label" ])
diff --git a/preview.el b/preview.el
index bc774082..4eb8b2d6 100644
--- a/preview.el
+++ b/preview.el
@@ -1,6 +1,6 @@
 ;;; preview.el --- embed preview LaTeX images in source buffer  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2001-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2023  Free Software Foundation, Inc.
 
 ;; Author: David Kastrup
 ;; Keywords: tex, wp, convenience
@@ -1488,6 +1488,9 @@ a fixed number."
                  (const 1.0)
                  (number :value 1.0)
                  (function :value preview-scale-from-face)))
+;;;###autoload
+(put 'preview-scale-function 'safe-local-variable
+     (lambda (x) (and (numberp x) (<= 0.1 x 10))))
 
 (defcustom preview-default-document-pt 10
   "Assumed document point size for `preview-scale-from-face'.
diff --git a/style/fvextra.el b/style/fvextra.el
index c74baf13..9bcf1200 100644
--- a/style/fvextra.el
+++ b/style/fvextra.el
@@ -1,6 +1,6 @@
-;;; fvextra.el --- AUCTeX style for `fvextra.sty' (v1.4)  -*- lexical-binding: 
t; -*-
+;;; fvextra.el --- AUCTeX style for `fvextra.sty' (v1.6)  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2017--2022 Free Software Foundation, Inc.
+;; Copyright (C) 2017--2023 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `fvextra.sty' (v1.5) from 2022/11/30.
+;; This file adds support for `fvextra.sty' (v1.6) from 2023/11/19.
 ;; `fvextra.sty' is part of TeXLive.
 
 ;;; Code:
@@ -86,6 +86,7 @@
     ("breakbeforeinrun" ("true" "false"))
     ("breakbeforesymbolpre")
     ("breakbeforesymbolpost")
+    ("breakcollapsespaces" ("true" "false"))
     ("breakindent")
     ("breakindentnchars")
     ("breaklines" ("true" "false"))
@@ -104,7 +105,8 @@
     ("breaksymbolsepleft")
     ("breaksymbolsepleftnchars")
     ("breaksymbolsepright")
-    ("breaksymbolseprightnchars"))
+    ("breaksymbolseprightnchars")
+    ("spacebreak"))
   "Key=value options for fvextra macros and environments.")
 
 (TeX-add-style-hook
@@ -118,8 +120,13 @@
     ;; 4.1 Inline formatting with \fvinlineset
     '("fvinlineset" (TeX-arg-key-val (LaTeX-fancyvrb-key-val-options)))
 
-    ;; 4.2 Line and text formatting
+    ;; 4.2 Custom formatting for inline commands like \Verb with
+    ;; \FancyVerbFormatInline
     "FancyVerbFormatInline"
+
+    ;; 4.3 Custom formatting for environments like Verbatim with
+    ;; \FancyVerbFormatLine and \FancyVerbFormatText
+    "FancyVerbFormatLine"
     "FancyVerbFormatText"
 
     ;; 6 New commands and environments
@@ -129,6 +136,17 @@
     '("EscVerb*"
       [TeX-arg-key-val (LaTeX-fancyvrb-key-val-options)] "Text")
 
+    ;; 6.5 \VerbatimInsertBuffer
+    '("VerbatimInsertBuffer"
+      [TeX-arg-key-val (lambda ()
+                         (append (LaTeX-fancyvrb-key-val-options)
+                                 '(("afterbuffer")
+                                   ("bufferer")
+                                   ("bufferlengthname")
+                                   ("bufferlinename")
+                                   ("buffername")
+                                   ("globalbuffer" ("true" "false")))))])
+
     ;; 7.3.2 Breaks within macro arguments
     "FancyVerbBreakStart"
     "FancyVerbBreakStop"
@@ -141,12 +159,28 @@
    ;; 6.2 VerbEnv environment
    (LaTeX-add-environments
     '("VerbEnv" LaTeX-env-args
-      [TeX-arg-key-val (LaTeX-fancyvrb-key-val-options)]))
+      [TeX-arg-key-val (LaTeX-fancyvrb-key-val-options)])
+
+    ;; 6.3 VerbatimWrite
+    '("VerbatimWrite" LaTeX-env-args
+      [TeX-arg-key-val (("writefilehandle") ("writer"))])
+
+    ;; 6.4 VerbatimBuffer
+    '("VerbatimBuffer" LaTeX-env-args
+      [TeX-arg-key-val (("afterbuffer")
+                        ("bufferer")
+                        ("bufferlengthname")
+                        ("bufferlinename")
+                        ("buffername")
+                        ("globalbuffer" ("true" "false")))]) )
 
    ;; Filling
-   (add-to-list 'LaTeX-verbatim-environments-local "VerbEnv")
-   (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
-                '("VerbEnv" current-indentation) t)
+   (let ((envs '("VerbEnv" "VerbatimWrite" "VerbatimBuffer")))
+     (make-local-variable 'LaTeX-indent-environment-list)
+     (dolist (env envs)
+       (add-to-list 'LaTeX-verbatim-environments-local env)
+       (add-to-list 'LaTeX-indent-environment-list
+                    `(,env current-indentation) t)))
 
    ;; Add \Verb*? and \EscVerb*? to
    ;; `LaTeX-verbatim-macros-with-braces-local':
@@ -162,6 +196,8 @@
                               'function)
      (font-latex-add-keywords '(("EscVerb"     "*["))
                               'textual)
+     (font-latex-add-keywords '(("VerbatimInsertBuffer" "["))
+                              'reference)
      (font-latex-set-syntactic-keywords)))
  TeX-dialect)
 
diff --git a/style/graphicx.el b/style/graphicx.el
index bc0dd8fc..d88b720d 100644
--- a/style/graphicx.el
+++ b/style/graphicx.el
@@ -1,6 +1,6 @@
 ;;; graphicx.el --- AUCTeX style file for graphicx.sty  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2000, 2004, 2005, 2014--2022 by Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2004, 2005, 2014--2023 by Free Software Foundation, Inc.
 
 ;; Author: Ryuichi Arafune <arafune@debian.org>
 ;; Created: 1999/3/20
@@ -90,13 +90,13 @@ key=vals."
   "List of extensions for image files supported by \"dvips\".")
 
 (defvar LaTeX-includegraphics-pdftex-extensions
-  '("png" "pdf" "jpe?g" "jbig2" "jb2" "mps"
-    "PNG" "PDF" "JPE?G" "JBIG2" "JB2")
+  '("png" "pdf" "jpg" "jpeg" "jbig2" "jb2" "mps"
+    "PNG" "PDF" "JPG" "JPEG" "JBIG2" "JB2")
   "List of extensions for image files supported by \"pdftex\" and \"luatex\".")
 
 (defvar LaTeX-includegraphics-xetex-extensions
-  '("pdf" "eps" "mps" "ps" "png" "jpe?g" "jp2" "jpf"
-    "PDF" "EPS" "MPS" "PS" "PNG" "JPE?G" "JP2" "JPF"
+  '("pdf" "eps" "mps" "ps" "png" "jpg" "jpeg" "jp2" "jpf"
+    "PDF" "EPS" "MPS" "PS" "PNG" "JPG" "JPEG" "JP2" "JPF"
     "bmp" "pict" "psd" "mac" "tga" "gif" "tif" "tiff"
     "BMP" "PICT" "PSD" "MAC" "TGA" "GIF" "TIF" "TIFF")
   "List of extensions for image files supported by \"xetex\".")
@@ -275,7 +275,13 @@ subdirectories and inserts the relative file name.  See
 
     '("graphicspath" t)
 
-    '("DeclareGraphicsExtensions" t)
+    '("DeclareGraphicsExtensions"
+      (TeX-arg-completing-read-multiple
+       (lambda ()
+         (delete ".jpe?g" (mapcar (lambda (ext)
+                                    (concat "." ext))
+                                  (LaTeX-includegraphics-extensions-list))))
+       "Extension(s)" nil nil nil nil nil nil nil nil "."))
 
     '("DeclareGraphicsRule" 4))
 
diff --git a/style/minted.el b/style/minted.el
index 99310311..10bc0b35 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -1,4 +1,4 @@
-;;; minted.el --- AUCTeX style for `minted.sty' (v2.5)  -*- lexical-binding: 
t; -*-
+;;; minted.el --- AUCTeX style for `minted.sty' (v2.8)  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2014--2023 Free Software Foundation, Inc.
 
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `minted.sty' (v2.5) from 2017/07/19.
+;; This file adds support for `minted.sty' (v2.8) from 2023/09/12.
 
 ;;; Code:
 
@@ -47,13 +47,14 @@
                   "newfloat" (&rest newfloat-declarefloatingenvironments))
 
 (defvar font-latex-syntactic-keywords-extra)
+(defvar LaTeX-fontenc-package-options)
 
 (defvar LaTeX-minted-key-val-options
   '(("autogobble" ("true" "false"))
     ("baselinestretch" ("auto"))
     ("beameroverlays" ("true" "false"))
     ("breakafter")
-    ("breakaftergroup" ("true" "false"))
+    ("breakafterinrun" ("true" "false"))
     ("breakaftersymbolpre")
     ("breakaftersymbolpost")
     ("breakanywhere" ("true" "false"))
@@ -61,7 +62,7 @@
     ("breakanywheresymbolpost")
     ("breakautoindent" ("true" "false"))
     ("breakbefore")
-    ("breakbeforegroup" ("true" "false"))
+    ("breakbeforeinrun" ("true" "false"))
     ("breakbeforesymbolpre")
     ("breakbeforesymbolpost")
     ("breakbytoken" ("true" "false"))
@@ -175,10 +176,16 @@ prepends them to variable `LaTeX-minted-key-val-options'."
          (push (list key colors) result))))
    LaTeX-minted-key-val-options))
 
-(defvar LaTeX-minted-pygmentize-program (executable-find "pygmentize"))
+(defvar LaTeX-minted-pygmentize-program (executable-find "pygmentize")
+  "Absolute file name to pygmentize program.")
 
 (defvar LaTeX-minted-language-list nil
-  "List containing languages provided by pymentize program.")
+  "List containing languages provided by pymentize program.
+Initialized once at the first prompt for a Pygments language.
+May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")
+
+;; Add the variable to `TeX-normal-mode-reset-list':
+(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-minted-language-list)
 
 (defun LaTeX-minted-language-list (&rest _ignored)
   "Return a list of languages provided by pymentize program.
@@ -197,7 +204,12 @@ Update the variable `LaTeX-minted-language-list' if still 
nil."
           LaTeX-minted-language-list))))
 
 (defvar LaTeX-minted-style-list nil
-  "List containing styles provided by pymentize program.")
+  "List containing styles provided by pymentize program.
+Initialized once at the first prompt for a Pygments style.
+May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")
+
+;; Add the variable to `TeX-normal-mode-reset-list':
+(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-minted-style-list)
 
 (defun LaTeX-minted-style-list (&rest _ignored)
   "Return a list of styles provided by pymentize program.
@@ -215,91 +227,83 @@ Update the variable `LaTeX-minted-style-list' if still 
nil."
             (setq LaTeX-minted-style-list styles))
           LaTeX-minted-style-list))))
 
-(defvar LaTeX-minted-auto-newminted nil)
-(defvar LaTeX-minted-newminted-regexp
-  '("\\\\newminted\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}"
-    (1 2) LaTeX-minted-auto-newminted))
+(TeX-auto-add-type "minted-newmint" "LaTeX")
 
-(defvar LaTeX-minted-auto-newmint nil)
 (defvar LaTeX-minted-newmint-regexp
-  '("\\\\newmint\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}"
-    (1 2) LaTeX-minted-auto-newmint))
-
-(defvar LaTeX-minted-auto-newmintinline nil)
-(defvar LaTeX-minted-newmintinline-regexp
-  '("\\\\newmintinline\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}"
-    (1 2) LaTeX-minted-auto-newmintinline))
-
-(defvar LaTeX-minted-auto-newmintedfile nil)
-(defvar LaTeX-minted-newmintedfile-regexp
-  '("\\\\newmintedfile\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}{[^}]*}"
-    (1 2) LaTeX-minted-auto-newmintedfile))
+  
'("\\\\newmint\\(edfile\\|inline\\|ed\\)?\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}"
+    (2 3 1) LaTeX-auto-minted-newmint)
+  "Match the arguments of \\newmint* macros from minted package.")
 
 (defun LaTeX-minted-auto-prepare ()
-  (setq LaTeX-minted-auto-newminted     nil
-        LaTeX-minted-auto-newmint       nil
-        LaTeX-minted-auto-newmintinline nil
-        LaTeX-minted-auto-newmintedfile nil
-        LaTeX-minted-language-list      nil
-        LaTeX-minted-style-list         nil))
+  "Reset `LaTeX-auto-minted-newmint' before parsing."
+  (setq LaTeX-auto-minted-newmint nil))
 
 (defun LaTeX-minted-auto-cleanup ()
-  ;; \newminted{lang}{opts} => new langcode and langcode* envs.
-  ;; \newminted[envname]{lang}{opts} => new envname/envname* envs.
-  (dolist (name-lang LaTeX-minted-auto-newminted)
-    (let* ((env (if (> (length (car name-lang)) 0)
-                    (car name-lang)
-                  (concat (cadr name-lang) "code")))
-           (env* (concat env "*")))
-      (add-to-list 'LaTeX-auto-environment (list env))
-      (add-to-list 'LaTeX-auto-environment
-                   (list env* #'LaTeX-env-args
-                         '(TeX-arg-key-val (LaTeX-minted-key-val-options))))
-      (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation) 
t)
-      (add-to-list 'LaTeX-indent-environment-list `(,env* current-indentation) 
t)
-      (add-to-list 'LaTeX-verbatim-environments-local env)
-      (add-to-list 'LaTeX-verbatim-environments-local env*)))
-  ;; \newmint{foo}{opts} => \foo[key=vals]|code|
-  ;; \newmint[macname]{foo}{opts} => \macname[key=vals]|code|
-  (dolist (name-lang LaTeX-minted-auto-newmint)
-    (let ((lang (if (> (length (car name-lang)) 0)
-                    (car name-lang)
-                  (cadr name-lang))))
-      (add-to-list 'TeX-auto-symbol
-                   `(,lang [TeX-arg-key-val (LaTeX-minted-key-val-options)]
-                           TeX-arg-verb))
-      (add-to-list 'LaTeX-verbatim-macros-with-delims-local lang)
-      (when (and (fboundp 'font-latex-add-keywords)
-                 (eq TeX-install-font-lock 'font-latex-setup))
-        (font-latex-add-keywords `((,lang "[")) 'textual))))
-  ;; \newmintinline{foo}{opts} => \fooinline[key=vals]|code| or
-  ;;                              \fooinline[key=vals]{code}
-  ;; \newmintinline[macname]{foo}{opts} => \macname[key=vals]|code| or
-  ;;                                       \macname[key=vals]{code}
-  (dolist (name-lang LaTeX-minted-auto-newmintinline)
-    (let ((lang (if (> (length (car name-lang)) 0)
-                    (car name-lang)
-                  (concat (cadr name-lang) "inline"))))
-      (add-to-list 'TeX-auto-symbol
-                   `(,lang [TeX-arg-key-val (LaTeX-minted-key-val-options)]
-                           TeX-arg-verb-delim-or-brace))
-      (add-to-list 'LaTeX-verbatim-macros-with-delims-local lang)
-      (add-to-list 'LaTeX-verbatim-macros-with-braces-local lang)
-      (when (and (fboundp 'font-latex-add-keywords)
-                 (eq TeX-install-font-lock 'font-latex-setup))
-        (font-latex-add-keywords `((,lang "[")) 'textual))))
-  ;; \newmintedfile{foo}{opts} => \foofile[key=vals]{file-name}
-  ;; \newmintedfile[macname]{foo}{opts} => \macname[key=vals]{file-name}
-  (dolist (name-lang LaTeX-minted-auto-newmintedfile)
-    (let ((lang (if (> (length (car name-lang)) 0)
-                    (car name-lang)
-                  (concat (cadr name-lang) "file"))))
-      (add-to-list 'TeX-auto-symbol
-                   `(,lang [TeX-arg-key-val (LaTeX-minted-key-val-options)]
-                           TeX-arg-file))))
-  (when (and (fboundp 'font-latex-set-syntactic-keywords)
+  "Process the parsed results from minted package."
+  (dolist (mint (LaTeX-minted-newmint-list))
+    (cond ((string= (nth 2 mint) "ed")
+           ;; \newminted{lang}{opts} => new langcode and langcode* envs.
+           ;; \newminted[envname]{lang}{opts} => new envname/envname* envs.
+           (let* ((env (if (string-empty-p (car mint))
+                           (concat (cadr mint) "code")
+                         (car mint)))
+                  (env* (concat env "*")))
+             (LaTeX-add-environments (list env))
+             (LaTeX-add-environments (list env* #'LaTeX-env-args
+                                           '(TeX-arg-key-val
+                                             (LaTeX-minted-key-val-options))))
+             (add-to-list 'LaTeX-indent-environment-list
+                          `(,env current-indentation) t)
+             (add-to-list 'LaTeX-indent-environment-list
+                          `(,env* current-indentation) t)
+             (add-to-list 'LaTeX-verbatim-environments-local env)
+             (add-to-list 'LaTeX-verbatim-environments-local env*)))
+          ;; \newmintinline{foo}{opts} => \fooinline[key=vals]|code| or
+          ;;                              \fooinline[key=vals]{code}
+          ;; \newmintinline[macname]{foo}{opts} => \macname[key=vals]|code| or
+          ;;                                       \macname[key=vals]{code}
+          ((string= (nth 2 mint) "inline")
+           (let ((lang (if (string-empty-p (car mint))
+                           (concat (cadr mint) "inline")
+                         (car mint))))
+             (TeX-add-symbols `(,lang
+                                [TeX-arg-key-val 
(LaTeX-minted-key-val-options)]
+                                TeX-arg-verb-delim-or-brace))
+             (add-to-list 'LaTeX-verbatim-macros-with-delims-local lang)
+             (add-to-list 'LaTeX-verbatim-macros-with-braces-local lang)
+             (when (and (fboundp 'font-latex-add-keywords)
+                        (eq TeX-install-font-lock 'font-latex-setup))
+               (font-latex-add-keywords `((,lang "[")) 'textual))))
+          ;; \newmintedfile{foo}{opts} => \foofile[key=vals]{file-name}
+          ;; \newmintedfile[macname]{foo}{opts} => 
\macname[key=vals]{file-name}
+          ((string= (nth 2 mint) "edfile")
+           (let ((lang (if (string-empty-p (car mint))
+                           (concat (cadr mint) "file")
+                         (car mint))))
+             (TeX-add-symbols `(,lang
+                                [TeX-arg-key-val 
(LaTeX-minted-key-val-options)]
+                                TeX-arg-file))))
+          ;; \newmint{foo}{opts} => \foo[key=vals]|code| or
+          ;;                        \foo[key=vals]{code}
+          ;; \newmint[macname]{foo}{opts} => \macname[key=vals]|code| or
+          ;;                                 \macname[key=vals]{code}
+          (t
+           (let ((lang (if (string-empty-p (car mint))
+                           (cadr mint)
+                         (car mint))))
+             (TeX-add-symbols `(,lang
+                                [TeX-arg-key-val 
(LaTeX-minted-key-val-options)]
+                                TeX-arg-verb-delim-or-brace))
+             (add-to-list 'LaTeX-verbatim-macros-with-delims-local lang)
+             (add-to-list 'LaTeX-verbatim-macros-with-braces-local lang)
+             (when (and (fboundp 'font-latex-add-keywords)
+                        (eq TeX-install-font-lock 'font-latex-setup))
+               (font-latex-add-keywords `((,lang "[")) 'textual))))))
+  ;; Refresh font-locking so that the verbatim envs take effect only
+  ;; when there are defined shortcuts:
+  (when (and (LaTeX-minted-newmint-list)
+             (fboundp 'font-latex-set-syntactic-keywords)
              (eq TeX-install-font-lock 'font-latex-setup))
-    ;; Refresh font-locking so that the verbatim envs take effect.
     (font-latex-set-syntactic-keywords)))
 
 (add-hook 'TeX-auto-prepare-hook #'LaTeX-minted-auto-prepare t)
@@ -307,7 +311,7 @@ Update the variable `LaTeX-minted-style-list' if still nil."
 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
 
 (defun LaTeX-minted-add-syntactic-keywords-extra (type macro)
-  "Add MACRO from minted.sty to `font-latex-syntactic-keywords-extra'.
+  "Add TYPE of MACRO to `font-latex-syntactic-keywords-extra'.
 TYPE is one of the symbols `brace' or `delim' indicating how
 verbatim text is enclosed after the macro.  MACRO is a string or
 a list of strings."
@@ -355,7 +359,7 @@ a list of strings."
     '("mint"
       [TeX-arg-key-val (LaTeX-minted-key-val-options)]
       (TeX-arg-completing-read (LaTeX-minted-language-list) "Language")
-      TeX-arg-verb)
+      TeX-arg-verb-delim-or-brace)
     '("mintinline"
       [TeX-arg-key-val (LaTeX-minted-key-val-options)]
       (TeX-arg-completing-read (LaTeX-minted-language-list) "Language")
@@ -416,10 +420,7 @@ a list of strings."
         '(("listing" ?l "lst:" "~\\ref{%s}" caption nil nil)))))
 
    ;; Add to the auto parser
-   (TeX-auto-add-regexp LaTeX-minted-newminted-regexp)
    (TeX-auto-add-regexp LaTeX-minted-newmint-regexp)
-   (TeX-auto-add-regexp LaTeX-minted-newmintinline-regexp)
-   (TeX-auto-add-regexp LaTeX-minted-newmintedfile-regexp)
 
    ;; Filling
    (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
@@ -453,12 +454,28 @@ a list of strings."
      (font-latex-set-syntactic-keywords)))
  TeX-dialect)
 
-(defvar LaTeX-minted-package-options '("chapter"     "cache"
-                                       "cachedir"    "finalizecache"
-                                       "frozencache" "draft"
-                                       "final"       "kpsewhich"
-                                       "langlinenos" "newfloat"
-                                       "outputdir"   "section")
-  "Package options for the minted package.")
+(defun LaTeX-minted-package-options-list ()
+  "Return an alist of package options for minted package."
+  (append
+   `(("fontencoding"
+      ,(when (member "fontenc" (TeX-style-list))
+         LaTeX-fontenc-package-options)))
+   '(("chapter")
+     ("cache"            ("true" "false"))
+     ("cachedir")
+     ("finalizecache"    ("true" "false"))
+     ("frozencache"      ("true" "false"))
+     ("draft"            ("true" "false"))
+     ("final"            ("true" "false"))
+     ("inputlanglinenos" ("true" "false"))
+     ("kpsewhich"        ("true" "false"))
+     ("langlinenos"      ("true" "false"))
+     ("newfloat"         ("true" "false"))
+     ("outputdir")
+     ("section"))))
+
+(defun LaTeX-minted-package-options ()
+  "Prompt for package options for the minted package."
+  (TeX-read-key-val t (LaTeX-minted-package-options-list)))
 
 ;;; minted.el ends here
diff --git a/style/newfloat.el b/style/newfloat.el
index f90b6148..61285d1d 100644
--- a/style/newfloat.el
+++ b/style/newfloat.el
@@ -1,4 +1,4 @@
-;;; newfloat.el --- AUCTeX style for `newfloat.sty' (v1.1-109)  -*- 
lexical-binding: t; -*-
+;;; newfloat.el --- AUCTeX style for `newfloat.sty' (v1.2)  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2015--2023 Free Software Foundation, Inc.
 
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `newfloat.sty' (v1.1-109) from 2015/09/17.
+;; This file adds support for `newfloat.sty' (v1.2) from 2023/10/01.
 ;; `newfloat.sty' is part of TeXLive.
 
 ;; This style has some facilities to process the newly defined
@@ -77,6 +77,10 @@
    (if (< (LaTeX-largest-level) 2)
        '(("within" ("chapter" "section" "none")))
      '(("within" ("section" "none"))))
+   (when (member "hyperref" (TeX-style-list))
+     '(("autorefname")))
+   (when (member "memoir" TeX-active-styles)
+     '(("legendname")))
    LaTeX-newfloat-key-val-options))
 
 ;; Setup parsing for \DeclareFloatingEnvironment:
diff --git a/style/pythontex.el b/style/pythontex.el
index 8c1399f0..6ea9ef32 100644
--- a/style/pythontex.el
+++ b/style/pythontex.el
@@ -318,19 +318,19 @@ a list of strings."
 
     ;;\saveprintpythontex{<name>}
     '("saveprintpythontex"
-      (TeX-arg-eval (lambda ()
-                      (let ((name (TeX-read-string
-                                   (TeX-argument-prompt nil nil "Name"))))
-                        (LaTeX-add-pythontex-savecontents name)
-                        (format "%s" name)))))
+      (lambda (optional)
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-pythontex-savecontents name)
+          (TeX-argument-insert name optional))))
 
     ;;\savestdoutpythontex{<name>}
     '("savestdoutpythontex"
-      (TeX-arg-eval (lambda ()
-                      (let ((name (TeX-read-string
-                                   (TeX-argument-prompt nil nil "Name"))))
-                        (LaTeX-add-pythontex-savecontents name)
-                        (format "%s" name)))))
+      (lambda (optional)
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-pythontex-savecontents name)
+          (TeX-argument-insert name optional))))
 
     ;; \useprintpythontex[<verbatim options>][<fancyvrb options>]{<name>}
     ;; I assume <verbatim options> is meant to be <mode>
@@ -353,11 +353,11 @@ a list of strings."
 
     ;;\savestderrpythontex{<name>}
     '("savestderrpythontex"
-      (TeX-arg-eval (lambda ()
-                      (let ((name (TeX-read-string
-                                   (TeX-argument-prompt nil nil "Name"))))
-                        (LaTeX-add-pythontex-savecontents name)
-                        (format "%s" name)))))
+      (lambda (optional)
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Name"))))
+          (LaTeX-add-pythontex-savecontents name)
+          (TeX-argument-insert name optional))))
 
     ;; \usestderrpythontex[<mode>][<fancyvrb options>]{<name>}
     '("usestderrpythontex"
@@ -427,13 +427,12 @@ a list of strings."
    ;; Cater for \setpythontexlistingenv:
    (TeX-add-symbols
     '("setpythontexlistingenv"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((name (TeX-read-string
-                      (TeX-argument-prompt nil nil "Listing environment 
name"))))
-           (LaTeX-add-newfloat-DeclareFloatingEnvironments `(,name "verbatim"))
-           (LaTeX-newfloat-auto-cleanup)
-           (format "%s" name))))))
+      (lambda (optional)
+        (let ((name (TeX-read-string
+                     (TeX-argument-prompt optional nil "Listing environment 
name"))))
+          (LaTeX-add-newfloat-DeclareFloatingEnvironments `(,name "verbatim"))
+          (LaTeX-newfloat-auto-cleanup)
+          (TeX-argument-insert name optional)))))
 
    (LaTeX-add-environments
     ;; 4.2.5 Custom code
diff --git a/style/refcount.el b/style/refcount.el
new file mode 100644
index 00000000..97258046
--- /dev/null
+++ b/style/refcount.el
@@ -0,0 +1,90 @@
+;;; refcount.el --- AUCTeX style for refcount package v3.6  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2023 Free Software Foundation, Inc.
+
+;; Author: Uwe Brauer <oub@mat.ucm.es>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2023-12-02
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for the refcount package v3.6.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
+(TeX-add-style-hook
+ "refcount"
+ (lambda ()
+   (TeX-add-symbols
+    ;; 1.1 Setting counters
+    '("setcounterref" TeX-arg-counter TeX-arg-ref)
+    '("addtocounterref" TeX-arg-counter TeX-arg-ref)
+    '("setcounterpageref" TeX-arg-counter TeX-arg-ref)
+    '("addcounterpageref" TeX-arg-counter TeX-arg-ref)
+    ;; 1.2 Expandable commands
+    '("getrefnumber"  TeX-arg-ref)
+    '("getpagerefnumber"  TeX-arg-ref)
+    '("setrefcountdefault" "Default")
+    '("getrefbykeydefault"
+      TeX-arg-ref
+      (TeX-arg-completing-read ("page" "title" "name" "anchor" "url"))
+      "Default")
+    ;; 1.3 Undefined references
+    '("refused" TeX-arg-ref)
+    '("IfRefUndefinedExpandable" TeX-arg-ref 2)
+    '("IfRefUndefinedBabel" TeX-arg-ref 2))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("setcounterref"     "{{")
+                                ("addtocounterref"   "{{")
+                                ("setcounterpageref" "{{")
+                                ("addcounterpageref" "{{"))
+                              'variable)
+     (font-latex-add-keywords '(("getrefnumber"       "{")
+                                ("getpagerefnumber"   "{")
+                                ("getrefbykeydefault" "{{{")
+                                ("refused"            "{"))
+                              'reference)
+     (font-latex-add-keywords '(("setrefcountdefault"       "{")
+                                ("IfRefUndefinedExpandable" "{{{")
+                                ("IfRefUndefinedBabel"      "{{{"))
+                              'function))
+
+   ;; Activate RefTeX reference style
+   (and LaTeX-reftex-ref-style-auto-activate
+        (fboundp 'reftex-ref-style-activate)
+        (reftex-ref-style-activate "Refcount")))
+ TeX-dialect)
+
+(defvar LaTeX-refcount-package-options nil
+  "Package options for the refcount package.")
+
+;;; refcount.el ends here
diff --git a/style/splitidx.el b/style/splitidx.el
index 37d36be6..2fa4af2c 100644
--- a/style/splitidx.el
+++ b/style/splitidx.el
@@ -1,6 +1,6 @@
 ;;; splitidx.el --- AUCTeX style for `splitidx.sty' (v1.2a)  -*- 
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
@@ -150,12 +150,11 @@
     ;; 3.1 Setup
     '("newindex"
       [ "Index name" ]
-      (TeX-arg-eval
-       (lambda ()
-         (let ((shortcut (TeX-read-string
-                          (TeX-argument-prompt nil nil "Short cut"))))
-           (LaTeX-add-splitidx-newindices shortcut)
-           (format "%s" shortcut)))))
+      (lambda (optional)
+        (let ((shortcut (TeX-read-string
+                         (TeX-argument-prompt optional nil "Short cut"))))
+          (LaTeX-add-splitidx-newindices shortcut)
+          (TeX-argument-insert shortcut optional))))
 
     ;; 3.2 Marking up index entries
     '("sindex"
@@ -175,12 +174,11 @@
     ;; 3.6 Preventing premature expansion of index entries
     '("newprotectedindex"
       [ "Index name" ]
-      (TeX-arg-eval
-       (lambda ()
-         (let ((shortcut (TeX-read-string
-                          (TeX-argument-prompt nil nil "Short cut"))))
-           (LaTeX-add-splitidx-newindices shortcut)
-           (format "%s" shortcut)))))
+      (lambda (optional)
+        (let ((shortcut (TeX-read-string
+                         (TeX-argument-prompt optional nil "Short cut"))))
+          (LaTeX-add-splitidx-newindices shortcut)
+          (TeX-argument-insert shortcut optional))))
 
     ;; 3.7 Including the generated indices in your document
     '("printindex"
diff --git a/style/titleps.el b/style/titleps.el
index 67891035..ed03dcb1 100644
--- a/style/titleps.el
+++ b/style/titleps.el
@@ -1,6 +1,6 @@
 ;;; titleps.el --- AUCTeX style for `titleps.sty' (v1.1.1)  -*- 
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
@@ -78,30 +78,29 @@ Removal is based on the return value of function
    (TeX-add-symbols
     ;; 2. Defining Page Styles
     '("newpagestyle"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((ps (TeX-read-string
-                    (TeX-argument-prompt nil nil "Page style"))))
-           (LaTeX-add-pagestyles ps)
-           (format "%s" ps))))
+      (lambda (optional)
+        (let ((ps (TeX-read-string
+                   (TeX-argument-prompt optional nil "Page style"))))
+          (LaTeX-add-pagestyles ps)
+          (TeX-argument-insert ps optional)))
       (TeX-arg-conditional (y-or-n-p "With optional global style? ")
-                           ( [ t ] nil)
-                           ( t )))
+          ( [ t ] nil)
+        ( t )))
 
     '("renewpagestyle" TeX-arg-pagestyle
       (TeX-arg-conditional (y-or-n-p "With optional global style? ")
-                           ( [ t ] nil)
-                           ( t )))
+          ( [ t ] nil)
+        ( t )))
 
     '("sethead"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 3 ] nil nil nil)
-                           ( 3 )))
+          ( [ 3 ] nil nil nil)
+        ( 3 )))
 
     '("setfoot"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 3 ] nil nil nil)
-                           ( 3 )))
+          ( [ 3 ] nil nil nil)
+        ( 3 )))
 
     '("sethead*" 3)
     '("setfoot*" 3)
@@ -130,8 +129,8 @@ Removal is based on the return value of function
     ;; 4. Headline/footline width
     '("widenhead"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 2 ] nil nil)
-                           ( 2 )))
+          ( [ 2 ] nil nil)
+        ( 2 )))
 
     '("widenhead*" 2)
 
@@ -172,26 +171,26 @@ Removal is based on the return value of function
     ;; 6. Running heads with floats
     '("setfloathead"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 3 ] nil nil nil nil [ nil ] )
-                           ( 4 [ nil ] )))
+          ( [ 3 ] nil nil nil nil [ nil ] )
+        ( 4 [ nil ] )))
 
     '("setfloatfoot"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 3 ] nil nil nil nil [ nil ] )
-                           ( 4 [ nil ] )))
+          ( [ 3 ] nil nil nil nil [ nil ] )
+        ( 4 [ nil ] )))
 
     '("setfloathead*" 4 [ nil ] )
     '("setfloatfoot*" 4 [ nil ] )
 
     '("nextfloathead"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 3 ] nil nil nil nil [ nil ] )
-                           ( 4 [ nil ] )))
+          ( [ 3 ] nil nil nil nil [ nil ] )
+        ( 4 [ nil ] )))
 
     '("nextfloatfoot"
       (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
-                           ( [ 3 ] nil nil nil nil [ nil ] )
-                           ( 4 [ nil ] )))
+          ( [ 3 ] nil nil nil nil [ nil ] )
+        ( 4 [ nil ] )))
 
     '("nextfloathead*" 4 [ nil ] )
     '("nextfloatfoot*" 4 [ nil ] )
diff --git a/style/titletoc.el b/style/titletoc.el
index 5031f1e5..4b32a57d 100644
--- a/style/titletoc.el
+++ b/style/titletoc.el
@@ -1,6 +1,6 @@
 ;;; titletoc.el --- AUCTeX style for `titletoc.sty' (v1.6)  -*- 
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
@@ -111,8 +111,8 @@ Removal is based on the return value of function
                                "Sectioning command")
       [TeX-arg-length "Left margin"]
       (TeX-arg-conditional (y-or-n-p "With optional below code argument? ")
-                           (4 [nil])
-                           (4)))
+          (4 [nil])
+        (4)))
 
     ;; \titlecontents*{<section>}[<left>]{<above-code>}
     ;;                {<numbered-entry-format>}{<numberless-entry-format>}
@@ -122,8 +122,8 @@ Removal is based on the return value of function
                                "Sectioning command")
       [TeX-arg-length "Left margin"]
       (TeX-arg-conditional (y-or-n-p "With optional separator argument? ")
-                           (4 [nil])
-                           (4)))
+          (4 [nil])
+        (4)))
 
     ;; \contentsmargin[<correction>]{<right>}
     '("contentsmargin" [ "Correction" ] "Right margin")
@@ -144,19 +144,18 @@ Removal is based on the return value of function
     ;; the environments must be introduced to titletoc.sty with
     ;; \contentuse{ENV} and then can be used as argument to \titlecontents.
     '("contentsuse"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((name (if (and (member "newfloat" (TeX-active-styles))
-                              (LaTeX-newfloat-DeclareFloatingEnvironment-list))
-                         (completing-read
-                          (TeX-argument-prompt nil nil "Name of contents")
-                          (mapcar #'car
-                                  
(LaTeX-newfloat-DeclareFloatingEnvironment-list)))
-                       (TeX-read-string
-                        (TeX-argument-prompt nil nil "Name of contents")))))
-           (make-local-variable 'LaTeX-titletoc-section-command-list)
-           (add-to-list 'LaTeX-titletoc-section-command-list name)
-           (format "%s" name))))
+      (lambda (optional)
+        (let ((name (if (and (member "newfloat" (TeX-active-styles))
+                             (LaTeX-newfloat-DeclareFloatingEnvironment-list))
+                        (completing-read
+                         (TeX-argument-prompt optional nil "Name of contents")
+                         (mapcar #'car
+                                 
(LaTeX-newfloat-DeclareFloatingEnvironment-list)))
+                      (TeX-read-string
+                       (TeX-argument-prompt optional nil "Name of 
contents")))))
+          (make-local-variable 'LaTeX-titletoc-section-command-list)
+          (add-to-list 'LaTeX-titletoc-section-command-list name)
+          (TeX-argument-insert name optional)))
       "File extension")
 
     ;; 6.3. Partial TOC's
diff --git a/style/xparse.el b/style/xparse.el
index e71e456d..ed136702 100644
--- a/style/xparse.el
+++ b/style/xparse.el
@@ -1,6 +1,6 @@
 ;;; xparse.el --- AUCTeX style for `xparse.sty' version 2022-07-05  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013, 2020--2023 Free Software Foundation, Inc.
+;; Copyright (C) 2013--2023 Free Software Foundation, Inc.
 
 ;; Maintainer: auctex-devel@gnu.org
 ;; Author: Mosè Giordano <mose@gnu.org>
@@ -25,332 +25,17 @@
 
 ;;; Commentary:
 
-;; This file adds basic support for `xparse.sty' version 2022-07-05.
-;; It parses argument specification of macros and environments.
+;; The content of this file is now (December 2023) part of latex.el
+;; and font-latex.el.  This style provides only completion for xparse
+;; package options.
 
 ;; The "yet not more supported" specifiers `l', `u', `g' and `G' are
 ;; ignored completely and may lead to wrong parsing results.
 
 ;;; Code:
 
-(require 'tex)
 (require 'latex)
 
-;; Silence the compiler:
-(declare-function font-latex-add-keywords
-                  "font-latex"
-                  (keywords class))
-
-(TeX-auto-add-type "xparse-macro" "LaTeX")
-
-(defvar LaTeX-xparse-macro-regexp
-  `(,(concat
-      (regexp-quote TeX-esc)
-      "\\(New\\|Renew\\|Provide\\|Declare\\)"
-      "\\(?:Expandable\\)?"
-      "DocumentCommand"
-      "[ \t\n\r]*"
-      "{?"
-      "[ \t\n\r]*"
-      (regexp-quote TeX-esc)
-      "\\([A-Za-z]+\\)"
-      "[ \t\n\r]*"
-      "}?"
-      "[ \t\n\r]*"
-      
"{\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}")
-    (0 2 3 1) LaTeX-auto-xparse-macro)
-  "Matches macros by xparse package.")
-
-(TeX-auto-add-type "xparse-environment" "LaTeX")
-
-(defvar LaTeX-xparse-environment-regexp
-  `(,(concat
-      (regexp-quote TeX-esc)
-      "\\(New\\|Renew\\|Provide\\|Declare\\)"
-      "DocumentEnvironment"
-      "[ \t\n\r]*"
-      "{"
-      "[ \t\n\r]*"
-      "\\([A-Za-z]+\\)"
-      "[ \t\n\r]*"
-      "}"
-      "[ \t\n\r]*"
-      
"{\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}")
-    (0 2 3 1) LaTeX-auto-xparse-environment)
-  "Matches environments by xparse package.")
-
-(defun LaTeX-arg-xparse-query (optional op-brace cl-brace &optional prompt)
-  "Special query function for parsed elements from xparse package.
-If OPTIONAL is non-nil, indicate it in minibuffer.  OP-BRACE sets
-the opening brace, CL-BRACE sets the closing one.  PROMPT
-replaces the standard one."
-  (let ((TeX-arg-opening-brace op-brace)
-        (TeX-arg-closing-brace cl-brace))
-    (TeX-argument-insert
-     (TeX-read-string (TeX-argument-prompt optional prompt "Text"))
-     optional)))
-
-(defun LaTeX-arg-xparse-embellishment-query (_optional embellish)
-  "Special insert function for embellishments from xparse package.
-Compatibility argument OPTIONAL is ignored.  EMBELLISH is a
-string with parsed elements inserted in the buffer.  This
-function also sets the value of `TeX-exit-mark' where the point
-will be once the insertion is completed."
-  (let (p)
-    (just-one-space)
-    (setq p (point))
-    (insert embellish)
-    (set-marker TeX-exit-mark (1+ p))))
-
-(defun LaTeX-xparse-macro-parse (type)
-  "Process parsed macro and environment definitions.
-TYPE is one of the symbols mac or env."
-  (dolist (xcmd (if (eq type 'mac)
-                    (LaTeX-xparse-macro-list)
-                  (LaTeX-xparse-environment-list)))
-    (let ((name (nth 1 xcmd))
-          (spec (nth 2 xcmd))
-          (what (nth 3 xcmd))
-          (case-fold-search nil)
-          (syntax (TeX-search-syntax-table ?\{ ?\}))
-          args opt-star opt-token)
-      (with-temp-buffer
-        (set-syntax-table LaTeX-mode-syntax-table)
-        ;; This one is probably not really needed?
-        (goto-char (point-min))
-        (insert (replace-regexp-in-string "[ \t\r\n%]" "" spec))
-        (goto-char (point-min))
-        (while (looking-at-p "[+!>=bmrRvodODsteE]")
-          (cond ((looking-at-p "[+!b]")
-                 ;; + or !: Long argument or space aware: Move over
-                 ;; them.  b is special; only available for
-                 ;; enviroments
-                 (forward-char 1))
-                ;; Argument processors and key-val modifier: Move
-                ;; over [>=] and a balanced {}
-                ((looking-at-p "[>=]")
-                 (forward-char 1)
-                 (with-syntax-table syntax (forward-sexp)))
-                ;; Mandatory arguments:
-                ;; m: Ask for input with "Text" as prompt
-                ((looking-at-p "m")
-                 (forward-char 1)
-                 (push "Text" args))
-                ;; r<token1><token2>
-                ((looking-at-p "r")
-                 (re-search-forward "r\\(.\\)\\(.\\)" (+ (point) 3) t)
-                 (push `(LaTeX-arg-xparse-query
-                         ,(match-string-no-properties 1)
-                         ,(match-string-no-properties 2))
-                       args))
-                ;; R<token1><token2>{default}
-                ((looking-at-p "R")
-                 (re-search-forward "R\\(.\\)\\(.\\)" (+ (point) 3) t)
-                 (with-syntax-table syntax (forward-sexp))
-                 (push `(LaTeX-arg-xparse-query
-                         ,(match-string-no-properties 1)
-                         ,(match-string-no-properties 2))
-                       args))
-                ;; v: Use `TeX-arg-verb-delim-or-brace'
-                ((looking-at-p "v")
-                 (forward-char 1)
-                 (push #'TeX-arg-verb-delim-or-brace args))
-                ;; Optional arguments:
-                ;; o standard LaTeX optional in square brackets
-                ((looking-at-p "o")
-                 (forward-char 1)
-                 (push (vector "Text") args))
-                ;; d<token1><token2>
-                ((looking-at-p "d")
-                 (re-search-forward "d\\(.\\)\\(.\\)" (+ (point) 3) t)
-                 (push (vector #'LaTeX-arg-xparse-query
-                               (match-string-no-properties 1)
-                               (match-string-no-properties 2))
-                       args))
-                ;; O{default}
-                ((looking-at-p "O")
-                 (forward-char 1)
-                 (with-syntax-table syntax (forward-sexp))
-                 (push (vector "Text") args))
-                ;; D<token1><token2>{default}
-                ((looking-at-p "D")
-                 (re-search-forward "D\\(.\\)\\(.\\)" (+ (point) 3) t)
-                 (with-syntax-table syntax (forward-sexp))
-                 (push (vector #'LaTeX-arg-xparse-query
-                               (match-string-no-properties 1)
-                               (match-string-no-properties 2))
-                       args))
-                ;; s: optional star
-                ((looking-at-p "s")
-                 (forward-char 1)
-                 (setq opt-star t))
-                ;; t: optional <token>
-                ((looking-at-p "t")
-                 (re-search-forward "t\\(.\\)" (+ (point) 2) t)
-                 (setq opt-token (match-string-no-properties 1)))
-                ;; e{tokes} a set of optional embellishments
-                ((looking-at-p "e")
-                 (forward-char)
-                 (if (looking-at-p TeX-grop)
-                     (re-search-forward "{\\([^}]+\\)}" nil t)
-                   (re-search-forward "\\(.\\)" (1+ (point)) t))
-                 (push `(LaTeX-arg-xparse-embellishment-query
-                         ,(match-string-no-properties 1))
-                       args))
-                ;; E{tokes}{defaults}
-                ((looking-at-p "E")
-                 (forward-char)
-                 (if (looking-at-p TeX-grop)
-                     (re-search-forward "{\\([^}]+\\)}" nil t)
-                   (re-search-forward "\\(.\\)" (1+ (point)) t))
-                 (push `(LaTeX-arg-xparse-embellishment-query
-                         ,(match-string-no-properties 1))
-                       args)
-                 (when (looking-at-p TeX-grop)
-                   (with-syntax-table syntax (forward-sexp))))
-                ;; Finished:
-                (t nil))))
-      (if (eq type 'env)
-          ;; Parsed enviroments: If we are Renew'ing or Delare'ing, we
-          ;; delete the enviroment first from `LaTeX-environment-list'
-          ;; before adding the new one.  We have to sort the value of
-          ;; `LaTeX-environment-list' by running the function of the
-          ;; same name:
-          (progn
-            (when (member what '("Renew" "Declare"))
-              (LaTeX-environment-list)
-              (setq LaTeX-environment-list
-                    (assq-delete-all (car (assoc name LaTeX-environment-list))
-                                     LaTeX-environment-list)))
-            (LaTeX-add-environments `(,name
-                                      LaTeX-env-args
-                                      ,@(reverse args))))
-        ;; Parsed macros: If we are Renew'ing or Delare'ing, we delete
-        ;; the macros first from `TeX-symbol-list' before adding the
-        ;; new ones.  We have to sort the value of `TeX-symbol-list'
-        ;; by running the function of the same name:
-        (when (member what '("Renew" "Declare"))
-          (TeX-symbol-list)
-          (setq TeX-symbol-list
-                (assq-delete-all (car (assoc name TeX-symbol-list))
-                                 TeX-symbol-list))
-          (when opt-star
-            (setq TeX-symbol-list
-                  (assq-delete-all (car (assoc (concat name "*") 
TeX-symbol-list))
-                                   TeX-symbol-list)))
-          (when opt-token
-            (setq TeX-symbol-list
-                  (assq-delete-all (car (assoc (concat name opt-token) 
TeX-symbol-list))
-                                   TeX-symbol-list))))
-        (TeX-add-symbols (cons name
-                               (reverse args)))
-        (when opt-star
-          (TeX-add-symbols (cons (concat name "*")
-                                 (reverse args))))
-        (when opt-token
-          (TeX-add-symbols (cons (concat name opt-token)
-                                 (reverse args))))))))
-
-(defun LaTeX-xparse-auto-prepare ()
-  "Clear various `LaTeX-auto-xparse-*' variables before parsing."
-  (setq LaTeX-auto-xparse-macro nil
-        LaTeX-auto-xparse-environment nil))
-
-(defun LaTeX-xparse-auto-cleanup ()
-  "Process parsed elements for xparse package."
-  (LaTeX-xparse-macro-parse 'mac)
-  (LaTeX-xparse-macro-parse 'env))
-
-(add-hook 'TeX-auto-prepare-hook #'LaTeX-xparse-auto-prepare t)
-(add-hook 'TeX-auto-cleanup-hook #'LaTeX-xparse-auto-cleanup t)
-(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
-
-(TeX-add-style-hook
- "xparse"
- (lambda ()
-   (TeX-auto-add-regexp LaTeX-xparse-macro-regexp)
-   (TeX-auto-add-regexp LaTeX-xparse-environment-regexp)
-   (TeX-run-style-hooks
-    "expl3")
-   (TeX-add-symbols
-    ;; Declaring commands
-    '("DeclareDocumentCommand"
-      TeX-arg-define-macro "Argument specification" t)
-    '("NewDocumentCommand"
-      TeX-arg-define-macro "Argument specification" t)
-    '("RenewDocumentCommand"
-      TeX-arg-macro "Argument specification" t)
-    '("ProvideDocumentCommand"
-      TeX-arg-define-macro "Argument specification" t)
-
-    ;; Declaring commands and environments
-    '("DeclareDocumentEnvironment" TeX-arg-define-environment
-      "Argument specification" t t)
-    '("NewDocumentEnvironment" TeX-arg-define-environment
-      "Argument specification" t t)
-    '("RenewDocumentEnvironment" TeX-arg-environment
-      "Argument specification" t t)
-    '("ProvideDocumentEnvironment" TeX-arg-define-environment
-      "Argument specification" t t)
-
-    ;; Fully-expandable document commands
-    '("DeclareExpandableDocumentCommand"
-      TeX-arg-define-macro "Argument specification" t)
-    '("NewExpandableDocumentCommand"
-      TeX-arg-define-macro "Argument specification" t)
-    '("RenewExpandableDocumentCommand"
-      TeX-arg-macro "Argument specification" t)
-    '("ProvideExpandableDocumentCommand"
-      TeX-arg-define-macro "Argument specification" t)
-
-    ;; Testing special values
-    '("IfBooleanTF" 3)
-    '("IfBooleanT" 2)
-    '("IfBooleanF" 2)
-    '("IfNoValueTF" 3)
-    '("IfNoValueT" 2)
-    '("IfNoValueF" 2)
-    '("IfValueTF" 3)
-    '("IfValueT" 2)
-    '("IfValueF" 2)
-    '("IfBlankTF" 3)
-    '("IfBlankT" 2)
-    '("IfBlankF" 2)
-    "BooleanTrue"
-    "BooleanFalse"
-    ;; Argument processors
-    "ProcessedArgument"
-    "ReverseBoolean"
-    '("SplitArgument" "Number" "Token")
-    '("SplitList" "Token")
-    "TrimSpaces"
-    '("ProcessList" "List" "Function")
-    ;; Access to the argument specification
-    '("GetDocumentCommandArgSpec" TeX-arg-macro)
-    '("GetDocumentEnvironmmentArgSpec" TeX-arg-environment)
-    '("ShowDocumentCommandArgSpec" TeX-arg-macro)
-    '("ShowDocumentEnvironmentArgSpec" TeX-arg-environment))
-
-   ;; Fontification
-   (when (and (featurep 'font-latex)
-              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("DeclareDocumentCommand" "|{\\{{")
-                                ("NewDocumentCommand"     "|{\\{{")
-                                ("ProvideDocumentCommand" "|{\\{{")
-                                ("RenewDocumentCommand"   "|{\\{{")
-                                ;;
-                                ("DeclareExpandableDocumentCommand" "|{\\{{")
-                                ("NewExpandableDocumentCommand"     "|{\\{{")
-                                ("ProvideExpandableDocumentCommand" "|{\\{{")
-                                ("RenewExpandableDocumentCommand"   "|{\\{{")
-                                ;;
-                                ("DeclareDocumentEnvironment" "{{{{")
-                                ("NewDocumentEnvironment"     "{{{{")
-                                ("ProvideDocumentEnvironment" "{{{{")
-                                ("RenewDocumentEnvironment"   "{{{{"))
-                              'function)))
- TeX-dialect)
-
 (defvar LaTeX-xparse-package-options-list
   '(("log-declarations" ("true" "false")))
   "Package options for the xparse package.")
diff --git a/tex-fold.el b/tex-fold.el
index e3857460..c6e9f1ca 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -749,7 +749,8 @@ Replace them with the respective macro argument."
         (setq spec elt
               index nil)
         ;; Find and expand every placeholder.
-        (while (and (string-match "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)" elt 
index)
+        (while (and (string-match "\\([[{<(]\\)\\([1-9]\\)\\([]}>)]\\)"
+                                  elt index)
                     ;; Does the closing delim match the opening one?
                     (string-equal
                      (match-string 3 elt)
diff --git a/tex-info.el b/tex-info.el
index f1e97746..9dc19bed 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -479,26 +479,17 @@ is assumed by default."
            (if (nth 1 reftex-label-menu-flags) ; section number flag
                (concat section-number " "))
            text))
-    (prog1
-        (list 'toc "toc" text file marker level section-number
-              literal (marker-position marker))
-      (set-marker marker nil))))
+    (list 'toc "toc" text file marker level section-number
+          literal (marker-position marker))))
 
 (defun Texinfo-reftex-hook ()
   "Hook function to plug Texinfo into RefTeX."
   ;; force recompilation of variables
-  (when (string= TeX-base-mode-name "Texinfo")
-    ;; dirty temporary hook to remove when reftex has a Texinfo builtin
-    ;; TODO --- taken on <2014-01-06 mon> --- remove the dirty trick once 
reftex
-    ;; has been corrected for long enough a time
-    (unless (assq 'Texinfo reftex-label-alist-builtin)
-      (setq reftex-label-alist-builtin (append reftex-label-alist-builtin
-                                               '((Texinfo "Texinfo default 
environments" nil)))))
-    (dolist (v `((reftex-section-pre-regexp . "@")
-                 ; section post-regexp must contain exactly one group
-                 (reftex-section-post-regexp . "\\([ \t]+\\)")
-                 (reftex-section-info-function . Texinfo-reftex-section-info)
-                 (reftex-default-label-alist-entries . (Texinfo))
+  (dolist (v `((reftex-section-pre-regexp . "@")
+               ;; section post-regexp must contain exactly one group
+               (reftex-section-post-regexp . "\\([ \t]+\\)")
+               (reftex-section-info-function . Texinfo-reftex-section-info)
+               (reftex-default-label-alist-entries . (Texinfo))
                (reftex-section-levels
                 . ,(mapcar
                     (lambda (x)
@@ -507,8 +498,8 @@ is assumed by default."
                           (cons (car x) (- (cadr x)))
                         (cons (car x) (cadr x))))
                     texinfo-section-list))))
-      (set (make-local-variable (car v) ) (cdr v)))
-    (reftex-ensure-compiled-variables)))
+    (set (make-local-variable (car v) ) (cdr v)))
+  (reftex-ensure-compiled-variables))
 
 ;;; Keymap:
 
@@ -866,7 +857,7 @@ value of `Texinfo-mode-hook'."
    '("xref" (Texinfo-arg-nodename "Node name")))
 
   ;; RefTeX plugging
-  (add-hook 'reftex-mode-hook #'Texinfo-reftex-hook)
+  (add-hook 'reftex-mode-hook #'Texinfo-reftex-hook nil t)
   (if (and (boundp 'reftex-mode) reftex-mode)
       (Texinfo-reftex-hook))
 
diff --git a/tex.el b/tex.el
index 6ab21816..f9f17ba1 100644
--- a/tex.el
+++ b/tex.el
@@ -5491,22 +5491,38 @@ additional characters."
                                           '(?\{ ?\} ?\\))
                                     (TeX-in-comment))))
                  (forward-char)
-                 ;; If inside a verbatim construct, just return t and
-                 ;; proceed, otherwise start counting:
-                 (if (TeX-verbatim-p)
-                     t
-                   (cond ((memq char (append
-                                      TeX-indent-open-delimiters
-                                      '(?\{)))
-                          (setq count (+ count TeX-brace-indent-level)))
-                         ((memq char (append
-                                      TeX-indent-close-delimiters
-                                      '(?\})))
-                          (setq count (- count TeX-brace-indent-level)))
-                         ((eq char ?\\)
-                          (when (< (point) limit)
-                            (forward-char)
-                            t)))))))
+                 ;; We have to cater for verb-macros with braces and
+                 ;; what the function `TeX-verbatim-p' returns dep. on
+                 ;; the position of point:
+                 ;;       \Verb{\ or { or } are not special}.
+                 ;;     nil  <-^^-> t                  t <-^^-> nil
+                 (cond ((memq char (append
+                                    TeX-indent-open-delimiters
+                                    '(?\{)))
+                        ;; Point is one char after `{', if char before
+                        ;; isn't inside a verb macro, then the brace
+                        ;; is a real delimiter and we increase
+                        ;; `count', otherwise not:
+                        (if (TeX-verbatim-p (1- (point)))
+                            t
+                          (setq count (+ count TeX-brace-indent-level))))
+                       ((memq char (append
+                                    TeX-indent-close-delimiters
+                                    '(?\})))
+                        ;; Point if one char after `}', if not inside
+                        ;; a verb macro, this is a real delimiter and
+                        ;; we decrease `count', otherwise not:
+                        (if (TeX-verbatim-p)
+                            t
+                          (setq count (- count TeX-brace-indent-level))))
+                       ((eq char ?\\)
+                        ;; Point is one char-after after `\', so check
+                        ;; if the char before point is inside a verb
+                        ;; macro:
+                        (when (< (point) limit)
+                          (unless (TeX-verbatim-p (1- (point)))
+                            (forward-char))
+                          t))))))
       count)))
 
 ;;; Navigation
diff --git a/texmathp.el b/texmathp.el
index 1030ed85..5631916e 100644
--- a/texmathp.el
+++ b/texmathp.el
@@ -327,7 +327,7 @@ See the variable `texmathp-tex-commands' about which 
commands are checked."
     ;; is used stand-alone without latex.el provided by AUCTeX
     ;; (bug#61410):
     (if (and (fboundp 'LaTeX-verbatim-p)
-             (save-excursion (LaTeX-verbatim-p (cdr match))))
+             (LaTeX-verbatim-p (cdr match)))
         (progn
           (setq texmathp-why `(nil . ,(cdr match)))
           (when (called-interactively-p 'any)



reply via email to

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