branch: externals/auctex commit 406eb61fc156d2c4f76a1cfc75330299fcca18c4 Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
Make user query before killing a process optional * doc/auctex.texi (Starting a Command): * doc/changes.texi: Announce and document the new variable. * tex.el (TeX-kill-process-without-query): New custom variable. (TeX-process-check): Use it. (bug#34645) --- doc/auctex.texi | 6 ++++++ doc/changes.texi | 5 +++++ tex.el | 23 ++++++++++++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/doc/auctex.texi b/doc/auctex.texi index 91b8c40ab9..b499c63bef 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 diff --git a/doc/changes.texi b/doc/changes.texi index 7fdf5d4669..2ac2ee056f 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -177,6 +177,11 @@ 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/tex.el b/tex.el index d53ef39be2..da2f91fe43 100644 --- a/tex.el +++ b/tex.el @@ -8769,22 +8769,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 + :local t + :safe #'booleanp + :group 'TeX-command) + (defun TeX-process-check (name) "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."