Subject: Re: bug#66771: [PATCH] Throw out fold spec after a single failure

From: Ikumi Keita <[email-masked]>
Date: Wed, 08 Nov 2023 18:43:59 +0900

Hi Tony, sorry for late response.

>>>>> Tony Zorman via bug-auctex via Bug reporting list for AUCTeX <[email-masked]> writes:
> Right now, TeX-fold-expand-spec does not abort its expansion of the
> current spec if *any* of the expansions succeeded. This can lead to
> some unexpected behaviour. For example, given

>     (setopt TeX-fold-math-spec-list
>             '(("[1] of {1}||{1}" ("cite"))))

> expanding `\cite{this}' would result in the overlay displaying
> `… of this' instead of just `this', because one of the arguments (the
> mandatory one) succeeded. This is probably not what the user intended.
> Instead, in order for the spec to be chosen, *all* arguments should
> succeed.

> The attached patch does this.

Thank you for proposal. I think that AUCTeX can accept it and it
requires copyright assignment. Have you signed FSF copyright assignment
form before? If you haven't and want to have your proposal incorporated
into AUCTeX, please follow this instruction:
https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

> One thing that seems related is that the function claims that it also
> matches arguments of the form `(<number>)', but the regular expression
> that's used

>     "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)"

> does not contain any matches for simple parentheses. I don't know
> whether I'm missing something here, so I didn't change this.

It seems to me that it's just a bug. I think that tex-fold.el should be
corrected to include "(" and ")" in the regexp first, and your proposed
change should follow it. I'll do the former soon.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine