branch: externals/auctex commit 8db1e90b6d25beb72b5ebbc706b6def64794dcf8 Author: Paul Nelson <ultr...@gmail.com> Commit: Arash Esbati <ar...@gnu.org>
Make auto-reveal customizations easier to extend * preview.el.in (preview-auto-reveal-commands): New user option. (preview-auto-reveal): Use it. * doc/preview-latex.texi (Simple customization): Document it. * tex-fold.el (TeX-fold-auto-reveal-commands): New user option. (TeX-fold-auto-reveal): Use it. (doc/auctex.texi): Document it. (bug#70525) --- doc/auctex.texi | 12 +++++++++--- doc/preview-latex.texi | 4 +++- preview.el.in | 13 +++++++++++-- tex-fold.el | 15 ++++++++++++--- 4 files changed, 35 insertions(+), 9 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/preview.el.in b/preview.el.in index 7b59a3de41..9f7db67445 100644 --- a/preview.el.in +++ b/preview.el.in @@ -1641,9 +1641,18 @@ 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) + "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, diff --git a/tex-fold.el b/tex-fold.el index 62f0834c6f..e45188a693 100644 --- a/tex-fold.el +++ b/tex-fold.el @@ -257,10 +257,19 @@ 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) + "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,