auctex-diffs
[Top][All Lists]
Advanced

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

main ecb6c62e 255/257: Merge remote-tracking branch 'origin/master' into


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

branch: main
commit ecb6c62e85c6ab8a586d7a32ae2ddb0c9a6aca16
Merge: 79c984e1 07c2cf38
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 .dir-locals.el    |  13 +++-
 NEWS.org          |  43 +++++++++++
 doc/auctex.texi   |  51 +++++++++++--
 doc/changes.texi  |   5 ++
 latex.el          |   4 +-
 preview.el        |  69 +++++++++++++-----
 style/biblatex.el | 208 +++++++++++++++++++++++++++++++++++++++++-------------
 style/ltx-base.el |  11 ++-
 style/verbatim.el |   9 ++-
 tex-fold.el       |  88 ++++++++++++++++++++---
 tex.el            |  17 +++--
 11 files changed, 426 insertions(+), 92 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 2e19675b..aa4f0335 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,10 +1,17 @@
 ;;; Directory Local Variables
 ;;; For more information see (info "(emacs) Directory Variables")
 
-((nil . ((bug-reference-url-format . "https://debbugs.gnu.org/%s";)
-         (fill-column . 70)
+((nil . ((tab-width . 8)
          (sentence-end-double-space . t)
-         (tab-width . 8)))
+         (fill-column . 72)
+         (emacs-lisp-docstring-fill-column . 72)
+         (bug-reference-url-format . "https://debbugs.gnu.org/%s";)
+         (diff-add-log-use-relative-names . t)
+         (vc-prepare-patches-separately . nil)))
+ (log-edit-mode . ((log-edit-font-lock-gnu-style . t)
+                   (log-edit-setup-add-author . t)
+                   (vc-git-log-edit-summary-target-len . 50)
+                   (fill-column . 64)))
  (change-log-mode . ((mode . bug-reference)
                      (add-log-time-zone-rule . t)
                      (fill-column . 74)))
diff --git a/NEWS.org b/NEWS.org
new file mode 100644
index 00000000..1c741b10
--- /dev/null
+++ b/NEWS.org
@@ -0,0 +1,43 @@
+#+TITLE: AUCTeX NEWS -- History of notable and user-visible changes
+#+AUTHOR: AUCTeX Maintenance Team
+#+LANGUAGE: en
+#+OPTIONS: num:nil toc:nil
+# Copyright (C) 2024 Free Software Foundation, Inc.
+# License: GNU General Public License 3
+# The format is based on [[https://keepachangelog.com/en/1.1.0/][Keep a 
Changelog]]
+
+* [Unreleased]
+
+** Added
+
+- Add preliminary support for processing files with latexmk.  Support
+  for =dvipdfmx= and the choice for viewer after compilation are not
+  optimal, yet.  Overall, the support comes close to what the
+  =auctex-latexmk= library provides.
+- Support query and insert of ~mcite~ compatibility macros
+  (=style/biblatex.el=).
+- Support the =\verbatiminput*= macro (=style/verbatim.el=).
+- Add new custom variable ~TeX-fold-auto-reveal~ which contols how the
+  original source text is revealed when user clicks the folded portion
+  by mouse.
+
+* [14.0.4] - 2024-03-31
+
+** Added
+
+- Support completion for many commands described in =clsguide.tex=,
+  =fntguide.tex= and =usrguide.tex=.
+- Provide new custom variable ~LaTeX-flymake-chktex-options~ to enable
+  or disable specific warnings of =chktex= backend used by Flymake.
+- Provide new custom variable ~TeX-kill-process-without-query~ which
+  controls if user is asked before aborting a running process for a
+  TeX document.
+
+** Fixed
+
+- Improve guessing names for headers used in Imenu.
+
+** Removed
+
+- Revert usage of ~:local~ tag inside ~defcustom~.  This tag isn't
+  handled correctly in Emacs 27.1 and breaks AUCTeX.
diff --git a/doc/auctex.texi b/doc/auctex.texi
index b499c63b..066dfbb0 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2649,6 +2649,12 @@ When this variable is non-@code{nil} and there is an 
active regione, text
 around the mark will be kept unfolded.
 @end defopt
 
+@defopt TeX-fold-region-functions
+This variable is a list of functions which allow the user, or external
+packages, to fold additional @LaTeX{} constructs beyond those supported by
+default.
+@end defopt
+
 @deffn Command TeX-fold-region
 @kindex C-c C-o C-r
 (@kbd{C-c C-o C-r}) Hide all configured macros in the marked region.
@@ -2660,6 +2666,12 @@ around the mark will be kept unfolded.
 containing point.
 @end deffn
 
+@deffn Command TeX-fold-section
+@kindex C-c C-o C-p
+(@kbd{C-c C-o C-p}) Hide all configured macros in the section
+containing point.
+@end deffn
+
 @deffn Command TeX-fold-macro
 @kindex C-c C-o C-m
 (@kbd{C-c C-o C-m}) Hide the macro on which point currently is located.
@@ -2712,6 +2724,12 @@ marked region.
 paragraph containing point.
 @end deffn
 
+@deffn Command TeX-fold-clearout-section
+@kindex C-c C-o p
+(@kbd{C-c C-o p}) Permanently unfold all macros and environments in the
+section containing point.
+@end deffn
+
 @deffn Command TeX-fold-clearout-item
 @kindex C-c C-o i
 (@kbd{C-c C-o i}) Permanently show the macro or environment on which
@@ -2761,10 +2779,11 @@ respective mandatory argument of a @LaTeX{} macro will 
be used as the
 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.
+with all mandatory arguments of the macro, and with point positioned at
+the beginning of the macro.  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
@@ -2826,6 +2845,30 @@ Maximum length of original text displayed in a tooltip 
or the echo area
 for folded content.  Set it to zero in order to disable this feature.
 @end defopt
 
+@defopt TeX-fold-auto-reveal
+This option determines the auto-reveal behavior when the point enters the
+folded portion of the buffer.  Possible values and the corresponding
+behaviors are:
+@itemize
+@item
+@code{t}: @AUCTeX{} always opens the folded expression and reveal the
+original source text.
+@item
+@code{nil}: @AUCTeX{} never reveals.
+@item
+@var{SYMBOL}: The value of @var{SYMBOL} is used as a boolean flag.  If
+@var{SYMBOL} isn't bound as a variable, it is treated as @code{nil}.
+@item
+Cons cell @code{(@var{FUNCTION} . @var{ARGUMENTS})}: @AUCTeX{} calls the
+@var{FUNCTION} with arbitrary number of @var{ARGUMENTS}.  The return value
+is regarded as a boolean flag.
+@end itemize
+
+It has a reasonable default value to reveal when the point enters the
+folded portion with @kbd{@key{left}}, @kbd{@key{right}}, @kbd{C-b},
+@kbd{C-f} or mouse click under standard key binding.
+@end defopt
+
 
 @node Outline
 @section Outlining the Document
diff --git a/doc/changes.texi b/doc/changes.texi
index 2ac2ee05..098195ac 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -182,6 +182,11 @@ The boolean custom variable 
@code{TeX-kill-process-without-query} can be
 used to disable the user query before aborting a running process for a
 @TeX{} document.  Default is @code{nil}.
 
+@item
+In Fold mode, the original source text is revealed when you click the
+folded portion by mouse.  You can customize the detailed behavior by
+new customize option @code{TeX-fold-auto-reveal}.
+
 @item
 @AUCTeX{} now requires GNU Emacs 27.1 or higher.
 @end itemize
diff --git a/latex.el b/latex.el
index cd87bd99..c5965b05 100644
--- a/latex.el
+++ b/latex.el
@@ -8091,7 +8091,7 @@ taken."
     (narrow-to-region (line-beginning-position -40)
                       (line-beginning-position  40))
     (let ((args (or args (LaTeX-completion-macro-delimiters)))
-          (parse-sexp-ignore-comments t))
+          (parse-sexp-ignore-comments (not (eq major-mode 'docTeX-mode))))
       (condition-case nil
           (with-syntax-table (apply #'TeX-search-syntax-table args)
             (scan-lists (point) 1 1))
@@ -8941,7 +8941,9 @@ function would return non-nil and `(match-string 1)' 
would return
      '("fontencoding" "Encoding")
      '("fontfamily" "Family")
      '("fontseries" "Series")
+     '("fontseriesforce" "Series")
      '("fontshape" "Shape")
+     '("fontshapeforce" "Shape")
      '("fontsize" "Size" "Baselineskip")
      "selectfont"
      '("usefont" "Encoding" "Family" "Series" "Shape")
diff --git a/preview.el b/preview.el
index d0bb67f2..2f59a04f 100644
--- a/preview.el
+++ b/preview.el
@@ -2238,7 +2238,7 @@ with a `timestamp' property of it are kept."
 (defun preview-clearout-section ()
   "Clearout previews from LaTeX section."
   (interactive)
-  (save-excursion
+  (save-mark-and-excursion
     (LaTeX-mark-section)
     (preview-clearout (region-beginning) (region-end))))
 
@@ -3066,14 +3066,14 @@ to add the preview functionality."
         ["(or toggle) at point" preview-at-point]
         ["for environment" preview-environment]
         ["for section" preview-section]
-        ["for region" preview-region mark-active]
+        ["for region" preview-region (TeX-active-mark)]
         ["for buffer" preview-buffer]
         ["for document" preview-document]
         "---"
         "Remove previews"
         ["at point" preview-clearout-at-point]
         ["from section" preview-clearout-section]
-        ["from region" preview-clearout mark-active]
+        ["from region" preview-clearout (TeX-active-mark)]
         ["from buffer" preview-clearout-buffer]
         ["from document" preview-clearout-document]
         "---"
@@ -3268,6 +3268,18 @@ Return a new string."
     (setq result (concat result string))
     result))
 
+(defvar-local preview--region-begin nil)
+
+(defvar preview-find-end-function nil
+  "Function used to compute the end position for a new overlay.
+The function bound to this variable will be called inside
+`preview-parse-messages' with one argument, an integer describing the
+beginning of the overlay.  This is intended to be used in conjunction
+with `preview-preprocess-function' when the latter introduces
+significant modifications.")
+
+(defvar preview-locating-previews-message "locating previews...")
+
 (defun preview-parse-messages (open-closure)
   "Turn all preview snippets into overlays.
 This parses the pseudo error messages from the preview
@@ -3275,7 +3287,7 @@ document style for LaTeX.  OPEN-CLOSURE is called once
 it is certain that we have a valid output file, and it has
 to return in its CAR the PROCESS parameter for the CLOSE
 call, and in its CDR the final stuff for the placement hook."
-  (with-temp-message "locating previews..."
+  (with-temp-message preview-locating-previews-message
     (let (TeX-error-file TeX-error-offset snippet box counters
           file line
           (lsnippet 0) lstart (lfile "") lline lbuffer lpoint
@@ -3538,6 +3550,15 @@ name(\\([^)]+\\))\\)\\|\
                         (goto-char (point-min))
                         (forward-line (1- line)))
                       (setq lpoint (point))
+
+                      ;; The following addresses the bug described at
+                      ;; 
https://lists.gnu.org/archive/html/bug-auctex/2023-03/msg00007.html
+                      ;; (bug#62445)
+                      (and preview--region-begin
+                           (< (point)
+                              preview--region-begin)
+                           (goto-char preview--region-begin))
+
                       (cond
                        ((search-forward (concat string after-string)
                                         (line-end-position) t)
@@ -3577,22 +3598,27 @@ name(\\([^)]+\\))\\)\\|\
                     (if box
                         (progn
                           (if (and lstart (= snippet lsnippet))
-                              (setq close-data
-                                    (nconc
-                                     (preview-place-preview
-                                      snippet
+                              (let* ((region-beg
                                       (save-excursion
                                         (preview-back-command
                                          (= (prog1 (point)
                                               (goto-char lstart))
                                             lstart))
-                                        (point))
-                                      (point)
-                                      (preview-TeX-bb box)
-                                      (cons lcounters counters)
-                                      tempdir
-                                      (cdr open-data))
-                                     close-data))
+                                        (point)))
+                                     (region-end
+                                      (if preview-find-end-function
+                                          (funcall preview-find-end-function
+                                                   region-beg)
+                                        (point)))
+                                     (ovl (preview-place-preview
+                                           snippet
+                                           region-beg
+                                           region-end
+                                           (preview-TeX-bb box)
+                                           (cons lcounters counters)
+                                           tempdir
+                                           (cdr open-data))))
+                                (setq close-data (nconc ovl close-data)))
                             (with-current-buffer run-buffer
                               (preview-log-error
                                (list 'error
@@ -4019,6 +4045,11 @@ stored in `preview-dumped-alist'."
   (preview-format-kill old-format)
   (setcdr old-format nil))
 
+(defvar preview-preprocess-function nil
+  "Function used to preprocess region before previewing.
+The function bound to this variable will be called inside
+`preview-region' with one argument which is a string.")
+
 (defun preview-region (begin end)
   "Run preview on region between BEGIN and END."
   (interactive "r")
@@ -4027,12 +4058,16 @@ stored in `preview-dumped-alist'."
          (concat (preview--counter-information begin)
                  TeX-region-extra)))
     (TeX-region-create (TeX-region-file TeX-default-extension)
-                       (buffer-substring-no-properties begin end)
+                       (let ((str (buffer-substring-no-properties begin end)))
+                         (if preview-preprocess-function
+                             (funcall preview-preprocess-function str)
+                           str))
                        (if buffer-file-name
                            (file-name-nondirectory buffer-file-name)
                          "<none>")
                        (TeX-current-offset begin)))
   (setq TeX-current-process-region-p t)
+  (setq preview--region-begin begin)
   (preview-generate-preview (TeX-region-file)
                             (preview-do-replacements
                              (TeX-command-expand
@@ -4106,7 +4141,7 @@ environments is selected."
 
 (defun preview-section ()
   "Run preview on LaTeX section." (interactive)
-  (save-excursion
+  (save-mark-and-excursion
     (LaTeX-mark-section)
     (preview-region (region-beginning) (region-end))))
 
diff --git a/style/biblatex.el b/style/biblatex.el
index 52e9e2ec..ae630321 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -1,6 +1,6 @@
 ;;; biblatex.el --- AUCTeX style for `biblatex.sty' version 2.8a.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2024  Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -237,20 +237,56 @@ for citation keys."
         (TeX-argument-insert (mapconcat #'identity items ",") optional))
       (setq noinsert t))))
 
+;; Support for mcite-like Citation Commands, see § 3.9.10 of Biblatex
+;; reference manual.
+(defun LaTeX-arg-biblatex-mcite (optional)
+  "Query and insert the mandatory argument of \\mcite compat macros."
+  (let ((set-name (TeX-read-string
+                   (TeX-argument-prompt optional nil "Set")))
+        (read-cite (lambda (opt)
+                     (if (and (fboundp 'reftex-citation)
+                              (fboundp 'reftex-plug-flag)
+                              (reftex-plug-flag 3))
+                         (reftex-citation t)
+                       (TeX-completing-read-multiple
+                        (TeX-argument-prompt opt nil "Key(s)")
+                        (LaTeX-bibitem-list)))))
+        cite-keys arg)
+    (cond ((and (not (string-empty-p set-name))
+                (y-or-n-p "Add citation keys to the set name?"))
+           ;; We want \mcite{set-name,*key1,*key2,*key3}
+           (setq cite-keys (funcall read-cite optional))
+           (when cite-keys
+             (setq cite-keys (mapcar (lambda (x) (concat "*" x))
+                                     cite-keys)))
+           (setq arg (concat set-name
+                             (when cite-keys
+                               (concat "," (mapconcat #'identity
+                                                      cite-keys
+                                                      ","))))))
+          ;; We want \mcite{key1}.  FIXME: Are multiple keys
+          ;; allowed?
+          ((string-empty-p set-name)
+           (setq arg (mapconcat #'identity
+                                (funcall read-cite optional)
+                                ",")))
+          (t (setq arg "")))
+    (TeX-argument-insert arg optional)))
+
 (defun LaTeX-arg-biblatex-natbib-notes (optional)
   "Prompt for two note arguments of a natbib compat citation command."
   (when TeX-arg-cite-note-p
-      (let ((pre (TeX-read-string
-                  (TeX-argument-prompt optional nil "Prenote")))
-            (post (TeX-read-string
-                   (TeX-argument-prompt optional nil "Postnote"))))
-        (TeX-argument-insert pre optional)
-        (TeX-argument-insert post optional)
-        ;; pre is given, post is empty: Make sure that we insert an
-        ;; extra pair of `[]', otherwise pre becomes post
-        (when (and pre (not (string= pre ""))
-                   (string= post ""))
-          (insert LaTeX-optop LaTeX-optcl)))))
+    (let ((pre (TeX-read-string
+                (TeX-argument-prompt optional nil "Prenote")))
+          (post (TeX-read-string
+                 (TeX-argument-prompt optional nil "Postnote"))))
+      (TeX-argument-insert pre optional)
+      (TeX-argument-insert post optional)
+      ;; pre is given, post is empty: Make sure that we insert an
+      ;; extra pair of `[]', otherwise pre becomes post
+      (when (and pre (not (string= pre ""))
+                 (string= post ""))
+        (insert LaTeX-optop LaTeX-optcl)))))
 
 (TeX-add-style-hook
  "biblatex"
@@ -334,32 +370,45 @@ for citation keys."
       (TeX-arg-completing-read-multiple (LaTeX-bibitem-list) "Keys"))
     ;;; Citation Commands
     '("cite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
+                                  (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Cite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
+                                  (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("parencite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Parencite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("footcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("footcitetext" (TeX-arg-conditional TeX-arg-cite-note-p
-                                          (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                          (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     ;; Style-specific Commands
     '("textcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Textcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("cite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                   (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
+                                   (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("parencite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("supercite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     ;; Qualified Citation Lists
     '("cites" LaTeX-arg-biblatex-cites)
     '("Cites" LaTeX-arg-biblatex-cites)
@@ -374,52 +423,69 @@ for citation keys."
     '("supercites" LaTeX-arg-biblatex-cites)
     ;; Style-independent Commands
     '("autocite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Autocite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("autocites" LaTeX-arg-biblatex-cites)
     '("Autocites" LaTeX-arg-biblatex-cites)
     ;; Text Commands
     '("citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
-                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
-                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                         (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                         (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                         (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                         (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citetitle" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citetitle*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citeyear" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citeyear*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citedate" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citedate*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("citeurl" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                     (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("parentext" "Text")
     '("brackettext" "Text")
     ;; Special Commands
     '("fullcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("footfullcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                          (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                          (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("volcite"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
     '("Volcite"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
-    '("Pvolcite"
+    '("pvolcite"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
     '("Pvolcite"
@@ -428,7 +494,7 @@ for citation keys."
     '("fvolcite"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
-    '("ftolcite"
+    '("ftvolcite"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
     '("svolcite"
@@ -450,15 +516,20 @@ for citation keys."
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
     '("notecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Notecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("Pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     '("fnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ())
+      TeX-arg-cite)
     ;; Low-level Commands
     '("citename"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
@@ -526,7 +597,6 @@ for citation keys."
                                     nil)
               #'TeX-arg-cite))))
          cmds))
-
        ;; Fontification for compat macros does not go into `font-latex.el':
        (when (and (featurep 'font-latex)
                   (eq TeX-install-font-lock 'font-latex-setup))
@@ -540,6 +610,44 @@ for citation keys."
                                     ("Citealp"      "*[[{"))
                                   'biblatex))))
 
+   ;; § 3.9.10 mcite-like Citation Commands
+   (when (or (LaTeX-provided-package-options-member "biblatex" "mcite")
+             (LaTeX-provided-package-options-member "biblatex" "mcite=true"))
+     (let ((cmds '("mcite"      "Mcite"
+                   "mparencite" "Mparencite"
+                   "mfootcite"  "mfootcitetext"
+                   "mtextcite"  "Mtextcite"
+                   "msupercite"
+                   "mautocite"  "Mautocite"))
+           (spec "*[[{"))
+       ;; Add the macros incl. optional arguments:
+       (apply #'TeX-add-symbols
+              (mapcar
+               (lambda (cmd)
+                 (list cmd
+                       '(TeX-arg-conditional TeX-arg-cite-note-p
+                                             (["Prenote"] ["Postnote"])
+                                             nil)
+                       #'LaTeX-arg-biblatex-mcite))
+               cmds))
+       ;; Cater for the starred versions as well:
+       (apply #'TeX-add-symbols
+              (mapcar
+               (lambda (cmd)
+                 (list (concat cmd "*")
+                       '(TeX-arg-conditional TeX-arg-cite-note-p
+                                             (["Prenote"] ["Postnote"])
+                                             nil)
+                       #'LaTeX-arg-biblatex-mcite))
+               cmds))
+       ;; Fontification for compat macros does not go into `font-latex.el':
+       (when (and (featurep 'font-latex)
+                  (eq TeX-install-font-lock 'font-latex-setup))
+         (font-latex-add-keywords (mapcar (lambda (cmd)
+                                            (list cmd spec))
+                                          cmds)
+                                  'biblatex))))
+
    (LaTeX-add-environments
     ;;; Bibliography commands
     ;; Bibliography Sections
diff --git a/style/ltx-base.el b/style/ltx-base.el
index 472a9937..57c43f07 100644
--- a/style/ltx-base.el
+++ b/style/ltx-base.el
@@ -289,7 +289,11 @@
       (TeX-arg-completing-read ("bf" "md") "Meta series")
       "Series value")
 
-    ;; 6.7 Handling of nested emphasis
+    ;; 6.7 Handling of current and requested font series and shape
+    '("DeclareFontSeriesChangeRule" 4)
+    '("DeclareFontShapeChangeRule"  4)
+
+    ;; 6.8 Handling of nested emphasis
     '("DeclareEmphSequence"
       (TeX-arg-completing-read-multiple (lambda ()
                                           (mapcar (lambda (x)
@@ -297,7 +301,7 @@
                                                   LaTeX-font-shape))
                                         "Font declarations"))
 
-    ;; 6.8 Providing font family substitutions
+    ;; 6.9 Providing font family substitutions
     '("DeclareFontFamilySubstitution"
       (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding")
       2)
@@ -390,6 +394,9 @@
 
                                 ("DeclareFontSeriesDefault" "[{{")
 
+                                ("DeclareFontSeriesChangeRule" "{{{{")
+                                ("DeclareFontShapeChangeRule " "{{{{")
+
                                 ("DeclareEmphSequence" "{")
 
                                 ("DeclareFontFamilySubstitution" "{{{")
diff --git a/style/verbatim.el b/style/verbatim.el
index 90622543..8a13b09d 100644
--- a/style/verbatim.el
+++ b/style/verbatim.el
@@ -1,6 +1,6 @@
 ;;; verbatim.el --- Style hook for the verbatim package.  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2001, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2001--2024 Free Software Foundation, Inc.
 
 ;; Author: Masayuki Ataka <masayuki.ataka@gmail.com>
 ;; Maintainer: auctex-devel@gnu.org
@@ -35,6 +35,8 @@
 ;; Silence the compiler:
 (declare-function font-latex-set-syntactic-keywords
                   "font-latex")
+(declare-function font-latex-add-keywords
+                  "font-latex")
 
 (TeX-add-style-hook
  "verbatim"
@@ -42,12 +44,15 @@
    (LaTeX-add-environments
     "comment")
    (TeX-add-symbols
-    '("verbatiminput" TeX-arg-file))
+    '("verbatiminput" TeX-arg-file)
+    '("verbatiminput*" TeX-arg-file))
 
    ;; Fontification:
    ;; Code taken from `comment.el'
    (when (and (boundp 'font-latex-syntactic-keywords-extra)
               (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("verbatiminput" "*{"))
+                              'reference)
      ;; For syntactic fontification.
      (add-to-list 'font-latex-syntactic-keywords-extra
                   '("^[ \t]*\\\\begin *{comment}.*\\(\n\\)"
diff --git a/tex-fold.el b/tex-fold.el
index 92304fb2..19e35a2c 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -245,15 +245,45 @@ After that, changing the prefix key requires manipulating 
keymaps."
     (define-key map "\C-b" #'TeX-fold-buffer)
     (define-key map "\C-r" #'TeX-fold-region)
     (define-key map "\C-p" #'TeX-fold-paragraph)
+    (define-key map "\C-s" #'TeX-fold-section)
     (define-key map "\C-m" #'TeX-fold-macro)
     (define-key map "\C-e" #'TeX-fold-env)
     (define-key map "\C-c" #'TeX-fold-comment)
     (define-key map "b"    #'TeX-fold-clearout-buffer)
     (define-key map "r"    #'TeX-fold-clearout-region)
     (define-key map "p"    #'TeX-fold-clearout-paragraph)
+    (define-key map "s"    #'TeX-fold-clearout-section)
     (define-key map "i"    #'TeX-fold-clearout-item)
     map))
 
+(defcustom TeX-fold-auto-reveal
+  '(eval (TeX-fold-arrived-via (key-binding [left]) (key-binding [right])
+                               #'backward-char #'forward-char
+                               #'mouse-set-point))
+  "Predicate to open a fold when entered.
+Possibilities are:
+t autoopens,
+nil doesn't,
+a symbol will have its value consulted if it exists,
+defaulting to nil if it doesn't.
+A CONS-cell means to call a function for determining the value.
+The CAR of the cell is the function to call which receives
+the CDR of the CONS-cell in the rest of the arguments, while
+point and current buffer point to the position in question.
+All of the options show reasonable defaults."
+  :group 'TeX-fold
+  :type '(choice (const :tag "Off" nil)
+                 (const :tag "On" t)
+                 (symbol :tag "Indirect variable" :value reveal-mode)
+                 (cons :tag "Function call"
+                       :value (eval (TeX-fold-arrived-via
+                                     (key-binding [left])
+                                     (key-binding [right])
+                                     #'backward-char #'forward-char
+                                     #'mouse-set-point))
+                       function (list :tag "Argument list"
+                                      (repeat :inline t sexp)))))
+
 
 ;;; Folding
 
@@ -296,6 +326,24 @@ and `TeX-fold-math-spec-list', and environments in 
`TeX-fold-env-spec-list'."
       (TeX-fold-clearout-region start end)
       (TeX-fold-region start end))))
 
+(defun TeX-fold-section ()
+  "Hide all configured macros and environments in the current section.
+The relevant macros are specified in the variable `TeX-fold-macro-spec-list'
+and `TeX-fold-math-spec-list', and environments in `TeX-fold-env-spec-list'."
+  (interactive)
+  (save-mark-and-excursion
+    (LaTeX-mark-section)
+    (let ((start (point))
+          (end (mark)))
+      (TeX-fold-clearout-region start end)
+      (TeX-fold-region start end))))
+
+(defcustom TeX-fold-region-functions nil
+  "List of additional functions to call when folding a region.
+Each function is called with two arguments, the start and end positions
+of the region to fold."
+  :type '(repeat function))
+
 (defun TeX-fold-region (start end)
   "Fold all items in region from START to END."
   (interactive "r")
@@ -307,7 +355,8 @@ and `TeX-fold-math-spec-list', and environments in 
`TeX-fold-env-spec-list'."
   (when (memq 'math TeX-fold-type-list)
     (TeX-fold-region-macro-or-env start end 'math))
   (when (memq 'comment TeX-fold-type-list)
-    (TeX-fold-region-comment start end)))
+    (TeX-fold-region-comment start end))
+  (run-hook-with-args 'TeX-fold-region-functions start end))
 
 (defun TeX-fold-region-macro-or-env (start end type)
   "Fold all items of type TYPE in region from START to END.
@@ -707,6 +756,15 @@ breaks will be replaced by spaces."
           (start (progn (LaTeX-backward-paragraph) (point))))
       (TeX-fold-clearout-region start end))))
 
+(defun TeX-fold-clearout-section ()
+  "Permanently show all macros in the section point is located in."
+  (interactive)
+  (save-mark-and-excursion
+    (LaTeX-mark-section)
+    (let ((start (point))
+          (end (mark)))
+      (TeX-fold-clearout-region start end))))
+
 (defun TeX-fold-clearout-region (start end)
   "Permanently show all macros in region starting at START and ending at END."
   (interactive "r")
@@ -781,7 +839,9 @@ That means, put respective properties onto overlay OV."
                            (setq arg-list (append arg-list (list (car arg)))))
                          (setq n (1+ n)))
                        (or (condition-case nil
-                               (apply spec arg-list)
+                               (save-excursion
+                                 (goto-char ov-start)
+                                 (apply spec arg-list))
                              (error nil))
                            "[Error: No content or function found]")))
                     (t (or (TeX-fold-macro-nth-arg spec ov-start ov-end)
@@ -833,6 +893,22 @@ Remove the respective properties from the overlay OV."
   (when font-lock-mode
     (overlay-put ov 'face TeX-fold-unfolded-face)))
 
+(defun TeX-fold-auto-reveal-p (mode)
+  "Decide whether to auto-reveal.
+Return non-nil if folded region should be auto-opened.
+See `TeX-fold-auto-reveal' for definitions of MODE."
+  (cond ((symbolp mode)
+         (and (boundp mode)
+              (symbol-value mode)))
+        ((consp mode)
+         (apply (car mode) (cdr mode)))
+        (t mode)))
+
+(defun TeX-fold-arrived-via (&rest list)
+  "Indicate auto-opening.
+Return non-nil if called by one of the commands in LIST."
+  (memq this-command list))
+
 ;; Copy and adaption of `reveal-post-command' from reveal.el in GNU
 ;; Emacs on 2004-07-04.
 (defun TeX-fold-post-command ()
@@ -855,14 +931,10 @@ Remove the respective properties from the overlay OV."
               (setq TeX-fold-open-spots (cdr spots))
               (when (or disable-point-adjustment
                         global-disable-point-adjustment
-                        ;; See preview.el on how to make this configurable.
-                        (memq this-command
-                              (list (key-binding [left]) (key-binding [right])
-                                    #'backward-char #'forward-char
-                                    #'mouse-set-point)))
+                        (TeX-fold-auto-reveal-p TeX-fold-auto-reveal))
                 ;; Open new overlays.
                 (dolist (ol (nconc (when (and TeX-fold-unfold-around-mark
-                                              mark-active)
+                                              (TeX-active-mark))
                                      (overlays-at (mark)))
                                    (overlays-at (point))))
                   (when (eq (overlay-get ol 'category) 'TeX-fold)
diff --git a/tex.el b/tex.el
index 053a0ade..18689f40 100644
--- a/tex.el
+++ b/tex.el
@@ -5153,7 +5153,7 @@ Brace insertion is only done if point is in a math 
construct and
                        (<= (prefix-numeric-value prefix-arg) 0)
                      (and (boundp 'TeX-command-region-begin)
                           (markerp TeX-command-region-begin)))
-                   mark-active)
+                   (TeX-active-mark))
        ;;:visible (eq TeX-command-current 'TeX-command-region)
        :style toggle
        :selected (and (boundp 'TeX-command-region-begin)
@@ -5257,6 +5257,9 @@ Brace insertion is only done if point is in a math 
construct and
     ["Hide All in Current Paragraph" TeX-fold-paragraph
      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
      :help "Hide all configured TeX constructs in the paragraph containing 
point"]
+    ["Hide All in Current Section" TeX-fold-section
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Hide all configured TeX constructs in the section containing 
point"]
     ["Hide Current Macro" TeX-fold-macro
      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
      :help "Hide the macro containing point"]
@@ -5277,6 +5280,9 @@ Brace insertion is only done if point is in a math 
construct and
     ["Show All in Current Paragraph" TeX-fold-clearout-paragraph
      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
      :help "Permanently show all folded content in paragraph containing point"]
+    ["Show All in Current Section" TeX-fold-clearout-section
+     :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
+     :help "Permanently show all folded content in section containing point"]
     ["Show Current Item" TeX-fold-clearout-item
      :active (and (boundp 'TeX-fold-mode) TeX-fold-mode)
      :help "Permanently show the item containing point"]
@@ -7417,7 +7423,7 @@ been set."
 Make sure you have one and that TeX binaries are in PATH environment 
variable%s"
                         (if (eq system-type 'darwin)
                             ".
-If you are using OS X El Capitan or later
+If you are using macOS 10.14 Mojave or later
 remember to add /Library/TeX/texbin/ to your PATH"
                           ""))))
 
@@ -9080,9 +9086,10 @@ original file."
                               (buffer-substring-no-properties
                                (point) (point-max))))))))))
     ;; file name should be relative to master
-    (setq original (TeX-quote-filename (file-relative-name
-                                        original (TeX-master-directory)))
-          master-name (TeX-quote-filename master-name))
+    (unless (string= original "<none>") ; cf. `preview-region'
+      (setq original (TeX-quote-filename (file-relative-name
+                                          original (TeX-master-directory)))))
+    (setq master-name (TeX-quote-filename master-name))
 
     ;; If the first line begins with "%&", put that line separately on
     ;; the very first line of the region file so that the first line



reply via email to

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