[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 16:50:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Paul Nelson <ultrono@gmail.com> writes:
> I don't see how this helps. We can't add commands as additional
> arguments to the user-provided my-cool-function, because we don't know
> its semantics. (Maybe it only takes two arguments, and maybe those
> arguments are strings or the time of day or the moon cycle rather than
> commands that should be compared against this-command.)
You're a tough customer ;-) What about this approach:
--8<---------------cut here---------------start------------->8---
diff --git a/tex-fold.el b/tex-fold.el
index 62f0834c..cb0f4592 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -910,6 +910,11 @@ See `TeX-fold-auto-reveal' for definitions of MODE."
Return non-nil if called by one of the commands in LIST."
(memq this-command list))
+(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 where they can add their
+functions to.")
+
;; Copy and adaption of `reveal-post-command' from reveal.el in GNU
;; Emacs on 2004-07-04.
(defun TeX-fold-post-command ()
@@ -932,7 +937,8 @@ Return non-nil if called by one of the commands in LIST."
(setq TeX-fold-open-spots (cdr spots))
(when (or disable-point-adjustment
global-disable-point-adjustment
- (TeX-fold-auto-reveal-p TeX-fold-auto-reveal))
+ (TeX-fold-auto-reveal-p TeX-fold-auto-reveal)
+ (TeX-fold-auto-reveal-p
TeX-fold-auto-reveal-external-commands))
;; Open new overlays.
(dolist (ol (nconc (when (and TeX-fold-unfold-around-mark
(TeX-active-mark))
--8<---------------cut here---------------end--------------->8---
So we don't touch `TeX-fold-auto-reveal' and just check if
`TeX-fold-auto-reveal-external-commands' contains code, just like
`TeX-fold-auto-reveal'. WDYT?
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, 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
- 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