[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#70525: [PATCH] Make auto-reveal customizations easier to extend
From: |
Arash Esbati |
Subject: |
bug#70525: [PATCH] Make auto-reveal customizations easier to extend |
Date: |
Tue, 30 Apr 2024 09:02:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi Paul,
Paul Nelson <ultrono@gmail.com> writes:
> I think what you describe is indeed the plan, but I'll elaborate just
> in case. I had in mind that external packages would add to
> *-reveal-commands via setup functions, with lines such as
>
> (add-to-list 'preview-auto-reveal-commands #'tex-parens-down-list)
>
> Users can similarly add their own commands in their own config. This
> is simpler than adding to the internals of the lisp form in the
> current default value of *-reveal.
>
> Of course, this is only for users who use the default setting. Other
> users can continue to customize the *-reveal behavior however they
> prefer.
Thanks. In this case, I think we can have a sort of API by patching the
function `TeX-fold-auto-reveal-p' and declaring a standard var like this:
--8<---------------cut here---------------start------------->8---
(defvar-local TeX-fold-auto-reveal-external-commands nil
"List of external commands which may cause a fold to be revealed.
This is list is intended for external packages ...")
(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)))
;; Clause modified:
((and (consp mode)
(null TeX-fold-auto-reveal-external-commands))
(apply (car mode) (cdr mode)))
;; Clause added:
((and (consp mode) TeX-fold-auto-reveal-external-commands)
(apply (car mode) (cons (caadr mode)
(append TeX-fold-auto-reveal-external-commands
(cdadr mode)))))
(t mode)))
--8<---------------cut here---------------end--------------->8---
Does this make sense? The question would then be: Should
`TeX-fold-auto-reveal-external-commands' be a regualar var or a custom
one?
> I'm not sure I understand what you mean when you say "that value is
> used when *-reveal is set". The value would be used every time the
> lisp form in *-reveal is evaluated by the preview/folding libraries.
Yes, sorry, I should have looked more carefully. I'm not that familiar
with the code, so bear with me.
Best, Arash
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Paul Nelson, 2024/04/22
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Arash Esbati, 2024/04/29
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Paul Nelson, 2024/04/29
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend,
Arash Esbati <=
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Paul Nelson, 2024/04/30
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Arash Esbati, 2024/04/30
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Paul Nelson, 2024/04/30
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Arash Esbati, 2024/04/30
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Paul Nelson, 2024/04/30
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Arash Esbati, 2024/04/30
- bug#70525: [PATCH] Make auto-reveal customizations easier to extend, Paul Nelson, 2024/04/30