branch: main commit 0a477ebe9e9c91e7d966d4b76ca0b78b78e430e6 Merge: f124fe7d 2ee39c4e Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge remote-tracking branch 'origin/master' into externals/auctex --- context.el | 18 ++- doc/auctex.texi | 32 +++-- doc/changes.texi | 12 +- doc/preview-faq.texi | 33 +++++- font-latex.el | 11 +- latex-flymake.el | 22 +++- latex.el | 160 +++++++++++++++---------- style/ltx-base.el | 325 ++++++++++++++++++++++++++++++++++++++++++++------- style/xparse.el | 17 ++- tex-info.el | 26 +---- tex.el | 101 ++++++++-------- texmathp.el | 8 +- 12 files changed, 560 insertions(+), 205 deletions(-) diff --git a/context.el b/context.el index 5ee0217d..29bbccd6 100644 --- a/context.el +++ b/context.el @@ -496,8 +496,8 @@ in your init file such as .emacs.d/init.el or .emacs." "ConTeXt Mark version used for running ConTeXt." :type 'string :group 'TeX-command - :safe #'stringp - :local t) + :safe #'stringp) +(make-variable-buffer-local 'ConTeXt-Mark-version) (defun ConTeXt-numbered-section-heading () "Hook to prompt for ConTeXt section name. @@ -626,8 +626,8 @@ for a label to be inserted after the sectioning command." (defcustom ConTeXt-default-environment "itemize" "The default environment when creating new ones with `ConTeXt-environment'." :group 'ConTeXt-environment - :type 'string - :local t) + :type 'string) +(make-variable-buffer-local 'ConTeXt-default-environment) (TeX-auto-add-type "environment" "ConTeXt") @@ -1875,9 +1875,8 @@ 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) - ;; Moved after `run-mode-hooks'. (bug#65750) - ;; (set (make-local-variable 'outline-regexp) (ConTeXt-outline-regexp t)) - ;;(make-local-variable 'outline-heading-end-regexp) + (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)) @@ -1913,10 +1912,7 @@ Run after mode hooks and file local variables application." "[ \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 dce723a3..b499c63b 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -3085,6 +3085,12 @@ The name of the file for temporarily storing the text when formatting the current region. @end defopt +@defopt TeX-kill-process-without-query +This boolean option controls whether @AUCTeX{} should ask user before +aborting a running process for a @TeX{} document. It can be set as a +file-local variable. +@end defopt + @defopt TeX-header-end A regular expression matching the end of the header. By default, this is @samp{\begin@{document@}} in @LaTeX{} mode and @samp{%**end of @@ -4073,16 +4079,22 @@ buffers by adding this to your init file: (add-hook 'LaTeX-mode-hook #'flymake-mode) @end lisp Note that @AUCTeX{} currently only provides support for using -@code{chktex} as the flymake backend. - -Each of the two utilities @code{lacheck} and @code{chktex} will find -some errors the other doesn't, but @code{chktex} is more configurable, -allowing you to create your own errors. You may need to install the -programs before using them. You can get @code{lacheck} from -URL:@url{https://www.ctan.org/pkg/lacheck} and -@code{chktex} from -URL:@url{https://www.ctan.org/pkg/chktex}. @w{@TeX{} Live} contains -both. +@code{chktex} as the flymake backend. Error messages produced by +@code{chktex} can be controlled by setting the variable +@code{LaTeX-flymake-chktex-options}. + +@defopt LaTeX-flymake-chktex-options +List of strings passed to @code{chktex} program as additonal options. +This option can be used to pass a specific warning number to @code{chktex} +like @option{-w41}. +@end defopt + +Each of the two utilities @code{lacheck} and @code{chktex} will find some +errors the other doesn't, but @code{chktex} is more configurable, allowing +you to create your own errors. You may need to install the programs +before using them. You can get @code{lacheck} from +@url{https://www.ctan.org/pkg/lacheck} and @code{chktex} from +@url{https://www.ctan.org/pkg/chktex}. @w{@TeX{} Live} contains both. @node Control @section Controlling the output diff --git a/doc/changes.texi b/doc/changes.texi index f2a3a3ae..2ac2ee05 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-2023 Free Software +@c Copyright (C) 1994-2002, 2004-2010, 2012-2024 Free Software @c Foundation, Inc. @c See file auctex.texi for copying conditions. @include macros.texi @@ -172,6 +172,16 @@ There are new keymaps, hooks and abbrev tables: @code{japanese-LaTeX-mode-abbrev-table} @end itemize +@item +New custom variable @code{LaTeX-flymake-chktex-options} is provided to +enable or disable specific warnings of @code{chktex} backend used by +Flymake. + +@item +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 @AUCTeX{} now requires GNU Emacs 27.1 or higher. @end itemize diff --git a/doc/preview-faq.texi b/doc/preview-faq.texi index 95d70f05..38044af6 100644 --- a/doc/preview-faq.texi +++ b/doc/preview-faq.texi @@ -78,8 +78,8 @@ Emacs. It is known to work under the X Window System for Linux and for several flavors of Unix: we have reports for HP and Solaris. -There are several development versions of Emacs around for native MacOS -Carbon, and @previewlatex{} is working with them, too. +There are several versions of Emacs around for macOS, and @previewlatex{} +is working with them, too. With Windows, both native Emacs and Cygwin Emacs should work. However, it is known that @url{https://miktex.org/,MiK@TeX{}} sometimes doesn't work @@ -210,6 +210,35 @@ facilities of @file{preview.sty} to tell it how to resolve this, whether you want no previews, previews of whole slides or previews of inner material. +@subsection Does @previewlatex{} work with the TikZ package? + +@previewlatex{} doesn't have support for the @code{tikzpicture} +environment built-in. It can be included manually by adding the lines: +@example +\usepackage[displaymath,sections,graphics,floats,textmath]@{preview@} +\PreviewEnvironment[@{[]@}]@{tikzpicture@} +@end example + +@noindent +to the document preamble. + +Things get more complicated when the code inside the @code{tikzpicture} +environment contains @code{$ $} for inserting inline math and +@previewlatex{} is instructed to insert previews for it into the buffer. +In this case, you can disable previews for inline math by changing the +lines above to: +@example +\usepackage[displaymath,sections,graphics,floats + % textmath %% Don't preview inline math +]@{preview@} +\PreviewEnvironment[@{[]@}]@{tikzpicture@} +@end example + +Another solution is to source out the TikZ pictures into an external file +which uses the @code{standalone} class, process them and insert them back +into the main file as figures with the @code{\includegraphics} macro. In +this case, previewing of inline math will work as usual. + @node Troubleshooting, Other formats, Customization, Frequently Asked Questions @section Troubleshooting diff --git a/font-latex.el b/font-latex.el index ab33b4db..ccddd8b1 100644 --- a/font-latex.el +++ b/font-latex.el @@ -373,7 +373,16 @@ variable `font-latex-fontify-sectioning'." ',num) ("DeclareDocumentEnvironment" "{{{{") ("NewDocumentEnvironment" "{{{{") ("ProvideDocumentEnvironment" "{{{{") - ("RenewDocumentEnvironment" "{{{{")) + ("RenewDocumentEnvironment" "{{{{") + ("NewCommandCopy" "|{\\|{\\") + ("RenewCommandCopy" "|{\\|{\\") + ("DeclareCommandCopy" "|{\\|{\\") + ("ShowCommand" "|{\\") + ("NewEnvironmentCopy" "{{") + ("RenewEnvironmentCopy" "{{") + ("DeclareEnvironmentCopy" "{{") + ("ShowEnvironment" "{") + ("listfiles" "[")) font-lock-function-name-face 2 command) ("function-noarg" ("enspace" "enskip" "quad" "qquad" "nonumber" diff --git a/latex-flymake.el b/latex-flymake.el index 2a86ebed..5cffc924 100644 --- a/latex-flymake.el +++ b/latex-flymake.el @@ -1,6 +1,6 @@ ;;; latex-flymake.el --- Flymake integration -*- lexical-binding: t; -*- -;; Copyright (C), 2018 Free Software Foundation, Inc. +;; Copyright (C), 2018--2024 Free Software Foundation, Inc. ;; Author: Alex Branham <bran...@utexas.edu> ;; Maintainer: auctex-devel@gnu.org @@ -40,6 +40,23 @@ (defvar-local LaTeX--flymake-proc nil) +(defcustom LaTeX-flymake-chktex-options nil + "A list of strings passed as options to the chktex backend. +You can use this to enable or disable specific warnings by setting it to +something like: + + \\='(\"-n12\" \"-w41\") + +Which would disable warning 12 (\"interword spacing should perhaps be +used\") and enable 41 (\"you ought not to use primitive TeX in LaTeX +code\"). + +See the chktex manual for warning numbers and details about how to use +flags." + :type '(choice (const :tag "Use chktex defaults" nil) + (repeat :tag "Custom chktex options" string)) + :group 'LaTeX) + (defun LaTeX-flymake (report-fn &rest _args) "Setup flymake integration. @@ -56,7 +73,8 @@ REPORT-FN is flymake's callback function." (make-process :name "LaTeX-flymake" :noquery t :connection-type 'pipe :buffer (generate-new-buffer " *LaTeX-flymake*") - :command '("chktex" "--verbosity=0" "--quiet" "--inputfiles") + :command `("chktex" "--verbosity=0" "--quiet" "--inputfiles" + ,@LaTeX-flymake-chktex-options) :sentinel (lambda (proc _event) (when (eq 'exit (process-status proc)) diff --git a/latex.el b/latex.el index 83de0e84..cd87bd99 100644 --- a/latex.el +++ b/latex.el @@ -69,8 +69,9 @@ "Default options to documentclass. A comma-seperated list of strings." :group 'LaTeX-environment - :type '(repeat (string :format "%v")) - :local t) + :type '(repeat (string :format "%v"))) + +(make-variable-buffer-local 'LaTeX-default-options) (defcustom LaTeX-insert-into-comments t "Whether insertion commands stay in comments. @@ -366,9 +367,16 @@ If so, return the second element, otherwise return nil." (defun LaTeX-outline-name () "Guess a name for the current header line." (save-excursion - (if (re-search-forward "{\\([^}]*\\)}" (+ (point) fill-column 10) t) - (match-string 1) - (buffer-substring (point) (min (point-max) (+ 20 (point))))))) + (search-forward "{" nil t) + (let ((beg (point))) + (backward-char) + (condition-case nil + (with-syntax-table (TeX-search-syntax-table ?\{ ?\}) + (forward-sexp) + (backward-char)) + (error (forward-sentence))) + (replace-regexp-in-string "[\n\r][ ]*" " " + (buffer-substring beg (point)))))) (add-hook 'TeX-remove-style-hook (lambda () (setq LaTeX-largest-level nil))) @@ -553,8 +561,8 @@ The behaviour of this hook is controlled by variable `LaTeX-section-label'." It is overridden by `LaTeX-default-document-environment' when it is non-nil and the current environment is \"document\"." :group 'LaTeX-environment - :type 'string - :local t) + :type 'string) +(make-variable-buffer-local 'LaTeX-default-environment) (defvar-local LaTeX-default-document-environment nil "The default environment when creating new ones with @@ -1001,8 +1009,8 @@ optional argument is omitted.)" :group 'LaTeX-environment :type '(choice (const :tag "Do not prompt" nil) (const :tag "Empty" "") - (string :format "%v")) - :local t) + (string :format "%v"))) +(make-variable-buffer-local 'LaTeX-float) (defcustom LaTeX-top-caption-list nil "List of float environments with top caption." @@ -1046,14 +1054,14 @@ code listings and take a caption and label." (defcustom LaTeX-default-format "" "Default format for array and tabular environments." :group 'LaTeX-environment - :type 'string - :local t) + :type 'string) +(make-variable-buffer-local 'LaTeX-default-format) (defcustom LaTeX-default-width "1.0\\linewidth" "Default width for minipage and tabular* environments." :group 'LaTeX-environment - :type 'string - :local t) + :type 'string) +(make-variable-buffer-local 'LaTeX-default-width) (defcustom LaTeX-default-position "" "Default position for array and tabular environments. @@ -1061,8 +1069,8 @@ If nil, act like the empty string is given, but do not prompt." :group 'LaTeX-environment :type '(choice (const :tag "Do not prompt" nil) (const :tag "Empty" "") - string) - :local t) + string)) +(make-variable-buffer-local 'LaTeX-default-position) (defcustom LaTeX-equation-label "eq:" "Default prefix to equation labels." @@ -1147,8 +1155,9 @@ corresponding entry." :group 'LaTeX-label :type '(repeat (cons (string :tag "Environment") (choice (string :tag "Label prefix") - (symbol :tag "Label prefix symbol")))) - :local t) + (symbol :tag "Label prefix symbol"))))) + +(make-variable-buffer-local 'LaTeX-label-alist) (defvar TeX-read-label-prefix nil "Initial input for the label in `TeX-read-label'.") @@ -1789,6 +1798,7 @@ This is necessary since index entries may contain commands and stuff.") "DeclareTextAccent" "DeclareTextComposite" "ProvideTextCommand" "ProvideTextSymbol" "ProvideTextAccent" "ProvideTextComposite" + "DeclareFixedFont" "DeclareTextFontCommand" "DeclareOldFontCommand")) "{?\\\\\\([A-Za-z]+\\)}?") @@ -8071,8 +8081,8 @@ ARG is the entry for the current argument in buffer stored in (t nil))))) -(defun LaTeX-completion-find-argument-boundries (&rest args) - "Find the boundries of the current LaTeX argument. +(defun LaTeX-completion-find-argument-boundaries (&rest args) + "Find the boundaries of the current LaTeX argument. ARGS are characters passed to the function `TeX-search-syntax-table'. If ARGS are omitted, all characters defined in the variable `LaTeX-completion-macro-delimiters' are @@ -8080,7 +8090,8 @@ taken." (save-restriction (narrow-to-region (line-beginning-position -40) (line-beginning-position 40)) - (let ((args (or args (LaTeX-completion-macro-delimiters)))) + (let ((args (or args (LaTeX-completion-macro-delimiters))) + (parse-sexp-ignore-comments t)) (condition-case nil (with-syntax-table (apply #'TeX-search-syntax-table args) (scan-lists (point) 1 1)) @@ -8092,7 +8103,7 @@ Completion for macros starting with `\\' is provided by the function `TeX--completion-at-point' which should come first in `completion-at-point-functions'." ;; Exit if not inside an argument or in a comment: - (when (and (LaTeX-completion-find-argument-boundries) + (when (and (LaTeX-completion-find-argument-boundaries) (not (nth 4 (syntax-ppss)))) (let ((entry (LaTeX-what-macro))) (cond ((and entry @@ -8268,16 +8279,6 @@ Run after mode hooks and file local variables application." (if (bound-and-true-p filladapt-mode) (turn-off-filladapt-mode)) - ;; 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. @@ -8441,13 +8442,12 @@ function would return non-nil and `(match-string 1)' would return (require 'outline) (set (make-local-variable 'outline-level) #'LaTeX-outline-level) - ;; 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))) + (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 @@ -8771,8 +8771,6 @@ function would return non-nil and `(match-string 1)' would return '("textsubscript" "Text") '("textcircled" "Text") '("mathring" t) - '("MakeUppercase" t) - '("MakeLowercase" t) '("chaptermark" "Text") '("sectionmark" "Text") '("subsectionmark" "Text") @@ -8781,7 +8779,7 @@ function would return non-nil and `(match-string 1)' would return '("subparagraphmark" "Text") "LaTeXe" - "listfiles" "frontmatter" "mainmatter" "backmatter" + "frontmatter" "mainmatter" "backmatter" "leftmark" "rightmark" "textcompwordmark" "textvisiblespace" "textemdash" "textendash" "textexclamdown" "textquestiondown" "textquotedblleft" @@ -8927,6 +8925,10 @@ function would return non-nil and `(match-string 1)' would return ;; The next 3 were added to LaTeX kernel with 2020-02-02 release: '("sscshape" -1) '("swshape" -1) '("ulcshape" -1) ;; These are for the default settings: + "encodingdefault" "familydefault" "seriesdefault" "shapedefault" + "rmdefault" "sfdefault" "ttdefault" + "bfdefault" "mddefault" + "itdefault" "sldefault" "scdefault" "updefault" "sscdefault" "swdefault" "ulcdefault" ;; This macro is for `spaced small caps'. Currently, only some ;; commercial fonts offer this. It should be moved into @@ -8935,28 +8937,39 @@ function would return non-nil and `(match-string 1)' would return ;; User level reset macros: '("normalfont" -1) '("normalshape" -1) + ;; Low level commands for selecting a font: + '("fontencoding" "Encoding") + '("fontfamily" "Family") + '("fontseries" "Series") + '("fontshape" "Shape") + '("fontsize" "Size" "Baselineskip") + "selectfont" + '("usefont" "Encoding" "Family" "Series" "Shape") '("linespread" "Factor") + ;; This one only be used outside math mode: + '("mathversion" (TeX-arg-completing-read ("normal" "bold") "Version")) + ;; Macros for document-command parser, aka xparse added to LaTeX - ;; kernel with 2020-10-01 release: - '("DeclareDocumentCommand" - TeX-arg-define-macro "Argument specification" t) + ;; kernel with 2020-10-01 release and documented in usrguide.pdf '("NewDocumentCommand" TeX-arg-define-macro "Argument specification" t) '("RenewDocumentCommand" TeX-arg-macro "Argument specification" t) '("ProvideDocumentCommand" TeX-arg-define-macro "Argument specification" t) + '("DeclareDocumentCommand" + TeX-arg-define-macro "Argument specification" t) ;; Declaring environments - '("DeclareDocumentEnvironment" TeX-arg-define-environment - "Argument specification" t t) '("NewDocumentEnvironment" TeX-arg-define-environment "Argument specification" t t) '("RenewDocumentEnvironment" TeX-arg-environment "Argument specification" t t) '("ProvideDocumentEnvironment" TeX-arg-define-environment "Argument specification" t t) + '("DeclareDocumentEnvironment" TeX-arg-define-environment + "Argument specification" t t) ;; Fully-expandable document commands '("DeclareExpandableDocumentCommand" @@ -8969,9 +8982,6 @@ function would return non-nil and `(match-string 1)' would return TeX-arg-define-macro "Argument specification" t) ;; Testing special values - '("IfBooleanTF" 3) - '("IfBooleanT" 2) - '("IfBooleanF" 2) '("IfNoValueTF" 3) '("IfNoValueT" 2) '("IfNoValueF" 2) @@ -8983,18 +8993,49 @@ function would return non-nil and `(match-string 1)' would return '("IfBlankF" 2) "BooleanTrue" "BooleanFalse" + '("IfBooleanTF" 3) + '("IfBooleanT" 2) + '("IfBooleanF" 2) + ;; Argument processors - "ProcessedArgument" - "ReverseBoolean" '("SplitArgument" "Number" "Token") '("SplitList" "Token") - "TrimSpaces" '("ProcessList" "List" "Function") - ;; Access to the argument specification - '("GetDocumentCommandArgSpec" TeX-arg-macro) - '("GetDocumentEnvironmmentArgSpec" TeX-arg-environment) - '("ShowDocumentCommandArgSpec" TeX-arg-macro) - '("ShowDocumentEnvironmentArgSpec" TeX-arg-environment) + "ReverseBoolean" + "TrimSpaces" + "ProcessedArgument" + + ;; Copying and showing (robust) commands and environments + '("NewCommandCopy" TeX-arg-define-macro TeX-arg-macro) + '("RenewCommandCopy" TeX-arg-define-macro TeX-arg-macro) + '("DeclareCommandCopy" TeX-arg-define-macro TeX-arg-macro) + '("ShowCommand" TeX-arg-macro) + + '("NewEnvironmentCopy" TeX-arg-define-environment TeX-arg-environment) + '("RenewEnvironmentCopy" TeX-arg-define-environment TeX-arg-environment) + '("DeclareEnvironmentCopy" TeX-arg-define-environment TeX-arg-environment) + '("ShowEnvironment" TeX-arg-environment) + + ;; Preconstructing command names (or otherwise expanding arguments) + '("UseName" "String") + ;; Only offer the predictable part + '("ExpandArgs" + (TeX-arg-completing-read ("c" "cc" "Nc") "Spec")) + + ;; Expandable floating point (and other) calculations + '("fpeval" t) + '("inteval" t) + '("dimeval" t) + '("skipeval" t) + + ;; Case changing + '("MakeUppercase" t) + '("MakeLowercase" t) + '("MakeTitlecase" t) + + ;; Support for problem solving + '("listfiles" + [TeX-arg-completing-read-multiple ("hashes" "sizes")]) ;; LaTeX hook macros: '("AddToHook" TeX-arg-hook [ "Label" ] t) @@ -9063,10 +9104,7 @@ function would return non-nil and `(match-string 1)' would return "Position 1") (TeX-arg-completing-read ("top" "first" "last") "Position 2") - 2) - '("fpeval" t) - '("dimeval" t) - '("skipeval" t) )) + 2) )) (TeX-run-style-hooks "LATEX") diff --git a/style/ltx-base.el b/style/ltx-base.el index 693308a3..472a9937 100644 --- a/style/ltx-base.el +++ b/style/ltx-base.el @@ -1,6 +1,6 @@ ;;; ltx-base.el --- AUCTeX style for basic LaTeX commands. -*- lexical-binding: t; -*- -;; Copyright (C) 2004--2022 Free Software Foundation, Inc. +;; Copyright (C) 2004--2024 Free Software Foundation, Inc. ;; Author: Frank Küster <fr...@kuesterei.ch> ;; Maintainer: auctex-devel@gnu.org @@ -27,20 +27,29 @@ ;; This file adds general support for basic LaTeX commands used for ;; writing LaTeX class files (.cls), style files (.sty) and package -;; files (.dtx). Most of the macros are taken from clsguide.pdf. +;; files (.dtx). Most of the macros are taken from clsguide.pdf and +;; fntguide.pdf ;;; Code: (require 'tex) +(require 'latex) ;; Silence the compiler: (declare-function font-latex-add-keywords "font-latex" (keywords class)) +(defvar LaTeX-property-list '("abspage" "page" "pagenum" "label" + "title" "target" "pagetarget" + "counter" "xpos" "ypos") + "List of properties predefined in LaTeX kernel.") + (TeX-add-style-hook "ltx-base" (lambda () + + ;; Macros from clsguide.pdf (TeX-add-symbols ;; 4.1 Identification. Other '\Provide*' macros are available in @@ -54,35 +63,31 @@ '("LoadClass" [ "Options" ] "Class" [ "Release information" ]) '("LoadClassWithOptions" "Class" [ "Release information" ]) - ;; 4.3 Option declaration - '("DeclareOption" "Option" t) - '("DeclareOption*" t) - - ;; 4.4 Commands within option code - '("CurrentOption" 0) - '("OptionNotUsed" 0) - - ;; 4.5 Moving options around - '("PassOptionsToPackage" "Option(s) list" "Package") - '("PassOptionsToClass" "Option(s) list" "Class") - - ;; 4.6 Delaying code + ;; 4.3 Delaying code '("AtEndOfPackage" t) '("AtEndOfClass" t) '("AtBeginDocument" t) '("AtEndDocument" t) - '("AtBeginDvi" t) + ;; Marked as legacy LaTeX code: + ;; '("AtBeginDvi" t) - ;; 4.7 Option processing - '("ProcessOptions" (TeX-arg-literal "\\relax")) - "ProcessOptions*" - '("ExecuteOptions" "Option list") - ;; 4.8 Safe file commands + ;; 4.4 Creating and using keyval option: + '("DeclareKeys" ["Family"] t) + '("DeclareUnknownKeyHandler" ["Family"] t) + '("ProcessKeyOptions" ["Family"]) + '("SetKeys" ["Family"] t) + + ;; 4.5 Passing options around + '("PassOptionsToPackage" "Option(s) list" "Package") + '("PassOptionsToClass" "Option(s) list" "Class") + + ;; 4.6 Safe file commands '("IfFileExists" "File" 2) '("InputIfFileExists" "File" 2) - ;; 4.9 Reporting errors, etc + + ;; 4.7 Reporting errors, etc '("ClassError" "Class name" "Error text" t) '("PackageError" "Package name" "Error text" t) @@ -97,7 +102,44 @@ '("MessageBreak" 0) '("message" "Log Message") - ;; 4.10 Defining commands + ;; 5.1 Layout parameters + ;; \paperheight & \paperwidth are in latex.el + + ;; 5.2 Case changing + ;; \MakeUppercase, \MakeLowercase & \MakeTitlecase are in latex.el + + ;; 5.3 Better user-defined math display environments + "ignorespacesafterend" + + ;; 5.4 Normalising spacing + "normalsfcodes" + + ;; 5.5 Querying localisation: TBD + + ;; 5.6 Extended and expandable references of properties + '("RecordProperties" "Label" + (TeX-arg-completing-read-multiple LaTeX-property-list "Property")) + '("RefProperty" "Label" + (TeX-arg-completing-read LaTeX-property-list "Property")) + '("RefUndefinedWarn" "Label" + (TeX-arg-completing-read LaTeX-property-list "Property")) + + '("NewProperty" "Name" + (TeX-arg-completing-read ("now" "shipout") "Setpoint") + "Default" t) + '("SetProperty" "Name" + (TeX-arg-completing-read ("now" "shipout") "Setpoint") + "Default" t) + + ;; 5.7 Preparing link targets + '("MakeLinkTarget" ["Prefix"] TeX-arg-counter) + '("MakeLinkTarget*" "Target name") + + '("LinkTargetOn" 0) + '("LinkTargetOff" 0) + '("NextLinkTarget" "Target name") + + ;; 6.1 Defining commands '("DeclareRobustCommand" TeX-arg-define-macro [ TeX-arg-define-macro-arguments ] t) '("DeclareRobustCommand*" @@ -106,30 +148,164 @@ '("CheckCommand" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t) '("CheckCommand*" TeX-arg-macro [ TeX-arg-define-macro-arguments ] t) - ;; 5.1 Layout parameters - ;; \paperheight & \paperwidth are provided in latex.el - - ;; 5.2 Case changing - ;; \MakeUppercase & \MakeLppercase are provided in latex.el + ;; 6.2 Option declaration + '("DeclareOption" "Option" t) + '("DeclareOption*" t) - ;; 5.4 Better user-defined math display environments - "ignorespacesafterend" + ;; 6.3 Commands within option code + '("CurrentOption" 0) + '("OptionNotUsed" 0) - ;; 5.5 Normalising spacing - "normalsfcodes" + ;; 6.4 Option processing + '("ProcessOptions" (TeX-arg-literal "\\relax")) + "ProcessOptions*" + '("ExecuteOptions" "Option list") ;; Some general macros not mentioned in clsguide.pdf '("@addtoreset" TeX-arg-counter (TeX-arg-counter "Within counter")) '("addpenalty" "Penalty") '("@ifundefined" TeX-arg-macro 2) '("@ifnextchar" (TeX-arg-literal " ") (TeX-arg-free "Character") 2) - '("expandafter" 0) + '("expandafter" 0) ) - ;; These macros are currently (June 2022) described in ltkeys.dtx: - '("DeclareKeys" ["Family"] t) - '("DeclareUnknownKeyHandler" ["Family"] t) - '("ProcessKeyOptions" ["Family"]) - '("SetKeys" ["Family"] t)) + ;; Run the style hook so we can use `LaTeX-fontenc-package-options': + (TeX-run-style-hooks "fontenc") + + ;; Macros from fntguide.pdf + (TeX-add-symbols + + ;; 2.5 Special font declaration commands + '("DeclareFixedFont" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 4) + '("DeclareTextFontCommand" TeX-arg-define-macro t) + '("DeclareOldFontCommand" TeX-arg-define-macro 2) + + ;; 3.3 Declaring math versions + '("DeclareMathVersion" "Version") + + ;; 3.4 Declaring math alphabets + '("DeclareMathAlphabet" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 3) + '("SetMathAlphabet" TeX-arg-define-macro + "Version" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 3) + + ;; 3.5 Declaring symbol fonts + '("DeclareSymbolFont" "Symbol font" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 3) + '("SetSymbolFont" "Symbol font" "Version" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 3) + '("DeclareSymbolFontAlphabet" TeX-arg-define-macro "Symbol font") + + ;; 3.6 Declaring math symbols + '("DeclareMathSymbol" "Symbol" + (TeX-arg-completing-read ("0" "1" "2" "3" "4" "5" "6" "7" + "\\marthord" "\\mathop" "\\mathbin" + "\\mathrel" "\\mathopen" "\\mathclose" + "\\mathpunct" "\\mathalph") + "Type") + 2) + '("DeclareMathDelimiter" "Symbol" + (TeX-arg-completing-read ("0" "1" "2" "3" "4" "5" "6" "7" + "\\marthord" "\\mathop" "\\mathbin" + "\\mathrel" "\\mathopen" "\\mathclose" + "\\mathpunct" "\\mathalph") + "Type") + 4) + '("DeclareMathAccent" TeX-arg-define-macro + (TeX-arg-completing-read ("0" "1" "2" "3" "4" "5" "6" "7" + "\\marthord" "\\mathop" "\\mathbin" + "\\mathrel" "\\mathopen" "\\mathclose" + "\\mathpunct" "\\mathalph") + "Type") + 2) + '("DeclareMathRadical" TeX-arg-define-macro 4) + + ;; 3.7 Declaring math sizes + '("DeclareMathSizes" 4) + + ;; 4.2 Font definition file commands + '("DeclareFontFamily" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 2) + '("DeclareFontShape" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 5) + '("DeclareSizeFunction" 2) + + ;; 5.2 Encoding definition file commands + '("DeclareFontEncoding" "Encoding" 2) + '("DeclareTextCommand" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + [TeX-arg-define-macro-arguments] t) + '("ProvideTextCommand" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + [TeX-arg-define-macro-arguments] t) + '("DeclareTextSymbol" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + "Slot") + '("DeclareTextAccent" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + "Slot") + '("DeclareTextComposite" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 2) + '("DeclareTextCompositeCommand" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 2) + "LastDeclaredEncoding" + + ;; 5.3 Default definitions + '("DeclareTextCommandDefault" TeX-arg-define-macro t) + '("DeclareTextAccentDefault" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding")) + '("DeclareTextSymbolDefault" TeX-arg-define-macro + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding")) + '("ProvideTextCommandDefault" TeX-arg-define-macro t) + + ;; 5.4 Encoding defaults + '("DeclareFontEncodingDefaults" 2) + '("DeclareFontSubstitution" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 3) + + ;; 6.1 Font substitution + '("DeclareErrorFont") + "fontsubfuzz" + + ;; 6.2 Preloading + '("DeclarePreloadSizes" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 4) + + ;; 6.6 Font series defaults per document family + '("DeclareFontSeriesDefault" + [TeX-arg-completing-read ("rm" "sf" "tt") "Meta family"] + (TeX-arg-completing-read ("bf" "md") "Meta series") + "Series value") + + ;; 6.7 Handling of nested emphasis + '("DeclareEmphSequence" + (TeX-arg-completing-read-multiple (lambda () + (mapcar (lambda (x) + (concat TeX-esc x)) + LaTeX-font-shape)) + "Font declarations")) + + ;; 6.8 Providing font family substitutions + '("DeclareFontFamilySubstitution" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 2) + + ;; 7 Additional text symbols - textcomp + '("DeclareEncodingSubset" + (TeX-arg-completing-read LaTeX-fontenc-package-options "Encoding") + 2) ) ;; Fontification (when (and (featurep 'font-latex) @@ -150,18 +326,79 @@ ("AtEndOfClass" "") ("AtBeginDocument" "") ("AtEndDocument" "") - ("AtBeginDvi" "") + + ("DeclareKeys" "[{") + ("DeclareUnknownKeyHandler" "[{") + ("ProcessKeyOptions" "[") + ("SetKeys" "[{") + + ("RefUndefinedWarn" "{{") + ("NewProperty" "{{{{") + ("SetProperty" "{{{{") + + ("MakeLinkTarget" "*[{") + ("LinkTargetOn" "") + ("LinkTargetOff" "") + ("NextLinkTarget" "") ("ProcessOptions" "*") ("ExecuteOptions" "{") ("DeclareRobustCommand" "*|{\\[[{") ("CheckCommand" "*|{\\[[{") - ("DeclareKeys" "[{") - ("DeclareUnknownKeyHandler" "[{") - ("ProcessKeyOptions" "[") - ("SetKeys" "[{")) - 'function))) + ("DeclareFixedFont" "|{\\{{{{{") + ("DeclareTextFontCommand" "|{\\|{\\") + ("DeclareOldFontCommand" "|{\\|{\\|{\\") + + ("DeclareMathVersion" "{") + ("DeclareMathAlphabet" "|{\\{{{{") + ("SetMathAlphabet" "|{\\{{{{{") + + ("DeclareSymbolFont" "{{{{{") + ("SetSymbolFont" "{{{{{{") + ("DeclareSymbolFontAlphabet" "|{\\{") + + ("DeclareMathSymbol" "|{\\|{\\{{") + ("DeclareMathDelimiter" "|{\\|{\\{{{{") + ("DeclareMathAccent" "|{\\{{{") + ("DeclareMathRadical" "|{\\{{{{") + + ("DeclareMathSizes" "{{{{") + + ("DeclareFontFamily" "{{{") + ("DeclareFontShape" "{{{{{{") + + ("DeclareFontEncoding" "{{{") + ("DeclareTextCommand" "|{\\{[[{") + ("ProvideTextCommand" "|{\\{[[{") + ("DeclareTextSymbol" "|{\\{{") + ("DeclareTextAccent" "|{\\{{") + ("DeclareTextComposite" "|{\\{{{") + ("DeclareTextCompositeCommand" "|{\\{{{") + + ("DeclareTextCommandDefault" "|{\\|{\\") + ("DeclareTextAccentDefault" "|{\\{") + ("DeclareTextSymbolDefault" "|{\\{") + ("ProvideTextCommandDefault" "|{\\|{\\") + + ("DeclareFontEncodingDefaults" "{{") + ("DeclareFontSubstitution" "{{{{") + + ("DeclareErrorFont" "{{{{") + + ("DeclarePreloadSizes" "{{{{{") + + ("DeclareFontSeriesDefault" "[{{") + + ("DeclareEmphSequence" "{") + + ("DeclareFontFamilySubstitution" "{{{") + + ("DeclareEncodingSubset" "{{{")) + 'function) + (font-latex-add-keywords '(("RecordProperties" "{{") + ("RefProperty" "{{")) + 'reference) )) TeX-dialect) ;; Local Variables: diff --git a/style/xparse.el b/style/xparse.el index ed136702..a39e9f96 100644 --- a/style/xparse.el +++ b/style/xparse.el @@ -1,6 +1,6 @@ ;;; xparse.el --- AUCTeX style for `xparse.sty' version 2022-07-05 -*- lexical-binding: t; -*- -;; Copyright (C) 2013--2023 Free Software Foundation, Inc. +;; Copyright (C) 2013--2024 Free Software Foundation, Inc. ;; Maintainer: auctex-devel@gnu.org ;; Author: Mosè Giordano <m...@gnu.org> @@ -27,15 +27,28 @@ ;; The content of this file is now (December 2023) part of latex.el ;; and font-latex.el. This style provides only completion for xparse -;; package options. +;; package options and some macros re-allocated from the kernel back +;; into xparse.sty with LaTeX release 2023-11-01. ;; The "yet not more supported" specifiers `l', `u', `g' and `G' are ;; ignored completely and may lead to wrong parsing results. ;;; Code: +(require 'tex) (require 'latex) +(TeX-add-style-hook + "xparse" + (lambda () + (TeX-add-symbols + ;; Access to the argument specification + '("GetDocumentCommandArgSpec" TeX-arg-macro) + '("GetDocumentEnvironmmentArgSpec" TeX-arg-environment) + '("ShowDocumentCommandArgSpec" TeX-arg-macro) + '("ShowDocumentEnvironmentArgSpec" TeX-arg-environment))) + TeX-dialect) + (defvar LaTeX-xparse-package-options-list '(("log-declarations" ("true" "false"))) "Package options for the xparse package.") diff --git a/tex-info.el b/tex-info.el index fc10f018..9f919ee3 100644 --- a/tex-info.el +++ b/tex-info.el @@ -31,9 +31,6 @@ (require 'texinfo) -;; Silence the compiler for variables: -(defvar outline-heading-alist) - ;;; Environments: (defvar Texinfo-environment-list '(("cartouche") ("command") ("copying") ("defcv") ("deffn") ("defivar") @@ -672,13 +669,12 @@ value of `Texinfo-mode-hook'." (set (make-local-variable 'syntax-propertize-function) texinfo-syntax-propertize-function) - ;; 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) - ;; "\\>")) + (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) @@ -873,16 +869,6 @@ Run after mode hooks and file local variables application." 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) diff --git a/tex.el b/tex.el index 9987937a..053a0ade 100644 --- a/tex.el +++ b/tex.el @@ -526,8 +526,8 @@ string." (defcustom TeX-command-extra-options "" "String with the extra options to be given to the TeX processor." - :type 'string - :local t) + :type 'string) +(make-variable-buffer-local 'TeX-command-extra-options) (defvar TeX-command-text nil "Dynamically bound by `TeX-command-expand'.") @@ -1601,8 +1601,8 @@ It should be one of the following symbols:\n\n" :type `(choice ,@(mapcar (lambda (x) `(const :tag ,(nth 1 x) ,(car x))) (TeX-engine-alist))) - :safe (lambda (arg) (memq arg (mapcar #'car TeX-engine-alist-builtin))) - :local t) + :safe (lambda (arg) (memq arg (mapcar #'car TeX-engine-alist-builtin)))) +(make-variable-buffer-local 'TeX-engine) (defun TeX-engine-set (type) "Set TeX engine to TYPE. @@ -2117,17 +2117,17 @@ Programs should not use this variable directly but the function (const :tag "No DVI to PDF conversion" nil) (const :tag "dvips - ps2pdf sequence" "Dvips") (const :tag "dvipdfmx" "Dvipdfmx")) - :safe #'string-or-null-p - ;; If you plan to support new values of `TeX-PDF-from-DVI' remember - ;; to update `TeX-command-default' accordingly. - :local t) + :safe #'string-or-null-p) +;; If you plan to support new values of `TeX-PDF-from-DVI' remember to update +;; `TeX-command-default' accordingly. +(make-variable-buffer-local 'TeX-PDF-from-DVI) (defcustom TeX-PDF-via-dvips-ps2pdf nil "Whether to produce PDF output through the (La)TeX - dvips - ps2pdf sequence." :group 'TeX-command :type 'boolean - :safe #'booleanp - :local t) + :safe #'booleanp) +(make-variable-buffer-local 'TeX-PDF-via-dvips-ps2pdf) (make-obsolete-variable 'TeX-PDF-via-dvips-ps2pdf 'TeX-PDF-from-DVI "11.90") (defun TeX-PDF-from-DVI () @@ -2158,21 +2158,21 @@ for backward compatibility." (defcustom TeX-command-BibTeX "BibTeX" "The name of the BibTeX entry in `TeX-command-list'." :group 'TeX-command-name - :type 'string - :local t) + :type 'string) + (make-variable-buffer-local 'TeX-command-BibTeX) (defcustom TeX-command-Biber "Biber" "The name of the Biber entry in `TeX-command-list'." :group 'TeX-command-name - :type 'string - :local t) + :type 'string) + (make-variable-buffer-local 'TeX-command-Biber) (defcustom TeX-command-Show "View" "The default command to show (view or print) a TeX file. Must be the car of an entry in `TeX-command-list'." :group 'TeX-command-name - :type 'string - :local t) + :type 'string) + (make-variable-buffer-local 'TeX-command-Show) (defcustom TeX-command-Print "Print" "The name of the Print entry in `TeX-command-Print'." @@ -2293,8 +2293,8 @@ It is suggested that you use the File Variables (see the info node (string :format "%v")) :safe (lambda (x) (or (stringp x) - (member x (quote (t nil shared dwim))))) - :local t) + (member x (quote (t nil shared dwim)))))) +(make-variable-buffer-local 'TeX-master) (defcustom TeX-one-master "\\.\\(texi?\\|dtx\\)$" "Regular expression matching ordinary TeX files. @@ -2532,8 +2532,8 @@ is assumed to be the same as the directory of `TeX-master'." :group 'TeX-file :safe #'string-or-null-p :type '(choice (const :tag "Directory of master file" nil) - (string :tag "Custom" "build")) - :local t) + (string :tag "Custom" "build"))) +(make-variable-buffer-local 'TeX-output-dir) (defun TeX--master-output-dir (master-dir relative-to-master &optional ensure) "Return the directory path where output files should be placed. @@ -3266,8 +3266,9 @@ See `completion-at-point-functions'." (defcustom TeX-default-macro "ref" "The default macro when creating new ones with `TeX-insert-macro'." :group 'TeX-macro - :type 'string - :local t) + :type 'string) + +(make-variable-buffer-local 'TeX-default-macro) (defcustom TeX-insert-braces t "If non-nil, append an empty pair of braces after inserting a macro. @@ -3288,8 +3289,8 @@ will use its value to decide what to do, whatever the value of the variable `TeX-insert-braces'." :group 'TeX-macro :type '(repeat (cons (string :tag "Macro name") - (boolean :tag "Append braces?"))) - :local t) + (boolean :tag "Append braces?")))) +(make-variable-buffer-local 'TeX-insert-braces-alist) (defcustom TeX-insert-macro-default-style 'show-optional-args "Specifies whether `TeX-insert-macro' will ask for all optional arguments. @@ -4308,8 +4309,8 @@ It can also be a name of a variable having such value." (group (regexp :tag "Match") (sexp :tag "Groups") symbol))) - :group 'TeX-parse - :local t) + :group 'TeX-parse) + (make-variable-buffer-local 'TeX-auto-regexp-list) (defun TeX-auto-add-regexp (regexp) "Add REGEXP to `TeX-auto-regexp-list' if not already a member." @@ -4356,16 +4357,16 @@ alter the numbering of any ordinary, non-shy groups.") (defcustom TeX-auto-parse-length 999999 "Maximal length of TeX file (in characters) that will be parsed." :group 'TeX-parse - :type 'integer - :local t) + :type 'integer) + (make-variable-buffer-local 'TeX-auto-parse-length) (defcustom TeX-auto-x-parse-length 0 "Maximum length of TeX file that will be parsed additionally. Use `TeX-auto-x-regexp-list' for parsing the region between `TeX-auto-parse-length' and this value." :group 'TeX-parse - :type 'integer - :local t) + :type 'integer) + (make-variable-buffer-local 'TeX-auto-x-parse-length) (defcustom TeX-auto-x-regexp-list 'LaTeX-auto-label-regexp-list "List of regular expressions used for additional parsing. @@ -4382,8 +4383,8 @@ See `TeX-auto-x-parse-length'." (group (regexp :tag "Match") (sexp :tag "Groups") symbol))) - :group 'TeX-parse - :local t) + :group 'TeX-parse) + (make-variable-buffer-local 'TeX-auto-x-regexp-list) (defun TeX-regexp-group-count (regexp) "Return number of groups in a REGEXP. This is not foolproof: @@ -4533,8 +4534,9 @@ Check for potential LaTeX environments." (defcustom TeX-default-extension "tex" "Default extension for TeX files." :group 'TeX-file-extension - :type 'string - :local t) + :type 'string) + + (make-variable-buffer-local 'TeX-default-extension) (defvar TeX-doc-extensions '("dvi" "pdf" "ps" "txt" "html" "dvi\\.gz" "pdf\\.gz" "ps\\.gz" "txt\\.gz" @@ -8741,12 +8743,6 @@ variable is nil." ;;; Process Control -;; COMPATIBILITY for emacs < 27 -(if (< emacs-major-version 27) - (or (assq 'compilation-in-progress minor-mode-alist) - (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") - minor-mode-alist)))) - (defun TeX-process-get-variable (name symbol &optional default) "Return the value in the process buffer for NAME of SYMBOL. @@ -8769,22 +8765,31 @@ Return nil only if no process buffer exists." t) nil))) +(defcustom TeX-kill-process-without-query nil + "If non-nil, abort a running document process without user query." + :type 'boolean + :safe #'booleanp + :group 'TeX-command) +(make-variable-buffer-local 'TeX-kill-process-without-query) + (defun TeX-process-check (name) - "Check if a process for the TeX document NAME already exist. + "Check if a process for the TeX document NAME already exists. If so, give the user the choice of aborting the process or the current -command." +command. If the value of `TeX-kill-process-without-query' is non-nil, +user query is skipped and the process is aborted right away." (let (process) (while (and (setq process (TeX-process name)) (eq (process-status process) 'run)) (cond - ((yes-or-no-p (concat "Process `" - (process-name process) - "' for document `" - name - "' running, kill it? ")) + ((or TeX-kill-process-without-query + (yes-or-no-p (concat "Process `" + (process-name process) + "' for document `" + name + "' running, kill it? "))) (delete-process process)) ((eq (process-status process) 'run) - (error "Cannot have two processes for the same document")))))) + (error "Cannot have two processes for the same document")))))) (defun TeX-process-buffer-name (name) "Return name of AUCTeX buffer associated with the document NAME." diff --git a/texmathp.el b/texmathp.el index 3316c461..b4ccf7ce 100644 --- a/texmathp.el +++ b/texmathp.el @@ -1,6 +1,6 @@ ;;; texmathp.el -- Code to check if point is inside LaTeX math environment -*- lexical-binding: t; -*- -;; Copyright (C) 1998-2022 Free Software Foundation, Inc. +;; Copyright (C) 1998-2024 Free Software Foundation, Inc. ;; Author: Carsten Dominik <domi...@strw.leidenuniv.nl> ;; Maintainer: auctex-devel@gnu.org @@ -325,8 +325,10 @@ See the variable `texmathp-tex-commands' about which commands are checked." ;; return immediately nil. This relies on the function ;; `LaTeX-verbatim-p'. We add a check here in case this library ;; is used stand-alone without latex.el provided by AUCTeX - ;; (bug#61410): - (if (and (fboundp 'LaTeX-verbatim-p) + ;; (bug#61410) and the `major-mode' doesn't derive from `TeX-mode' + ;; (bug#69681): + (if (and (derived-mode-p 'TeX-mode) + (fboundp 'LaTeX-verbatim-p) (LaTeX-verbatim-p (cdr match))) (progn (setq texmathp-why `(nil . ,(cdr match)))