branch: externals/auctex commit 5a64a805e5b3030712b78f537a13bfdca00a84ea Merge: 56b5dab166 0caa170649 Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge remote-tracking branch 'origin/master' --- doc/auctex.texi | 12 +++++++++--- doc/preview-latex.texi | 4 +++- latex.el | 2 +- preview.el | 46 ++++++++++++++++++++++++++++++++++------------ tex-fold.el | 17 ++++++++++++++--- tex.el | 2 +- 6 files changed, 62 insertions(+), 21 deletions(-) diff --git a/doc/auctex.texi b/doc/auctex.texi index 4d338c3977..05695f0ffc 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -2864,9 +2864,15 @@ Cons cell @code{(@var{FUNCTION} . @var{ARGUMENTS})}: @AUCTeX{} calls the 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. +The default behavior is to reveal when the point enters the folded portion +via one of the commands specified in @code{TeX-fold-auto-reveal-commands}. +@end defopt + +@defopt TeX-fold-auto-reveal-commands +This is a list of commands, consulted under the default behavior of +@code{TeX-fold-auto-reveal}. By default, it consists of the commands +@kbd{@key{left}}, @kbd{@key{right}}, @kbd{C-b}, @kbd{C-f} or mouse click +under standard key binding. @end defopt diff --git a/doc/preview-latex.texi b/doc/preview-latex.texi index 0bce9747a0..84d80be1d9 100644 --- a/doc/preview-latex.texi +++ b/doc/preview-latex.texi @@ -393,7 +393,9 @@ again once the cursor leaves them again (this is also done when doing incremental search, or query-replace operations), unless you changed anything in it. In that case, you will have to regenerate the preview (via e.g., @kbd{C-c C-p C-p}). Other options for -@code{preview-auto-reveal} are available via @code{customize}. +@code{preview-auto-reveal} are available via @code{customize}. Note that +the default behavior of @code{preview-auto-reveal} derives from the list +@code{preview-auto-reveal-commands} which can be customized as well. @item Automatically cache preambles diff --git a/latex.el b/latex.el index e2d2d88e2a..5c6a851089 100644 --- a/latex.el +++ b/latex.el @@ -7160,7 +7160,7 @@ error message occurs when the \\\\ is used in a centering or flushing environment or else in the scope of a centering or flushing declaration.") - ("\\\\begin{[^ ]*} ended by \\\\end{[^ ]*}." . + ("\\\\begin{[^ ]*} \\(?:on input line [0-9]+ \\)?ended by \\\\end{[^ ]*}." . "LaTeX has found an \\end command that doesn't match the corresponding \\begin command. You probably misspelled the environment name in the \\end command, have an extra \\begin, or else forgot an \\end.") diff --git a/preview.el b/preview.el index 31df43f051..7f849827d3 100644 --- a/preview.el +++ b/preview.el @@ -1641,9 +1641,20 @@ numbers (can be float if available)." Fallback to :inherit and \\='default implemented." :group 'preview-appearance) +(defcustom preview-auto-reveal-commands + '((key-binding [left]) + (key-binding [right]) + backward-char + forward-char + pop-to-mark-command + undo) + "List of commands that may cause a preview to be revealed. +This list is consulted by the default value of `preview-auto-reveal'." + :type '(repeat (choice (function :tag "Function") + (sexp :tag "Key binding")))) + (defcustom preview-auto-reveal - '(eval (preview-arrived-via (key-binding [left]) (key-binding [right]) - #'backward-char #'forward-char)) + '(eval (apply #'preview-arrived-via preview-auto-reveal-commands)) "Cause previews to open automatically when entered. Possibilities are: t autoopens, @@ -3893,6 +3904,12 @@ If FAST is set, do a fast conversion." TeX-shell-command-option command)))) +(defvar-local preview-abort-flag nil + "Cause ongoing preview generation to abort. +If non-nil, then `preview-TeX-inline-sentinel' aborts and resets this +variable to nil. This is intended to give a way for external packages +to abort preview generation, more reliably than via process signals.") + (defun preview-TeX-inline-sentinel (process _name) "Sentinel function for preview. See `TeX-sentinel-function' and `set-process-sentinel' @@ -3901,7 +3918,12 @@ for definition of PROCESS and NAME." (let ((status (process-status process))) (if (memq status '(signal exit)) (delete-process process)) - (when (eq status 'exit) + (cond + ((with-current-buffer TeX-command-buffer + (prog1 + preview-abort-flag + (setq preview-abort-flag nil)))) + ((eq status 'exit) (save-excursion (goto-char (point-max)) (forward-line -1) @@ -3912,7 +3934,7 @@ for definition of PROCESS and NAME." (condition-case err (preview-call-hook 'open) (error (preview-log-error err "LaTeX" process))) - (preview-reraise-error process)))) + (preview-reraise-error process))))) (defcustom preview-format-extensions '(".fmt" ".efmt") "Possible extensions for format files. @@ -4111,9 +4133,9 @@ 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 +(defvar preview-preprocess-functions nil + "List of functions used to preprocess region before previewing. +The functions in this variable will each be called inside `preview-region' with one argument which is a string.") (defun preview-region (begin end) @@ -4125,11 +4147,11 @@ The function bound to this variable will be called inside TeX-region-extra))) (TeX-region-create (TeX-region-file TeX-default-extension) (let ((str (buffer-substring-no-properties begin end))) - (if preview-preprocess-function - (funcall preview-preprocess-function str) - str)) - (if (TeX-buffer-file-name) - (file-name-nondirectory (TeX-buffer-file-name)) + (dolist (fun preview-preprocess-functions) + (setq str (funcall fun str))) + str) + (if buffer-file-name + (file-name-nondirectory buffer-file-name) "<none>") (TeX-current-offset begin))) (setq TeX-current-process-region-p t) diff --git a/tex-fold.el b/tex-fold.el index 62f0834c6f..f7b1c32f53 100644 --- a/tex-fold.el +++ b/tex-fold.el @@ -257,10 +257,21 @@ After that, changing the prefix key requires manipulating keymaps." (define-key map "i" #'TeX-fold-clearout-item) map)) +(defcustom TeX-fold-auto-reveal-commands + '((key-binding [left]) + (key-binding [right]) + backward-char + forward-char + mouse-set-point + pop-to-mark-command + undo) + "List of commands that may cause a fold to be revealed. +This list is consulted by the default value of `TeX-fold-auto-reveal'." + :type '(repeat (choice (function :tag "Function") + (sexp :tag "Key binding")))) + (defcustom TeX-fold-auto-reveal - '(eval (TeX-fold-arrived-via (key-binding [left]) (key-binding [right]) - #'backward-char #'forward-char - #'mouse-set-point)) + '(eval (apply #'TeX-fold-arrived-via TeX-fold-auto-reveal-commands)) "Predicate to open a fold when entered. Possibilities are: t autoopens, diff --git a/tex.el b/tex.el index d2864b5f1d..cda1d7f646 100644 --- a/tex.el +++ b/tex.el @@ -2335,7 +2335,7 @@ It is suggested that you use the File Variables (see the info node (member x (quote (t nil shared dwim)))))) (make-variable-buffer-local 'TeX-master) -(defcustom TeX-one-master "\\.\\(texi?\\|dtx\\)$" +(defcustom TeX-one-master "\\.\\(texi?\\|[dl]tx\\)\\'" "Regular expression matching ordinary TeX files. You should set this variable to match the name of all files, where