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
Message #20 received at 70525 <at> debbugs.gnu.org (full text, mbox):
Paul Nelson <ultrono <at> gmail.com> writes:
> Currently, the user is promised that if *-reveal is a cons cell, then
> *-reveal-p determines whether to reveal or not by applying CAR to CDR.
> With the proposal in your email, it seems to me that that promise is
> invalidated: the "Clause Added" branch in your proposal would behave
> in strange ways when TeX-fold-auto-reveal-external-commands is non-nil
> and *-reveal is not of the same pattern as the default (in particular,
> its CDR should be a list of commands). Conceivably some users have
> customized this variable in other ways while keeping it a cons cell.
I saw that, I think the issue is usage of `eval' in the default :-(
What about this?
--8<---------------cut here---------------start------------->8---
(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)
(if (eq (car mode) #'eval)
(apply (car mode) (cons (caadr mode)
(append TeX-fold-auto-reveal-external-commands
(cdadr mode))))
(apply (car mode) (append TeX-fold-auto-reveal-external-commands
(cdr mode)))))
(t mode)))
--8<---------------cut here---------------end--------------->8---
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.