auctex-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex 75702683d0 37/37: Merge remote-tracking branch '


From: Tassilo Horn
Subject: [elpa] externals/auctex 75702683d0 37/37: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Wed, 11 Oct 2023 03:41:57 -0400 (EDT)

branch: externals/auctex
commit 75702683d078d34e669f283294d781320f966314
Merge: 311d292163 846cce4378
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
    
    Conflicts:
            .gitignore
---
 .gitignore                     |   2 +-
 auctex.el.in                   |   2 +
 auctex.info                    | 283 +++++++++++++++++++++--------------------
 context-nl.el                  |   3 +
 context.el                     |  56 ++++++--
 doc/auctex.texi                |  45 ++++---
 doc/changes.texi               |   4 +-
 doc/faq.texi                   |   2 +-
 doc/install.texi               |   2 +-
 doc/quickstart.texi            |   2 +-
 font-latex.el                  |  21 ++-
 latex.el                       | 153 ++++++++++++++++------
 plain-tex.el                   |  16 ++-
 preview-latex.info             |  80 ++++++------
 preview.el                     |  15 ++-
 style/biblatex.el              |  10 +-
 style/fancyvrb.el              |  23 ++++
 tests/context/context-test.el  |   6 -
 tests/latex/font-latex-test.el |   6 -
 tests/latex/latex-test.el      |  12 +-
 tests/latex/tabular-out.tex    |   8 +-
 tests/latex/texmathp-test.el   |   2 -
 tex-fold.el                    |  73 ++++++-----
 tex-info.el                    |  61 ++++++---
 tex-jp.el                      |  13 +-
 tex-site.el                    |   6 +-
 tex-site.el.in                 |   2 +
 tex-style.el                   |  26 +++-
 tex.el                         |  79 +++++++-----
 29 files changed, 638 insertions(+), 375 deletions(-)

diff --git a/.gitignore b/.gitignore
index 77429f1c6f..ac530538ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,7 +52,7 @@ auctex-autoloads.el
 tests/*/auto/*
 *.dynvars
 auctex-dynvars
-
+.DS_Store
 # ELPA-generated files
 /auctex-autoloads.el
 /auctex-pkg.el
diff --git a/auctex.el.in b/auctex.el.in
index 390c0e3c32..fab355f0b1 100644
--- a/auctex.el.in
+++ b/auctex.el.in
@@ -42,4 +42,6 @@
   @lisptexsite@)
 (TeX-load-hack)
 
+(provide 'auctex)
+
 ;;; auctex.el ends here
diff --git a/auctex.info b/auctex.info
index 47a1532534..75aa54e717 100644
--- a/auctex.info
+++ b/auctex.info
@@ -1,7 +1,7 @@
 This is auctex.info, produced by makeinfo version 7.0.3 from
 auctex.texi.
 
-This manual is for AUCTeX (version 13.2.1 from 2023-07-20), a
+This manual is for AUCTeX (version 13.2.1.2023-10-11 from 2023-10-11), a
 sophisticated TeX environment for Emacs.
 
    Copyright © 1992-1995, 2001, 2002, 2004-2023 Free Software
@@ -453,7 +453,7 @@ it out with one of these options:
      If you are planning to install the package as a single
      non-priviledged user, you will typically set PREFIX to your home
      directory.  Consult *note Advice for non-privileged users:: for
-     addtional instructions.
+     additional instructions.
 
 ‘--with-emacs=/PATH/TO/EMACS’
      If you are using a pretest which isn’t in your ‘PATH’, or
@@ -1212,8 +1212,8 @@ about this and asks you to enter a value.
 1.3.1.4 Inserting macros
 ........................
 
-‘C-c C-m’, or simply ‘C-c RET’ will give you a prompt that asks you for
-a LaTeX macro.  You can use <TAB> for completion, or the <up>/<down>
+‘C-c C-m’, or simply ‘C-c <RET>’ will give you a prompt that asks you
+for a LaTeX macro.  You can use <TAB> for completion, or the <up>/<down>
 arrow keys (or ‘M-p’ and ‘M-n’) to browse the command history.  In many
 cases, AUCTeX knows which arguments a macro needs and will ask you for
 that.  It even can differentiate between mandatory and optional
@@ -3440,6 +3440,8 @@ consideration which are specified in the variables
      If the first element is a function symbol, the function will be
      called with all mandatory arguments of the macro and the result of
      the function call will be used as a replacement for the macro.
+     Such functions typically return a string, but may also return the
+     symbol ‘abort’ to indicate that the macro should not be folded.
 
      The placeholder is made by copying the text from the buffer
      together with its properties, i.e. its face as well.  If
@@ -4960,7 +4962,7 @@ File: auctex.info,  Node: Internationalization,  Next: 
Automatic,  Prev: Parsing
 ====================
 
 TeX and Emacs are usable for European (Latin, Cyrillic, Greek) based
-languages.  Some LaTeX and EmacsLisp packages are available for easy
+languages.  Some LaTeX and Emacs Lisp packages are available for easy
 typesetting and editing documents in European languages.
 
    All Emacs versions supported by current AUCTeX can handle CJK
@@ -6215,8 +6217,8 @@ A.1 Copying this Manual
 
 The copyright notice for this manual is:
 
-   This manual is for AUCTeX (version 13.2.1 from 2023-07-20), a
-sophisticated TeX environment for Emacs.
+   This manual is for AUCTeX (version 13.2.1.2023-10-11 from
+2023-10-11), a sophisticated TeX environment for Emacs.
 
    Copyright © 1992-1995, 2001, 2002, 2004-2023 Free Software
 Foundation, Inc.
@@ -6727,6 +6729,8 @@ News since last release
 
    • AUCTeX now requires GNU Emacs 26.1 or higher.
 
+   • Now LaTeX abbrevs are available in docTeX mode buffers.
+
 News in 13.2
 ------------
 
@@ -8357,7 +8361,7 @@ A.4 Frequently Asked Questions
         • If you installed AUCTeX from ELPA, use ‘emacs -q -no-site-file
           --eval "(progn (setq package-load-list '((auctex t)))
           (package-initialize))"’.  The ‘--eval’ option activates only
-          AUCTeX among all installed EPLA packages.
+          AUCTeX among all installed ELPA packages.
         • If you installed AUCTeX via traditional ‘configure’–‘make’
           scheme, use ‘emacs -q -no-site-file -l auctex’.  The ‘-l’
           option loads ‘auctex.el’ which you normally do in your init
@@ -8512,9 +8516,7 @@ Insert commands
      C-f <RET>’ to get a list of supported commands.
 
      Note that the prefix argument is not handled the same way by
-     AUCTeX.  Note also that the node insertion command from the native
-     mode (‘texinfo-insert-@node’) can still accessed from the Texinfo
-     menu in AUCTeX.
+     AUCTeX.
 
 Insert braces
      In AUCTeX braces can be inserted with the same key binding as in
@@ -8531,7 +8533,17 @@ Insert environments
      and closing statements, with the function ‘Texinfo-environment’
      (mapped to ‘C-c C-e’).
 
-Format info files with makeinfo and TeX
+Insert nodes
+     Node insertion command ‘texinfo-insert-@node’ is available in the
+     native Texinfo mode (mapped to ‘C-c C-c n’).  It only inserts the
+     string ‘@node ’ (with suitable newlines).
+
+     AUCTeX provides its own node insertion command
+     ‘Texinfo-insert-node’ (mapped to ‘C-c C-s’), which asks for the
+     next, previous and upper nodes with completion, in addition to the
+     node name you are going to insert.
+
+Format info files with ‘makeinfo’ and TeX
      In the native Texinfo mode there are various functions and bindings
      to format a region or the whole buffer for info or to typeset the
      respective text.  For example, there is ‘makeinfo-buffer’ (mapped
@@ -8542,9 +8554,9 @@ Format info files with makeinfo and TeX
      In AUCTeX different commands for formatting or typesetting can be
      invoked through the function ‘TeX-command-master’ (mapped to ‘C-c
      C-c’).  After typing ‘C-c C-c’, you can select the desired command,
-     e.g ‘Makeinfo’ or ‘TeX’, through a prompt in the mini buffer.  Note
-     that you can make, say ‘Makeinfo’, the default by adding this
-     statement in your init file:
+     e.g. ‘Makeinfo’, ‘Makeinfo HTML’, ‘Texi2dvi’ or ‘TeX’, through a
+     prompt in the mini buffer.  Note that you can make, say ‘Makeinfo’,
+     the default by adding this statement in your init file:
 
           (add-hook 'Texinfo-mode-hook
                     (lambda () (setq TeX-command-default "Makeinfo")))
@@ -8559,7 +8571,7 @@ Format info files with makeinfo and TeX
      Note also that in the case of a multifile document, ‘C-c C-c’ in
      AUCTeX will work on the whole document (provided that the file
      variable ‘TeX-master’ is set correctly), while ‘makeinfo-buffer’ in
-     the native mode will process only the current buffer, provided at
+     the native mode will process only the current buffer, provided that
      the ‘@setfilename’ statement is provided.
 
 Produce indexes and print
@@ -8625,20 +8637,14 @@ File: auctex.info,  Node: Unbinding,  Prev: Mapping,  
Up: Texinfo mode
 A.5.4 Which native mode key bindings are missing
 ------------------------------------------------
 
-The following commands from the native commands might still be useful
-when working with AUCTeX, however, they are not accessible with a key
+The following command from the native commands might still be useful
+when working with AUCTeX, however, it is not accessible with a key
 binding any longer.
 
-‘@node’ insertion
-     The node insertion command, mapped to ‘C-c C-c n’ in the native
-     mode, is not mapped to any key in AUCTeX.  You can still access it
-     through the Texinfo menu, though.  Another alternative is to use
-     the ‘C-c C-m’ binding for macro insertion in AUCTeX.
-
 Show the section structure
      The command ‘texinfo-show-structure’ (‘C-c C-s’) from the native
      mode does not have a key binding in AUCTeX.  The binding is used by
-     AUCTeX for sectioning.
+     AUCTeX for inserting ‘@node’.
 
 
 File: auctex.info,  Node: Indices,  Prev: Appendices,  Up: Top
@@ -8681,6 +8687,7 @@ Key Index
 * C-c C-c:                               Starting a Command.  (line  13)
 * C-c C-d:                               Multifile.           (line  99)
 * C-c C-e:                               Environments.        (line  23)
+* C-c C-e <1>:                           Superseding.         (line  34)
 * C-c C-f:                               Font Specifiers.     (line  55)
 * C-c C-f C-b:                           Editing Facilities.  (line  72)
 * C-c C-f C-b <1>:                       Font Specifiers.     (line  16)
@@ -8707,6 +8714,7 @@ Key Index
 * C-c C-f g:                             Japanese.            (line 113)
 * C-c C-f m:                             Japanese.            (line 117)
 * C-c C-k:                               Control.             (line  10)
+* C-c C-k <1>:                           Superseding.         (line  94)
 * C-c C-l:                               Control.             (line  14)
 * C-c C-m:                               Completion.          (line  79)
 * C-c C-n:                               Parsing Files.       (line  45)
@@ -8728,6 +8736,7 @@ Key Index
 * C-c C-q C-s:                           Filling.             (line  95)
 * C-c C-r:                               Starting a Command.  (line  19)
 * C-c C-s:                               Sectioning.          (line  22)
+* C-c C-s <1>:                           Superseding.         (line  44)
 * C-c C-t C-b:                           Ignoring warnings.   (line  10)
 * C-c C-t C-i:                           Processing Facilities.
                                                               (line  53)
@@ -8909,6 +8918,7 @@ Function Index
 * TeX-font:                              Font Specifiers.     (line  54)
 * TeX-home-buffer:                       Control.             (line  17)
 * TeX-insert-braces:                     Quotes.              (line 135)
+* TeX-insert-braces <1>:                 Superseding.         (line  29)
 * TeX-insert-dollar:                     Quotes.              (line  60)
 * TeX-insert-macro:                      Completion.          (line  78)
 * TeX-insert-quote:                      Quotes.              (line  14)
@@ -8917,6 +8927,7 @@ Function Index
 * TeX-ispell-skip-setcdr:                Selecting a Command. (line 147)
 * TeX-ispell-tex-arg-end:                Selecting a Command. (line 167)
 * TeX-kill-job:                          Control.             (line   9)
+* TeX-kill-job <1>:                      Superseding.         (line  94)
 * TeX-master-file-ask:                   Multifile.           (line  70)
 * TeX-narrow-to-group:                   Narrowing.           (line  13)
 * TeX-next-error:                        Debugging.           (line  11)
@@ -8937,6 +8948,8 @@ Function Index
 * TeX-view:                              Starting Viewers.    (line  11)
 * TeX-view <1>:                          I/O Correlation.     (line  42)
 * TeX-view-mouse:                        I/O Correlation.     (line  48)
+* Texinfo-environment:                   Superseding.         (line  34)
+* Texinfo-insert-node:                   Superseding.         (line  44)
 * Texinfo-mark-environment:              Marking (Texinfo).   (line  24)
 * Texinfo-mark-node:                     Marking (Texinfo).   (line  33)
 * Texinfo-mark-section:                  Marking (Texinfo).   (line   6)
@@ -9091,9 +9104,9 @@ Variable Index
 * LaTeX-fill-excluded-macros:            Filling.             (line 121)
 * LaTeX-float:                           Floats.              (line  14)
 * LaTeX-float <1>:                       Floats.              (line  39)
-* LaTeX-fold-env-spec-list:              Folding.             (line 197)
-* LaTeX-fold-macro-spec-list:            Folding.             (line 197)
-* LaTeX-fold-math-spec-list:             Folding.             (line 197)
+* LaTeX-fold-env-spec-list:              Folding.             (line 199)
+* LaTeX-fold-macro-spec-list:            Folding.             (line 199)
+* LaTeX-fold-math-spec-list:             Folding.             (line 199)
 * LaTeX-font-list:                       Font Specifiers.     (line  69)
 * LaTeX-indent-environment-check:        Indenting.           (line  51)
 * LaTeX-indent-environment-list:         Indenting.           (line  37)
@@ -9210,17 +9223,17 @@ Variable Index
 * TeX-file-recurse:                      Automatic.           (line  44)
 * TeX-fold-auto:                         Folding.             (line  70)
 * TeX-fold-command-prefix:               Folding.             (line 145)
-* TeX-fold-env-spec-list:                Folding.             (line 187)
+* TeX-fold-env-spec-list:                Folding.             (line 189)
 * TeX-fold-force-fontify:                Folding.             (line  62)
-* TeX-fold-help-echo-max-length:         Folding.             (line 224)
+* TeX-fold-help-echo-max-length:         Folding.             (line 226)
 * TeX-fold-macro-spec-list:              Folding.             (line 154)
-* TeX-fold-math-spec-list:               Folding.             (line 194)
+* TeX-fold-math-spec-list:               Folding.             (line 196)
 * TeX-fold-preserve-comments:            Folding.             (line  75)
 * TeX-fold-type-list:                    Folding.             (line  57)
 * TeX-fold-unfold-around-mark:           Folding.             (line  81)
-* TeX-fold-unspec-env-display-string:    Folding.             (line 207)
-* TeX-fold-unspec-macro-display-string:  Folding.             (line 203)
-* TeX-fold-unspec-use-name:              Folding.             (line 211)
+* TeX-fold-unspec-env-display-string:    Folding.             (line 209)
+* TeX-fold-unspec-macro-display-string:  Folding.             (line 205)
+* TeX-fold-unspec-use-name:              Folding.             (line 213)
 * TeX-font-list:                         Font Specifiers.     (line  60)
 * TeX-header-end:                        Starting a Command.  (line  32)
 * TeX-header-end <1>:                    Starting a Command.  (line  69)
@@ -9373,7 +9386,7 @@ Concept Index
                                                               (line   6)
 * ASCII pTeX <1>:                        Japanese.            (line   6)
 * auctex.el:                             Loading the package. (line  10)
-* auctex.el <1>:                         Changes.             (line 886)
+* auctex.el <1>:                         Changes.             (line 888)
 * auto directories.:                     Automatic.           (line   6)
 * auto-fill-mode:                        Indenting.           (line  29)
 * Auto-Reveal:                           Folding.             (line   6)
@@ -9678,7 +9691,7 @@ Concept Index
                                                               (line 252)
 * tex-site.el:                           Loading the package. (line  10)
 * tex-site.el <1>:                       Customizing.         (line   6)
-* tex-site.el <2>:                       Changes.             (line 886)
+* tex-site.el <2>:                       Changes.             (line 888)
 * tool bar, toolbar:                     Processing.          (line  11)
 * Trailer:                               Commands.            (line   6)
 * Underfull boxes:                       Debugging.           (line   6)
@@ -9700,105 +9713,105 @@ Concept Index
 
 
 Tag Table:
-Node: Top922
-Node: Copying7402
-Node: Introduction9351
-Node: Summary9621
-Node: Installation12370
-Node: Prerequisites14381
-Node: Configure16608
-Node: Build/install and uninstall21350
-Node: Loading the package22107
-Node: Advice for package providers23846
-Node: Advice for non-privileged users26717
-Node: Installation under MS Windows32235
-Node: Customizing46175
-Node: Quick Start47784
-Ref: Quick Start-Footnote-149917
-Node: Editing Facilities50019
-Node: Processing Facilities54909
-Node: Editing59800
-Node: Quotes61138
-Node: Font Specifiers70676
-Node: Sectioning72872
-Node: Environments77569
-Node: Equations83137
-Node: Floats83765
-Node: Itemize-like85809
-Node: Tabular-like86679
-Node: Customizing Environments88573
-Node: Mathematics88813
-Node: Completion92339
-Node: Marking100106
-Node: Marking (LaTeX)100742
-Node: Marking (Texinfo)101692
-Node: Commenting103335
-Node: Indenting104720
-Node: Filling113439
-Node: Display119461
-Node: Font Locking121974
-Node: Fontification of macros124079
-Node: Fontification of quotes134101
-Node: Fontification of math135641
-Node: Verbatim content139417
-Node: Faces140207
-Node: Known problems140712
-Node: Folding141721
-Node: Outline152708
-Node: Narrowing154031
-Node: Prettifying155108
-Node: Processing156395
-Node: Commands157755
-Node: Starting a Command158319
-Node: Selecting a Command163483
-Node: Processor Options172886
-Node: Viewing183559
-Node: Starting Viewers183933
-Node: I/O Correlation189731
-Ref: I/O Correlation-Footnote-1195489
-Node: Debugging195755
-Node: Ignoring warnings198435
-Node: Error overview200546
-Node: Checking202470
-Node: Control204160
-Node: Cleaning206309
-Node: Documentation207756
-Node: Customization208879
-Node: Modes and Hooks209372
-Node: Multifile211332
-Node: Parsing Files216178
-Node: Internationalization221217
-Node: European222571
-Node: Japanese230490
-Node: Automatic235750
-Node: Automatic Global238279
-Node: Automatic Private239417
-Node: Automatic Local240781
-Node: Style Files242055
-Node: Simple Style242869
-Node: Adding Macros246662
-Node: Adding Environments256463
-Node: Adding Other261925
-Node: Hacking the Parser266605
-Node: Appendices270618
-Node: Copying this Manual270914
-Node: GNU Free Documentation License271800
-Node: Changes297124
-Node: Development356597
-Node: Mid-term Goals357245
-Node: Wishlist360144
-Node: Bugs366347
-Node: FAQ367487
-Node: Texinfo mode373361
-Node: Exploiting374497
-Node: Superseding375319
-Node: Mapping379786
-Node: Unbinding381729
-Node: Indices382570
-Node: Key Index382733
-Node: Function Index390408
-Node: Variable Index402678
-Node: Concept Index428183
+Node: Top933
+Node: Copying7413
+Node: Introduction9362
+Node: Summary9632
+Node: Installation12381
+Node: Prerequisites14392
+Node: Configure16619
+Node: Build/install and uninstall21362
+Node: Loading the package22119
+Node: Advice for package providers23858
+Node: Advice for non-privileged users26729
+Node: Installation under MS Windows32247
+Node: Customizing46187
+Node: Quick Start47796
+Ref: Quick Start-Footnote-149929
+Node: Editing Facilities50031
+Node: Processing Facilities54923
+Node: Editing59814
+Node: Quotes61152
+Node: Font Specifiers70690
+Node: Sectioning72886
+Node: Environments77583
+Node: Equations83151
+Node: Floats83779
+Node: Itemize-like85823
+Node: Tabular-like86693
+Node: Customizing Environments88587
+Node: Mathematics88827
+Node: Completion92353
+Node: Marking100120
+Node: Marking (LaTeX)100756
+Node: Marking (Texinfo)101706
+Node: Commenting103349
+Node: Indenting104734
+Node: Filling113453
+Node: Display119475
+Node: Font Locking121988
+Node: Fontification of macros124093
+Node: Fontification of quotes134115
+Node: Fontification of math135655
+Node: Verbatim content139431
+Node: Faces140221
+Node: Known problems140726
+Node: Folding141735
+Node: Outline152866
+Node: Narrowing154189
+Node: Prettifying155266
+Node: Processing156553
+Node: Commands157913
+Node: Starting a Command158477
+Node: Selecting a Command163641
+Node: Processor Options173044
+Node: Viewing183717
+Node: Starting Viewers184091
+Node: I/O Correlation189889
+Ref: I/O Correlation-Footnote-1195647
+Node: Debugging195913
+Node: Ignoring warnings198593
+Node: Error overview200704
+Node: Checking202628
+Node: Control204318
+Node: Cleaning206467
+Node: Documentation207914
+Node: Customization209037
+Node: Modes and Hooks209530
+Node: Multifile211490
+Node: Parsing Files216336
+Node: Internationalization221375
+Node: European222730
+Node: Japanese230649
+Node: Automatic235909
+Node: Automatic Global238438
+Node: Automatic Private239576
+Node: Automatic Local240940
+Node: Style Files242214
+Node: Simple Style243028
+Node: Adding Macros246821
+Node: Adding Environments256622
+Node: Adding Other262084
+Node: Hacking the Parser266764
+Node: Appendices270777
+Node: Copying this Manual271073
+Node: GNU Free Documentation License271970
+Node: Changes297294
+Node: Development356831
+Node: Mid-term Goals357479
+Node: Wishlist360378
+Node: Bugs366581
+Node: FAQ367721
+Node: Texinfo mode373595
+Node: Exploiting374731
+Node: Superseding375553
+Node: Mapping380368
+Node: Unbinding382311
+Node: Indices382859
+Node: Key Index383022
+Node: Function Index390916
+Node: Variable Index403478
+Node: Concept Index428983
 
 End Tag Table
 
diff --git a/context-nl.el b/context-nl.el
index 49aacac46d..825ee9fa74 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 40214aad4d..173fbf5c9a 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.
@@ -1840,8 +1840,8 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
     (set symbol (symbol-value (intern (concat (symbol-name symbol) "-"
                                               ConTeXt-current-interface)))))
 
-  ;; Create certain regular expressions based on language
-  (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat #'identity 
ConTeXt-item-list "\\|") "\\)\\>"))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat #'identity 
ConTeXt-item-list "\\|") "\\)\\>"))
 
   ;; What's the deepest level at we can collapse a document?
   ;; set only if user has not set it.  Need to be set before menu is created.
@@ -1858,17 +1858,19 @@ that is, you do _not_ have to cater for this yourself 
by adding \\\\\\=' or $."
 
   ;; Paragraph formatting
   (set (make-local-variable 'LaTeX-syntactic-comments) nil)
-  (set (make-local-variable 'LaTeX-paragraph-commands-regexp)
-       (ConTeXt-paragraph-commands-regexp))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'LaTeX-paragraph-commands-regexp)
+  ;;      (ConTeXt-paragraph-commands-regexp))
   (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
   (set (make-local-variable 'fill-paragraph-function) #'LaTeX-fill-paragraph)
   (set (make-local-variable 'adaptive-fill-mode) nil)
-  (setq paragraph-start
-        (concat
-         "[ \t]*\\("
-         (ConTeXt-paragraph-commands-regexp) "\\|"
-         "\\$\\$\\|" ; Plain TeX display math
-         "$\\)"))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (setq paragraph-start
+  ;;       (concat
+  ;;        "[ \t]*\\("
+  ;;        (ConTeXt-paragraph-commands-regexp) "\\|"
+  ;;        "\\$\\$\\|" ; Plain TeX display math
+  ;;        "$\\)"))
   (setq paragraph-separate
         (concat
          "[ \t]*\\("
@@ -1879,6 +1881,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,8 +1889,9 @@ 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-regexp) (ConTeXt-outline-regexp t))
+  (set (make-local-variable 'outline-level) #'ConTeXt-outline-level)
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'outline-regexp) (ConTeXt-outline-regexp t))
   ;;(make-local-variable 'outline-heading-end-regexp)
   (setq TeX-header-end (ConTeXt-header-end)
         TeX-trailer-start (ConTeXt-trailer-start))
@@ -1902,7 +1906,31 @@ that is, you do _not_ have to cater for this yourself by 
adding \\\\\\=' or $."
   ;; run hooks
   (setq TeX-command-default "ConTeXt")
   (setq TeX-sentinel-default-function #'TeX-ConTeXt-sentinel)
-  (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook))
+  (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook)
+
+  ;; Create certain regular expressions based on language.
+  ;; Don't overwrite the value the user set by hooks or file
+  ;; (directory) variables.
+  (or (local-variable-p 'ConTeXt-indent-item-re)
+      (setq-local ConTeXt-indent-item-re
+                  (concat
+                   "\\\\\\("
+                   (mapconcat #'identity ConTeXt-item-list "\\|")
+                   "\\)\\>")))
+
+  ;; Don't do locally-bound test for `LaTeX-paragraph-commands-regexp'
+  ;; and `paragraph-start'.  See comments in similar part in latex.el.
+  (setq-local LaTeX-paragraph-commands-regexp
+              (ConTeXt-paragraph-commands-regexp))
+  (setq paragraph-start
+        (concat
+         "[ \t]*\\("
+         (ConTeXt-paragraph-commands-regexp) "\\|"
+         "\\$\\$\\|" ; Plain TeX display math
+         "$\\)"))
+
+  (or (local-variable-p 'outline-regexp)
+      (setq-local outline-regexp (ConTeXt-outline-regexp t))))
 
 (defun context-guess-current-interface ()
   "Guess what ConTeXt interface the current buffer is using."
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 8d5b282f66..1edafd600d 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2747,6 +2747,8 @@ placeholder.
 If the first element is a function symbol, the function will be called
 with all mandatory arguments of the macro and the result of the function
 call will be used as a replacement for the macro.
+Such functions typically return a string, but may also return the
+symbol @code{abort} to indicate that the macro should not be folded.
 
 The placeholder is made by copying the text from the buffer together with
 its properties, i.e.@: its face as well.  If fontification has not
@@ -4577,7 +4579,7 @@ Parse all @TeX{} and @LaTeX{} commands that @AUCTeX{} can 
use.
 @cindex @acronym{CJK}-@LaTeX{}
 
 @TeX{} and Emacs are usable for European (Latin, Cyrillic, Greek) based
-languages.  Some @LaTeX{} and EmacsLisp packages are available for easy
+languages.  Some @LaTeX{} and Emacs Lisp packages are available for easy
 typesetting and editing documents in European languages.
 
 @c Some Texinfo macros are not used because they require quite recent
@@ -6144,16 +6146,16 @@ C-@var{k}} and call the function @code{TeX-font}.  Type 
@kbd{C-c C-f
 @key{RET}} to get a list of supported commands.
 
 Note that the prefix argument is not handled the same way by @AUCTeX{}.
-Note also that the node insertion command from the native mode
-(@code{texinfo-insert-@@node}) can still accessed from the Texinfo menu
-in @AUCTeX{}.
 
 @item Insert braces
+@findex TeX-insert-braces
 In @AUCTeX{} braces can be inserted with the same key binding as in the
 native Texinfo mode: @kbd{C-c @{}.  But @AUCTeX{} uses its own function
 for the feature: @code{TeX-insert-braces}.
 
 @item Insert environments
+@findex Texinfo-environment
+@kindex C-c C-e
 The native Texinfo mode does not insert full environments.  Instead, it
 provides the function @code{texinfo-insert-@@end} (mapped to @kbd{C-c
 C-c e}) for closing an open environment with a matching @code{@@end} statement.
@@ -6162,18 +6164,31 @@ In @AUCTeX{} you can insert full environments, i.e.@: 
both the opening and
 closing statements, with the function @code{Texinfo-environment} (mapped
 to @kbd{C-c C-e}).
 
-@item Format info files with makeinfo and @TeX{}
+@item Insert nodes
+@findex Texinfo-insert-node
+@kindex C-c C-s
+Node insertion command @code{texinfo-insert-@@node} is available in
+the native Texinfo mode (mapped to @kbd{C-c C-c n}).  It only inserts
+the string @samp{@@node } (with suitable newlines).
+
+@AUCTeX{} provides its own node insertion command
+@code{Texinfo-insert-node} (mapped to @kbd{C-c C-s}), which asks for
+the next, previous and upper nodes with completion, in addition to the
+node name you are going to insert.
+
+@item Format info files with @command{makeinfo} and @TeX{}
 In the native Texinfo mode there are various functions and bindings to
 format a region or the whole buffer for info or to typeset the
 respective text.  For example, there is @code{makeinfo-buffer} (mapped
-to @kbd{C-c C-m C-b}) which runs @samp{makeinfo} on the buffer or there
+to @kbd{C-c C-m C-b}) which runs @command{makeinfo} on the buffer or there
 is @code{texinfo-tex-buffer} (mapped to @kbd{C-c C-t C-b}) which runs
 @TeX{} on the buffer in order to produce a @acronym{DVI} file.
 
 In @AUCTeX{} different commands for formatting or typesetting can be
 invoked through the function @code{TeX-command-master} (mapped to
 @kbd{C-c C-c}).  After typing @kbd{C-c C-c}, you can select the desired
-command, e.g @samp{Makeinfo} or @samp{TeX}, through a prompt in the mini
+command, e.g.@: @samp{Makeinfo}, @samp{Makeinfo HTML}, @samp{Texi2dvi}
+or @samp{TeX}, through a prompt in the mini
 buffer.  Note that you can make, say @samp{Makeinfo}, the default by
 adding this statement in your init file:
 
@@ -6193,7 +6208,7 @@ Note also that in the case of a multifile document, 
@kbd{C-c C-c} in
 @AUCTeX{} will work on the whole document (provided that the file
 variable @code{TeX-master} is set correctly), while
 @code{makeinfo-buffer} in the native mode will process only the current
-buffer, provided at the @code{@@setfilename} statement is provided.
+buffer, provided that the @code{@@setfilename} statement is provided.
 
 @item Produce indexes and print
 The native Texinfo mode provides the binding @kbd{C-c C-t C-i}
@@ -6205,6 +6220,8 @@ through @kbd{C-c C-c} (@code{TeX-command-master}) in 
@AUCTeX{}: @samp{Texindex},
 @samp{Print}, and @samp{Queue}.
 
 @item Kill jobs
+@findex TeX-kill-job
+@kindex C-c C-k
 The command @kbd{C-c C-t C-k} (@code{tex-kill-job}) in the native mode
 is superseded by @kbd{C-c C-k} (@code{TeX-kill-job}) in @AUCTeX{}.
 @end table
@@ -6255,21 +6272,15 @@ C-d} in @AUCTeX{} instead.
 @node Unbinding
 @appendixsubsec Which native mode key bindings are missing
 
-The following commands from the native commands might still be useful
-when working with @AUCTeX{}, however, they are not accessible with a
+The following command from the native commands might still be useful
+when working with @AUCTeX{}, however, it is not accessible with a
 key binding any longer.
 
 @table @asis
-@item @code{@@node} insertion
-The node insertion command, mapped to @kbd{C-c C-c n} in the native
-mode, is not mapped to any key in @AUCTeX{}.  You can still access it
-through the Texinfo menu, though.  Another alternative is to use the
-@kbd{C-c C-m} binding for macro insertion in @AUCTeX{}.
-
 @item Show the section structure
 The command @code{texinfo-show-structure} (@kbd{C-c C-s}) from the
 native mode does not have a key binding in @AUCTeX{}.  The binding is
-used by @AUCTeX{} for sectioning.
+used by @AUCTeX{} for inserting @samp{@@node}.
 @end table
 
 @node Indices
diff --git a/doc/changes.texi b/doc/changes.texi
index 467af2a506..cbb341c62e 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{} abbrevs are available in doc@TeX{} mode buffers.
 @end itemize
 
 @heading News in 13.2
diff --git a/doc/faq.texi b/doc/faq.texi
index 547cb01f0f..a2d2aec0d2 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -51,7 +51,7 @@ command line, depending on the installation scheme of 
@AUCTeX{} and your
 If you installed @AUCTeX{} from @acronym{ELPA}, use @samp{emacs -q
 -no-site-file --eval "(progn (setq package-load-list '((auctex t)))
 (package-initialize))"}.  The @option{--eval} option activates only
-@AUCTeX{} among all installed @acronym{EPLA} packages.
+@AUCTeX{} among all installed @acronym{ELPA} packages.
 @item
 If you installed @AUCTeX{} via traditional
 @command{configure}--@command{make} scheme, use @samp{emacs -q
diff --git a/doc/install.texi b/doc/install.texi
index f808135b54..8b7b00e35d 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -193,7 +193,7 @@ providers} for detail.
 
 If you are planning to install the package as a single non-priviledged
 user, you will typically set @var{prefix} to your home directory.
-Consult @ref{Advice for non-privileged users} for addtional
+Consult @ref{Advice for non-privileged users} for additional
 instructions.
 
 @item --with-emacs=@var{/path/to/emacs}
diff --git a/doc/quickstart.texi b/doc/quickstart.texi
index 9731d15eb1..d0fdf78e1a 100644
--- a/doc/quickstart.texi
+++ b/doc/quickstart.texi
@@ -124,7 +124,7 @@ this and asks you to enter a value.
 
 @subsection Inserting macros
 
-@kbd{C-c C-m}, or simply @kbd{C-c RET} will give you a prompt that asks
+@kbd{C-c C-m}, or simply @kbd{C-c @key{RET}} will give you a prompt that asks
 you for a @LaTeX{} macro.  You can use @key{TAB} for completion, or the
 @key{up}/@key{down} arrow keys (or @kbd{M-p} and @kbd{M-n}) to browse the 
command
 history.  In many cases, @AUCTeX{} knows which arguments a macro needs
diff --git a/font-latex.el b/font-latex.el
index 7617b5cc84..1f5b2988ba 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -854,8 +854,7 @@ Generated by `font-latex-user-keyword-classes'"))))
                      (throw 'single-char nil))))
                (set (intern (concat prefix (car elt)))
                     (when (> (safe-length keywords) 0)
-                    (concat "\\\\" (let ((max-specpdl-size 1000))
-                                     (regexp-opt keywords t))
+                    (concat "\\\\" (regexp-opt keywords t)
                             (unless single-char-macro-flag "\\>")))))))))
 
 (defun font-latex-make-user-keywords ()
@@ -1083,8 +1082,10 @@ have changed."
                   "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
                   ;; An opening curly brace as delimiter is valid, but
                   ;; allowing it might screw up fontification of stuff
-                  ;; like "\url{...} foo \textbf{<--!...}".
-                  "\\([^a-z@*\n\f{]\\).*?"
+                  ;; like "\url{...} foo \textbf{<--!...}".  Also
+                  ;; disallow an opening square bracket which produces
+                  ;; confusion in "\Verb[key-val]{foo[<--!}"
+                  "\\([^a-z@*\n\f{[]\\).*?"
                   ;; Give an escape char at the end of the verbatim
                   ;; construct punctuation syntax.  Prevents wrong
                   ;; fontification of stuff like "\verb|foo\|".
@@ -1351,7 +1352,17 @@ triggers Font Lock to recognize the change."
 
   ;; Make sure fontification will be refreshed if a user sets variables
   ;; influencing fontification in her file-local variables section.
-  (add-hook 'hack-local-variables-hook 
#'font-latex-after-hacking-local-variables t t))
+  (add-hook 'hack-local-variables-hook 
#'font-latex-after-hacking-local-variables t t)
+
+  ;; We may be using the mode programmatically to extract data, and we
+  ;; then need this to be set up first so that a command like
+  ;; `xref-find-references' doesn't bug out when matching hits in
+  ;; files that Emacs isn't visiting. (bug#65912)
+  ;; We need this treatment because the current syntax propertize
+  ;; facility depends on font lock machinery.  We can remove this
+  ;; when syntax propertization decouples font lock.
+  (unless buffer-file-truename
+    (font-lock-set-defaults)))
 
 (defun font-latex-update-font-lock (&optional _syntactic-kws)
   "Tell font-lock about updates of fontification rules.
diff --git a/latex.el b/latex.el
index 6c51a14654..f56b51893c 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"
@@ -1744,14 +1747,20 @@ right number."
   "List of regular expression matching LaTeX labels only.")
 
 (defvar LaTeX-auto-index-regexp-list
-   
'(("\\\\\\(index\\|glossary\\){\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}"
-        2 LaTeX-auto-index-entry))
-   "List of regular expression matching LaTeX index/glossary entries only.
+  `((,(concat "\\\\\\(?:index\\|glossary\\)"
+              "{\\([^}{]*"
+              "\\(?:{[^}{]*"
+              "\\(?:{[^}{]*"
+              "\\(?:{[^}{]*}[^}{]*\\)*}"
+              "[^}{]*\\)*}"
+              "[^}{]*\\)*\\)}")
+     1 LaTeX-auto-index-entry))
+  "List of regular expression matching LaTeX index/glossary entries only.
 Regexp allows for up to 3 levels of parenthesis inside the index argument.
 This is necessary since index entries may contain commands and stuff.")
 
 (defvar LaTeX-auto-class-regexp-list
-  '(;; \RequirePackage[<options>]{<package>}[<date>]
+  `(;; \RequirePackage[<options>]{<package>}[<date>]
     ("\\\\Require\\(Package\\)\\(\\[\\([^]]*\\)\\]\\)?\
 {\\([^#\\.\n\r]+?\\)}"
      (3 4 1) LaTeX-auto-style)
@@ -1774,13 +1783,16 @@ This is necessary since index entries may contain 
commands and stuff.")
     ("\\\\DeclareRobustCommand\\*?{?\\\\\\([A-Za-z]+\\)}?"
      1 TeX-auto-symbol)
     ;; Patterns for commands described in "LaTeX2e font selection" (fntguide)
-    ("\\\\DeclareMath\\(?:Symbol\\|Delimiter\\|Accent\\|Radical\\)\
-{?\\\\\\([A-Za-z]+\\)}?"
-     1 TeX-auto-symbol)
-    ("\\\\\\(Declare\\|Provide\\)Text\
-\\(?:Command\\|Symbol\\|Accent\\|Composite\\){?\\\\\\([A-Za-z]+\\)}?"
-     1 TeX-auto-symbol)
-    ("\\\\Declare\\(?:Text\\|Old\\)FontCommand{?\\\\\\([A-Za-z]+\\)}?"
+    (,(concat "\\\\"
+              (regexp-opt '("DeclareMathSymbol"  "DeclareMathDelimiter"
+                            "DeclareMathAccent"  "DeclareMathRadical"
+                            "DeclareTextCommand" "DeclareTextSymbol"
+                            "DeclareTextAccent"  "DeclareTextComposite"
+                            "ProvideTextCommand" "ProvideTextSymbol"
+                            "ProvideTextAccent"  "ProvideTextComposite"
+                            "DeclareTextFontCommand"
+                            "DeclareOldFontCommand"))
+              "{?\\\\\\([A-Za-z]+\\)}?")
      1 TeX-auto-symbol))
   "List of regular expressions matching macros in LaTeX classes and packages.")
 
@@ -1790,8 +1802,9 @@ This is necessary since index entries may contain 
commands and stuff.")
 
 (defvar LaTeX-auto-counter-regexp-list
   (let ((token TeX-token-char))
-    `((,(concat "\\\\newcounter *{\\(" token "+\\)}") 1 LaTeX-auto-counter)
-      (,(concat "\\\\@definecounter{\\(" token "+\\)}") 1 LaTeX-auto-counter)))
+    `((,(concat "\\\\"
+                "\\(?:newcounter\\|@definecounter\\) *{\\(" token "+\\)}")
+       1 LaTeX-auto-counter)))
   "List of regular expressions matching LaTeX counters only.")
 
 (defvar LaTeX-auto-length-regexp-list
@@ -1825,16 +1838,15 @@ This is necessary since index entries may contain 
commands and stuff.")
         1 TeX-auto-file)
        ("\\\\include{\\(\\.*[^#}%\\.\n\r]+\\)\\(\\.[^#}%\\.\n\r]+\\)?}"
         1 TeX-auto-file)
-       (,(concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}")
-        1 LaTeX-auto-bibitem)
-       (,(concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, 
\n\r\t%\"#'()={}]*\\)}")
+       (,(concat "\\\\bibitem\\(?:\\[[^][\n\r]+\\]\\)?"
+                 "{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}")
         1 LaTeX-auto-bibitem)
        ("\\\\bibliography{\\([^#}\\\n\r]+\\)}" 1 LaTeX-auto-bibliography)
        ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\n\r]+\\)\\..+}"
         1 LaTeX-auto-bibliography)
        
("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\n\r.]+\\)\\(?:\\..+\\)?}"
 1 LaTeX-auto-bibliography)
-       ("\\\\newrefsection\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)
-       ("\\\\begin{refsection}\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)))
+       ("\\\\\\(?:newrefsection\\|begin{refsection}\\)\\[\\([^]]+\\)\\]"
+        1 LaTeX-split-bibs)))
    LaTeX-auto-class-regexp-list
    LaTeX-auto-label-regexp-list
    LaTeX-auto-index-regexp-list
@@ -6451,14 +6463,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)
 
@@ -6484,7 +6498,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)
 
@@ -7718,7 +7733,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))
@@ -8001,6 +8016,36 @@ of `LaTeX-mode-hook'."
                               (mapcar #'cdr LaTeX-provided-class-options)))))
             nil t)
   (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
+
+  ;; Don't overwrite the value the user set by hooks or file
+  ;; (directory) local variables.
+  (or (local-variable-p 'outline-regexp)
+      (setq-local outline-regexp (LaTeX-outline-regexp t)))
+  (or (local-variable-p 'outline-heading-alist)
+      (setq outline-heading-alist
+            (mapcar (lambda (x)
+                      (cons (concat "\\" (nth 0 x)) (nth 1 x)))
+                    LaTeX-section-list)))
+
+  ;; Keep `LaTeX-paragraph-commands-regexp' in sync with
+  ;; `LaTeX-paragraph-commands' in case the latter is updated by
+  ;; hooks or file (directory) local variables.
+  (and (local-variable-p 'LaTeX-paragraph-commands)
+       (setq-local LaTeX-paragraph-commands-regexp
+                   (LaTeX-paragraph-commands-regexp-make)))
+  ;; Don't do locally-bound test for `paragraph-start' because it
+  ;; makes little sense; Style files casually call this function and
+  ;; overwrite it unconditionally.  Users who need per-file
+  ;; customization of `paragraph-start' should set
+  ;; `LaTeX-paragraph-commands' instead.
+  (LaTeX-set-paragraph-start)
+
+  ;; Don't do locally-bound test for similar reason as above.  Users
+  ;; who need per-file customization of
+  ;; `LaTeX-indent-begin-regexp-local' etc. should set
+  ;; `LaTeX-indent-begin-list' and so on instead.
+  (LaTeX-indent-commands-regexp-make)
+
   (when (fboundp 'LaTeX-preview-setup)
     (LaTeX-preview-setup))
   (TeX-set-mode-name)
@@ -8009,7 +8054,14 @@ of `LaTeX-mode-hook'."
            filladapt-mode)
       (turn-off-filladapt-mode))
   ;; Set up flymake backend, see latex-flymake.el
-  (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t))
+  (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t)
+
+  ;; Complete style initialization in buffers which don't visit files
+  ;; and which are therefore missed by the setting of `find-file-hook'
+  ;; in `VirTeX-common-initialization'.  This is necessary for
+  ;; `xref-find-references', for example. (bug#65912)
+  (unless buffer-file-truename
+    (TeX-update-style)))
 
 (TeX-abbrev-mode-setup doctex-mode)
 
@@ -8032,8 +8084,18 @@ runs the hooks in `docTeX-mode-hook'."
         TeX-comment-start-regexp "\\(?:%\\(?:<[^>]+>\\)?\\)")
   (setq TeX-base-mode-name "docTeX")
   (TeX-set-mode-name)
+  ;; We can remove the next `setq' when syntax propertization
+  ;; decouples font lock and `font-latex-setup' stops calling
+  ;; `font-lock-set-defaults'.
+  (setq font-lock-set-defaults nil)
   (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))))
+
 ;;This is actually a mess: to fit the scheme properly, our derived
 ;;mode definition would have had to be made for TeX-doctex-mode in the
 ;;first place, but then we could not have used define-derived-mode, or
@@ -8115,12 +8177,13 @@ function would return non-nil and `(match-string 1)' 
would return
 
   (require 'outline)
   (set (make-local-variable 'outline-level) #'LaTeX-outline-level)
-  (set (make-local-variable 'outline-regexp) (LaTeX-outline-regexp t))
-  (when (boundp 'outline-heading-alist)
-    (setq outline-heading-alist
-          (mapcar (lambda (x)
-                    (cons (concat "\\" (nth 0 x)) (nth 1 x)))
-                  LaTeX-section-list)))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'outline-regexp) (LaTeX-outline-regexp t))
+  ;; (when (boundp 'outline-heading-alist)
+  ;;   (setq outline-heading-alist
+  ;;         (mapcar (lambda (x)
+  ;;                   (cons (concat "\\" (nth 0 x)) (nth 1 x)))
+  ;;                 LaTeX-section-list)))
 
   (setq-local TeX-auto-full-regexp-list
               (delete-dups (append LaTeX-auto-regexp-list
@@ -8129,7 +8192,8 @@ function would return non-nil and `(match-string 1)' 
would return
                                    (copy-sequence
                                     plain-TeX-auto-regexp-list))))
 
-  (LaTeX-set-paragraph-start)
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (LaTeX-set-paragraph-start)
   (setq paragraph-separate
         (concat
          "[ \t]*%*[ \t]*\\("
@@ -8145,7 +8209,8 @@ function would return non-nil and `(match-string 1)' 
would return
   (setq-local beginning-of-defun-function #'LaTeX-find-matching-begin)
   (setq-local end-of-defun-function       #'LaTeX-find-matching-end)
 
-  (LaTeX-indent-commands-regexp-make)
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (LaTeX-indent-commands-regexp-make)
 
   ;; Standard Emacs completion-at-point support.  We append the entry
   ;; in order to let `TeX--completion-at-point' be first in the list:
@@ -8866,22 +8931,36 @@ function would return non-nil and `(match-string 1)' 
would return
             (replace-match "\\\\input{" nil nil)))))
   (TeX-normal-mode nil))
 
+;; This function is no longer used; We leave it for compatibility.
 (defun LaTeX-env-beginning-pos-col ()
   "Return a cons: (POINT . COLUMN) for current environment's beginning."
   (save-excursion
     (LaTeX-find-matching-begin)
     (cons (point) (current-column))))
 
+;; This makes difference from `LaTeX-env-beginning-pos-col' when
+;; something non-whitespace sits before the \begin{foo}.  (bug#65648)
+(defun LaTeX-env-beginning-pos-indent ()
+  "Return a cons: (POINT . INDENT) for current environment's beginning.
+INDENT is the indent of the line containing POINT."
+  (save-excursion
+    ;; FIXME: There should be some fallback mechanism in case that the
+    ;; next `backward-up' fails.  (Such fail can occur in document
+    ;; with temporarily broken structure due to in-progress editing
+    ;; process.)
+    (LaTeX-backward-up-environment)
+    (cons (point) (LaTeX-current-indentation))))
+
 (defun LaTeX-hanging-ampersand-position (&optional pos col)
   "Return indent column for a hanging ampersand (that is, ^\\s-*&).
-When you know the position and column of the beginning of the
-current environment, supply them as optional arguments POS and
-COL for efficiency."
+When you know the position of the beginning of the current
+environment and indent of its line, supply them as optional
+arguments POS and COL for efficiency."
   (cl-destructuring-bind
       (beg-pos . beg-col)
       (if pos
           (cons pos col)
-        (LaTeX-env-beginning-pos-col))
+        (LaTeX-env-beginning-pos-indent))
     (let ((cur-pos (point)))
       (save-excursion
         (if (and (search-backward "\\\\" beg-pos t)
@@ -8912,7 +8991,7 @@ COL for efficiency."
   "Return indent column for the current tabular-like line."
   (cl-destructuring-bind
       (beg-pos . beg-col)
-      (LaTeX-env-beginning-pos-col)
+      (LaTeX-env-beginning-pos-indent)
     (let ((tabular-like-end-regex
            (format "\\\\end{%s}"
                    (regexp-opt
diff --git a/plain-tex.el b/plain-tex.el
index 0800b2f3da..b4c78fe489 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -135,7 +135,13 @@ of `plain-TeX-mode-hook'."
   (add-hook 'tool-bar-mode-hook #'plain-TeX-maybe-install-toolbar nil t)
   (plain-TeX-maybe-install-toolbar)
   (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook)
-  (TeX-set-mode-name))
+  (TeX-set-mode-name)
+  ;; Complete style initialization in buffers which don't visit files
+  ;; and which are therefore missed by the setting of `find-file-hook'
+  ;; in `VirTeX-common-initialization'.  This is necessary for
+  ;; `xref-find-references', for example. (bug#65912)
+  (unless buffer-file-truename
+    (TeX-update-style)))
 
 (defun plain-TeX-common-initialization ()
   "Common initialization for plain TeX like modes."
@@ -308,7 +314,13 @@ of `AmS-TeX-mode-hook'."
   (setq TeX-base-mode-name "AmS-TeX")
   (setq TeX-command-default "AmSTeX")
   (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'AmS-TeX-mode-hook)
-  (TeX-set-mode-name))
+  (TeX-set-mode-name)
+  ;; Complete style initialization in buffers which don't visit files
+  ;; and which are therefore missed by the setting of `find-file-hook'
+  ;; in `VirTeX-common-initialization'.  This is necessary for
+  ;; `xref-find-references', for example. (bug#65912)
+  (unless buffer-file-truename
+    (TeX-update-style)))
 
 (defcustom AmSTeX-clean-intermediate-suffixes
   TeX-clean-default-intermediate-suffixes
diff --git a/preview-latex.info b/preview-latex.info
index 9d71236d45..d0fcff9691 100644
--- a/preview-latex.info
+++ b/preview-latex.info
@@ -2,7 +2,7 @@ This is preview-latex.info, produced by makeinfo version 7.0.3 
from
 preview-latex.texi.
 
 This manual is for preview-latex, a LaTeX preview mode for AUCTeX
-(version 13.2.1 from 2023-07-20).
+(version 13.2.1.2023-10-11 from 2023-10-11).
 
    Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2017-2019, 2021 Free
 Software Foundation, Inc.
@@ -1922,7 +1922,7 @@ Appendix C Copying this Manual
 The copyright notice for this manual is:
 
    This manual is for preview-latex, a LaTeX preview mode for AUCTeX
-(version 13.2.1 from 2023-07-20).
+(version 13.2.1.2023-10-11 from 2023-10-11).
 
    Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2017-2019, 2021 Free
 Software Foundation, Inc.
@@ -2550,44 +2550,44 @@ Index
 
 
 Tag Table:
-Node: Top964
-Node: Copying2244
-Node: Introduction2698
-Node: What use is it?3372
-Node: Activating preview-latex4769
-Node: Getting started5534
-Node: Basic modes of operation7521
-Node: More documentation8754
-Node: Availability9643
-Node: Contacts10370
-Node: Installation11659
-Node: Keys and lisp11860
-Node: Simple customization19139
-Node: Known problems24963
-Node: Font problems with Dvips25849
-Node: Too small bounding boxes27059
-Node: x-symbol interoperation28483
-Node: Middle-clicks paste instead of toggling29907
-Node: No images are displayed with gs 9.27 and earlier30604
-Node: Black texts are too hard to read on dark background33362
-Node: For advanced users34019
-Node: The LaTeX style file34478
-Node: Package options37064
-Node: Provided commands48290
-Node: The Emacs interface55897
-Node: The preview images64861
-Node: Misplaced previews68746
-Node: ToDo72274
-Node: Frequently Asked Questions77111
-Node: Introduction to FAQ77434
-Node: Requirements77773
-Node: Installation Trouble79759
-Node: Customization82051
-Node: Troubleshooting85179
-Node: Other formats87693
-Node: Copying this Manual89042
-Node: GNU Free Documentation License89991
-Node: Index115318
+Node: Top975
+Node: Copying2255
+Node: Introduction2709
+Node: What use is it?3383
+Node: Activating preview-latex4780
+Node: Getting started5545
+Node: Basic modes of operation7532
+Node: More documentation8765
+Node: Availability9654
+Node: Contacts10381
+Node: Installation11670
+Node: Keys and lisp11871
+Node: Simple customization19150
+Node: Known problems24974
+Node: Font problems with Dvips25860
+Node: Too small bounding boxes27070
+Node: x-symbol interoperation28494
+Node: Middle-clicks paste instead of toggling29918
+Node: No images are displayed with gs 9.27 and earlier30615
+Node: Black texts are too hard to read on dark background33373
+Node: For advanced users34030
+Node: The LaTeX style file34489
+Node: Package options37075
+Node: Provided commands48301
+Node: The Emacs interface55908
+Node: The preview images64872
+Node: Misplaced previews68757
+Node: ToDo72285
+Node: Frequently Asked Questions77122
+Node: Introduction to FAQ77445
+Node: Requirements77784
+Node: Installation Trouble79770
+Node: Customization82062
+Node: Troubleshooting85190
+Node: Other formats87704
+Node: Copying this Manual89053
+Node: GNU Free Documentation License90013
+Node: Index115340
 
 End Tag Table
 
diff --git a/preview.el b/preview.el
index 758c7cfae7..bc77408217 100644
--- a/preview.el
+++ b/preview.el
@@ -2290,13 +2290,14 @@ all previews."
 (defun preview-kill-buffer-cleanup (&optional buf)
   "This is a cleanup function just for use in hooks.
 Cleans BUF or current buffer.  The difference to
-`preview-clearout-buffer' is that previews
-associated with the last buffer modification time are
-kept."
-  (with-current-buffer (or buf (current-buffer))
-    (save-restriction
-      (widen)
-      (preview-clearout (point-min) (point-max) (visited-file-modtime)))))
+`preview-clearout-buffer' is that previews associated with the
+last buffer modification time are kept."
+  ;; Do nothing for indirect buffers. (bug#65462)
+  (unless (buffer-base-buffer (or buf (setq buf (current-buffer))))
+    (with-current-buffer buf
+      (save-restriction
+        (widen)
+        (preview-clearout (point-min) (point-max) (visited-file-modtime))))))
 
 (add-hook 'kill-buffer-hook #'preview-kill-buffer-cleanup)
 (add-hook 'before-revert-hook #'preview-kill-buffer-cleanup)
diff --git a/style/biblatex.el b/style/biblatex.el
index 3254ce8566..52e9e2ec98 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/fancyvrb.el b/style/fancyvrb.el
index 56f5172b83..530b0621c6 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/tests/context/context-test.el b/tests/context/context-test.el
index cc7c8d549f..4eeab4b67a 100644
--- a/tests/context/context-test.el
+++ b/tests/context/context-test.el
@@ -24,12 +24,6 @@
 (require 'ert)
 (require 'context)
 
-;; We need to ensure that font-lock has put the syntax properties
-;; already which won't happen in batch mode.  So trigger font-lock
-;; immediately.
-(define-advice ConTeXt-mode-common-initialization (:after ())
-  (font-lock-ensure))
-
 (AUCTeX-set-ert-path
  'ConTeXt-indent-test/in
  "context-indentation-in.tex"
diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 40f9633a1a..94150ac04d 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -27,12 +27,6 @@
 (defvar font-lock-beg)
 (defvar font-lock-end)
 
-;; We need to ensure that font-lock has put the syntax properties
-;; already which won't happen in batch mode.  So trigger font-lock
-;; immediately.
-(define-advice LaTeX-common-initialization (:after ())
-  (font-lock-ensure))
-
 (ert-deftest font-latex-three-dollars ()
   "Test three consecutive dollar is ignored."
   ;; When the function `font-latex-match-dollar-math' encounters three
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index fbd64e0953..13cbf4820d 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -24,12 +24,6 @@
 (require 'ert)
 (require 'latex)
 
-;; We need to ensure that font-lock has put the syntax properties
-;; already which won't happen in batch mode.  So trigger font-lock
-;; immediately.
-(define-advice LaTeX-common-initialization (:after ())
-  (font-lock-ensure))
-
 (AUCTeX-set-ert-path
  'LaTeX-indent-tabular-test/in
  "tabular-in.tex"
@@ -174,11 +168,10 @@
   (should (string=
            (with-temp-buffer
              (insert-file-contents LaTeX-filling/in)
-             (LaTeX-mode)
              (let ((fill-column 70)
                    (LaTeX-shortvrb-chars '(?\"))
                    (TeX-parse-self t))
-               (TeX-update-style t)
+               (LaTeX-mode)
                (search-forward "Lorem")
                (fill-paragraph)
 
@@ -416,9 +409,8 @@ backend=biber % here is a comment
 
       ;; dvipdfmx option should not trigger `TeX-PDF-from-DVI' for
       ;; XeLaTeX document
-      (latex-mode)
       (let ((TeX-engine 'xetex))
-        (TeX-update-style))
+        (LaTeX-mode))
       (should TeX-PDF-mode)
       (should (not (TeX-PDF-from-DVI)))
       (should (not (member "dvipdfmx" TeX-active-styles)))
diff --git a/tests/latex/tabular-out.tex b/tests/latex/tabular-out.tex
index 66de0641fa..113c1d1299 100644
--- a/tests/latex/tabular-out.tex
+++ b/tests/latex/tabular-out.tex
@@ -45,11 +45,11 @@
 \begin{equation}
   \begin{aligned}
     &n u m=\left[\begin{array}{ll}
-                   2 & 25
-                 \end{array}\right] \\
+      2 & 25
+    \end{array}\right] \\
     &d e n=\left[\begin{array}{lll}
-                   1 & 4 & 25
-                 \end{array}\right]
+      1 & 4 & 25
+    \end{array}\right]
   \end{aligned}
 \end{equation}
 
diff --git a/tests/latex/texmathp-test.el b/tests/latex/texmathp-test.el
index 121af22c7f..a18df63acd 100644
--- a/tests/latex/texmathp-test.el
+++ b/tests/latex/texmathp-test.el
@@ -55,7 +55,6 @@
     (should-not (with-temp-buffer
                   (insert "a $b$ \\verb|$| c ")
                   (LaTeX-mode)
-                  (font-lock-ensure)
                   (texmathp)))
 
     (should-not (with-temp-buffer
@@ -67,7 +66,6 @@ $
 \\end{verbatim}
 c")
                   (LaTeX-mode)
-                  (font-lock-ensure)
                   (texmathp)))))
 
 ;;; texmathp-test.el ends here
diff --git a/tex-fold.el b/tex-fold.el
index 6f74f75a3c..e3857460f5 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -1,6 +1,6 @@
 ;;; tex-fold.el --- Fold TeX macros.  -*- 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
@@ -111,6 +111,8 @@ the respective macro argument.
 If the first element is a function symbol, the function will be
 called with all mandatory arguments of the macro and the result
 of the function call will be used as a replacement for the macro.
+Such functions typically return a string, but may also return the
+symbol `abort' to indicate that the macro should not be folded.
 
 Setting this variable does not take effect immediately.  Use
 Customize or reset the mode."
@@ -131,7 +133,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 +148,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 +515,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))
@@ -794,31 +798,40 @@ That means, put respective properties onto overlay OV."
          (display-string (if (listp computed) (car computed) computed))
          ;; (face (when (listp computed) (cadr computed)))
          )
-    ;; Do nothing if the overlay is empty.
-    (when (and ov-start ov-end)
-      ;; Cater for zero-length display strings.
-      (when (string= display-string "") (setq display-string 
TeX-fold-ellipsis))
-      ;; Add a linebreak to the display string and adjust the overlay end
-      ;; in case of an overfull line.
-      (when (TeX-fold-overfull-p ov-start ov-end display-string)
-        (setq display-string (concat display-string "\n"))
-        (move-overlay ov ov-start (save-excursion
-                                    (goto-char ov-end)
-                                    (skip-chars-forward " \t")
-                                    (point))))
-      (overlay-put ov 'mouse-face 'highlight)
-      (when font-lock-mode
-        ;; Add raise adjustment for superscript and subscript.
-        ;; (bug#42209)
-        (setq display-string
-              (propertize display-string
-                          'display (get-text-property ov-start 'display))))
-      (overlay-put ov 'display display-string)
-      (when font-lock-mode
-        (overlay-put ov 'face TeX-fold-folded-face))
-      (unless (zerop TeX-fold-help-echo-max-length)
-        (overlay-put ov 'help-echo (TeX-fold-make-help-echo
-                                    (overlay-start ov) (overlay-end ov)))))))
+
+    (if (eq computed 'abort)
+        ;; Abort folding if computed result is the symbol `abort'.
+        ;; This allows programmatic customization.
+        ;; Suggested by Paul Nelson <ultrono@gmail.com>.
+        ;; <URL:https://lists.gnu.org/r/auctex/2023-08/msg00026.html>
+        (progn (delete-overlay ov)
+               t ; so that `TeX-fold-dwim' "gives up"
+               )
+      ;; Do nothing if the overlay is empty.
+      (when (and ov-start ov-end)
+        ;; Cater for zero-length display strings.
+        (when (string= display-string "") (setq display-string 
TeX-fold-ellipsis))
+        ;; Add a linebreak to the display string and adjust the overlay end
+        ;; in case of an overfull line.
+        (when (TeX-fold-overfull-p ov-start ov-end display-string)
+          (setq display-string (concat display-string "\n"))
+          (move-overlay ov ov-start (save-excursion
+                                      (goto-char ov-end)
+                                      (skip-chars-forward " \t")
+                                      (point))))
+        (overlay-put ov 'mouse-face 'highlight)
+        (when font-lock-mode
+          ;; Add raise adjustment for superscript and subscript.
+          ;; (bug#42209)
+          (setq display-string
+                (propertize display-string
+                            'display (get-text-property ov-start 'display))))
+        (overlay-put ov 'display display-string)
+        (when font-lock-mode
+          (overlay-put ov 'face TeX-fold-folded-face))
+        (unless (zerop TeX-fold-help-echo-max-length)
+          (overlay-put ov 'help-echo (TeX-fold-make-help-echo
+                                      (overlay-start ov) (overlay-end 
ov))))))))
 
 (defun TeX-fold-show-item (ov)
   "Show a single LaTeX macro or environment.
diff --git a/tex-info.el b/tex-info.el
index 8bef02a16b..f1e97746e0 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -31,6 +31,9 @@
 
 (require 'texinfo)
 
+;; Silence the compiler for variables:
+(defvar outline-heading-alist)
+
 ;;; Environments:
 (defvar Texinfo-environment-list
   '(("cartouche") ("command") ("copying") ("defcv") ("deffn") ("defivar")
@@ -520,6 +523,7 @@ is assumed by default."
     (define-key map "\C-c\C-u\C-n"   #'texinfo-update-node)
     (define-key map "\C-c\C-u\C-e"   #'texinfo-every-node-update)
     (define-key map "\C-c\C-u\C-a"   #'texinfo-all-menus-update)
+    (define-key map "\C-c\C-u\C-d"   #'texinfo-start-menu-description)
 
     ;; Simulating LaTeX-mode
     (define-key map "\C-c\C-e" #'Texinfo-environment)
@@ -650,11 +654,12 @@ value of `Texinfo-mode-hook'."
   (use-local-map Texinfo-mode-map)
   (set-syntax-table texinfo-mode-syntax-table)
 
-  (set (make-local-variable 'page-delimiter)
-       (concat
-        "^@node [ \t]*[Tt]op\\|^@\\("
-        texinfo-chapter-level-regexp
-        "\\)"))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'page-delimiter)
+  ;;      (concat
+  ;;       "^@node [ \t]*[Tt]op\\|^@\\("
+  ;;       texinfo-chapter-level-regexp
+  ;;       "\\)"))
   (set (make-local-variable 'require-final-newline) mode-require-final-newline)
   (set (make-local-variable 'indent-tabs-mode) nil)
   (set (make-local-variable 'paragraph-separate)
@@ -676,13 +681,13 @@ value of `Texinfo-mode-hook'."
   (set (make-local-variable 'syntax-propertize-function)
        texinfo-syntax-propertize-function)
 
-  ;; Outline settings.
-  (setq-local outline-heading-alist
-             (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
-                     texinfo-section-list))
-  (setq-local outline-regexp
-             (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
-                     "\\>"))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (setq-local outline-heading-alist
+  ;;             (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
+  ;;                 texinfo-section-list))
+  ;; (setq-local outline-regexp
+  ;;             (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
+  ;;                 "\\>"))
 
   ;; Mostly AUCTeX stuff
   (set (make-local-variable 'TeX-command-current) #'TeX-command-master)
@@ -697,9 +702,10 @@ value of `Texinfo-mode-hook'."
   (setq TeX-trailer-start (format "^%s$"
                                   (regexp-quote (concat TeX-esc "bye"))))
 
-  (set (make-local-variable 'TeX-complete-list)
-       (list (list "@\\([a-zA-Z]*\\)" 1 #'TeX-symbol-list-filtered nil)
-             (list "" TeX-complete-word)))
+  ;; Moved after `run-mode-hooks'. (bug#65750)
+  ;; (set (make-local-variable 'TeX-complete-list)
+  ;;      (list (list "@\\([a-zA-Z]*\\)" 1 #'TeX-symbol-list-filtered nil)
+  ;;            (list "" TeX-complete-word)))
 
   (set (make-local-variable 'TeX-font-list) Texinfo-font-list)
   (set (make-local-variable 'TeX-font-replace-function)
@@ -865,6 +871,31 @@ value of `Texinfo-mode-hook'."
       (Texinfo-reftex-hook))
 
   (run-mode-hooks 'text-mode-hook 'Texinfo-mode-hook)
+
+  ;; Don't overwrite the value the user set by hooks or file
+  ;; (directory) variables.
+  (or (local-variable-p 'page-delimiter)
+      (setq-local page-delimiter
+                  (concat
+                   "^@node [ \t]*[Tt]op\\|^@\\("
+                   texinfo-chapter-level-regexp
+                   "\\)")))
+
+  ;; Outline settings.
+  (or (local-variable-p 'outline-heading-alist)
+      (setq-local outline-heading-alist
+                 (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
+                         texinfo-section-list)))
+  (or (local-variable-p 'outline-regexp)
+      (setq-local outline-regexp
+                 (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
+                         "\\>")))
+
+  (or (local-variable-p 'TeX-complete-list)
+      (setq-local TeX-complete-list
+                  (list (list "@\\([a-zA-Z]*\\)" 1 #'TeX-symbol-list-filtered 
nil)
+                        (list "" TeX-complete-word))))
+
   (TeX-set-mode-name))
 
 (defcustom Texinfo-clean-intermediate-suffixes
diff --git a/tex-jp.el b/tex-jp.el
index 8428c3793a..8437ae70fc 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -1,6 +1,6 @@
 ;;; tex-jp.el --- Support for Japanese TeX.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2001-2008, 2012-2013, 2016-2018, 2020-2022
+;; Copyright (C) 1999, 2001-2008, 2012-2013, 2016-2018, 2020-2023
 ;;   Free Software Foundation, Inc.
 
 ;; Author:     KOBAYASHI Shinji <koba@flab.fujitsu.co.jp>,
@@ -449,7 +449,7 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
     ;; に 2 回行われてしまう。
     (add-hook 'TeX-update-style-hook
               #'japanese-LaTeX-guess-engine nil t)
-    (setq LaTeX-default-style japanese-LaTeX-default-style)
+    (setq-local LaTeX-default-style japanese-LaTeX-default-style)
 
     (when (and (fboundp 'font-latex-add-keywords)
                (eq TeX-install-font-lock 'font-latex-setup))
@@ -497,7 +497,7 @@ Set `japanese-TeX-mode' to t, and enter `TeX-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
@@ -517,6 +517,9 @@ overwrite the value already set locally."
 ;;; Support for various self-insert-command
 
 (defalias 'japanese-TeX-self-insert-command
+  ;; FIXME: `can-n-egg-self-insert-command' and
+  ;; `egg-self-insert-command' must be much obsolete because
+  ;; can-n-egg.el and egg.el are no longer available.
   (cond ((fboundp 'can-n-egg-self-insert-command)
          #'can-n-egg-self-insert-command)
         ((fboundp 'egg-self-insert-command)
@@ -526,13 +529,15 @@ overwrite the value already set locally."
         (t
          #'self-insert-command)))
 
-(defun TeX-insert-punctuation ()
+(defun japanese-TeX-insert-punctuation ()
   "Insert point or comma, cleaning up preceding space."
   (interactive)
   (expand-abbrev)
   (if (TeX-looking-at-backward "\\\\/\\(}+\\)" 50)
       (replace-match "\\1" t))
   (call-interactively #'japanese-TeX-self-insert-command))
+(advice-add 'TeX-insert-punctuation :override
+            #'japanese-TeX-insert-punctuation)
 
 ;;; Error Messages
 
diff --git a/tex-site.el b/tex-site.el
index 090b2162d6..40d1397007 100644
--- a/tex-site.el
+++ b/tex-site.el
@@ -41,6 +41,8 @@
 (when (< emacs-major-version 26)
   (error "AUCTeX requires Emacs 26.1 or later"))
 
+(declare-function BibTeX-auto-store "latex")
+
 (unless (or (fboundp 'TeX-modes-set)     ;Avoid inf-looping.
             (fboundp 'TeX-tex-mode))     ;auctex-autoloads is not loaded.
   ;; Try and support the case where someone loads tex-site.el or
@@ -127,11 +129,11 @@ set it with `TeX-modes-set'."
   :set #'TeX-modes-set
   :initialize #'custom-initialize-reset)
 
-(defconst AUCTeX-version "13.2.1"
+(defconst AUCTeX-version "13.2.1.2023-10-11"
   "AUCTeX version.
 If not a regular release, the date of the last change.")
 
-(defconst AUCTeX-date "2023-07-20"
+(defconst AUCTeX-date "2023-10-11"
   "AUCTeX release date using the ISO 8601 format, yyyy-mm-dd.")
 
 ;; Store bibitems when saving a BibTeX buffer
diff --git a/tex-site.el.in b/tex-site.el.in
index 9338cc3c5b..0b5852534f 100644
--- a/tex-site.el.in
+++ b/tex-site.el.in
@@ -41,6 +41,8 @@
 (when (< emacs-major-version 26)
   (error "AUCTeX requires Emacs 26.1 or later"))
 
+(declare-function BibTeX-auto-store "latex")
+
 (unless (or (fboundp 'TeX-modes-set)     ;Avoid inf-looping.
             (fboundp 'TeX-tex-mode))     ;auctex-autoloads is not loaded.
   ;; Try and support the case where someone loads tex-site.el or
diff --git a/tex-style.el b/tex-style.el
index d273ea082b..615f49a1f7 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 7974698069..6ab2181654 100644
--- a/tex.el
+++ b/tex.el
@@ -3779,6 +3779,9 @@ The algorithm is as follows:
   ;;  (aset buffer-display-table ?\t (apply 'vector (append "<TAB>" nil)))
 
   ;; Symbol & length completion.
+  ;; We have to move the setup of `TeX-complete-list' after
+  ;; `run-mode-hooks' in order to reflect the file local customization
+  ;; of `TeX-insert-braces' and `TeX-complete-word'.
   (setq-local TeX-complete-list
               (list (list "\\\\\\([a-zA-Z]*\\)"
                           1
@@ -4267,21 +4270,16 @@ alter the numbering of any ordinary, non-shy groups.")
 
 (defvar plain-TeX-auto-regexp-list
   (let ((token TeX-token-char))
-    `((,(concat "\\\\def\\\\\\(" token "+\\)[^a-zA-Z@]")
+    `((,(concat "\\\\\\(?:def\\|let\\)\\\\\\(" token "+\\)[^a-zA-Z@]")
        1 TeX-auto-symbol-check)
-      (,(concat "\\\\let\\\\\\(" token "+\\)[^a-zA-Z@]")
-       1 TeX-auto-symbol-check)
-      (,(concat "\\\\font\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol)
-      (,(concat "\\\\chardef\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol)
-      (,(concat "\\\\new\\(?:count\\|dimen\\|muskip\\|skip\\)\\\\\\(" token
-                "+\\)[^a-zA-Z@]")
+      (,(concat "\\\\"
+                (regexp-opt '("font" "newfont" "chardef" "mathchardef"
+                              "newcount" "newdimen" "newmuskip" "newskip"))
+                "{?\\\\\\(" token "+\\)}?[^a-zA-Z@]")
        1 TeX-auto-symbol)
-      (,(concat "\\\\newfont{?\\\\\\(" token "+\\)}?") 1 TeX-auto-symbol)
       (,(concat "\\\\typein\\[\\\\\\(" token "+\\)\\]") 1 TeX-auto-symbol)
       ("\\\\input +\\([^#}%\"\\\n\r]+?\\)\\(?:\\.[^#}%/\"\\.\n\r]+\\)?"
-       1 TeX-auto-file)
-      (,(concat "\\\\mathchardef\\\\\\(" token "+\\)[^a-zA-Z@]")
-       1 TeX-auto-symbol)))
+       1 TeX-auto-file)))
   "List of regular expression matching common plain TeX macro definitions.")
 
 (defvar TeX-auto-full-regexp-list plain-TeX-auto-regexp-list
@@ -4779,6 +4777,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."
@@ -5230,8 +5238,16 @@ Brace insertion is only done if point is in a math 
construct and
       (progn
         (easy-menu-add-item
          nil
-         ;; Ugly hack because docTeX mode uses the LaTeX menu.
-         (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name))
+         ;; Ugly hack because docTeX mode uses the LaTeX menu and
+         ;; ConTeXt mode uses "ConTeXt-en" or "ConTeXt-nl" for the
+         ;; value of `TeX-base-mode-name'.
+         ;; XXX: Perhaps we should have a new variable holding the
+         ;; mode-specific menu title?
+         (list
+          (cond
+           ((eq major-mode 'doctex-mode) "LaTeX")
+           ((eq major-mode 'context-mode) "ConTeXt")
+           (t TeX-base-mode-name)))
          (or TeX-customization-menu
              (setq TeX-customization-menu
                    (customize-menu-create 'AUCTeX "Customize AUCTeX")))))
@@ -5475,21 +5491,22 @@ additional characters."
                                           '(?\{ ?\} ?\\))
                                     (TeX-in-comment))))
                  (forward-char)
-                 (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)
-                          ;; ?\\ in verbatim constructs doesn't escape
-                          ;; the next char
-                          (unless (TeX-verbatim-p)
-                            (forward-char))
-                          t))))))
+                 ;; 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)))))))
       count)))
 
 ;;; Navigation
@@ -10146,6 +10163,7 @@ forward, if negative)."
 (define-derived-mode TeX-error-overview-mode tabulated-list-mode
                      "TeX errors"
   "Major mode for listing TeX errors."
+  :syntax-table nil :abbrev-table nil :interactive nil
   (setq tabulated-list-format [("File" 25 nil)
                                ("Line" 4 nil :right-align t)
                                ("Type" 7 nil)
@@ -10248,7 +10266,8 @@ warnings and bad boxes"
 
 ;;; Output mode
 
-(define-derived-mode TeX-special-mode special-mode "TeX")
+(define-derived-mode TeX-special-mode special-mode "TeX"
+  :syntax-table nil :abbrev-table nil :interactive nil)
 
 (defvar TeX-output-mode-map
   (let ((map (make-sparse-keymap)))
@@ -10271,7 +10290,7 @@ warnings and bad boxes"
 (define-derived-mode TeX-output-mode TeX-special-mode "TeX Output"
   "Major mode for viewing TeX output.
 \\{TeX-output-mode-map} "
-  :syntax-table nil
+  :syntax-table nil :abbrev-table nil :interactive nil
   (set (make-local-variable 'revert-buffer-function)
        #'TeX-output-revert-buffer)
   ;; special-mode makes it read-only which prevents input from TeX.




reply via email to

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