GNU bug report logs -
#70525
[PATCH] Make auto-reveal customizations easier to extend
Previous Next
Reported by: Paul Nelson <ultrono <at> gmail.com>
Date: Tue, 23 Apr 2024 03:56:02 UTC
Severity: normal
Tags: patch
Done: Arash Esbati <arash <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Paul Nelson <ultrono <at> 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
This bug report was last modified 1 year and 20 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.