bug-auctex
[Top][All Lists]
Advanced

[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 10:19:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Paul Nelson <ultrono@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]