Subject: Re: 14.0.9; Folding of math macros with a function spec is broken

From: Rahguzar <[email-masked]>
Date: Mon, 09 Jun 2025 23:03:18 +0500

Hi Paul,

"Paul D. Nelson" <[email-masked]> writes:

> Hi Raghuzar,
>
>> Currently if the spec is a function it only receives the mandatory
>> arguments. If the number of arguments is part of the spec we can allow
>> it to receive up to p+q args without breaking existing code.
>
> Regarding optional arguments, I am in the habit of extracting those
> using TeX-fold-macro-nth-arg.  This is possible because (with recent
> enough AUCTeX) the function display spec is always called with point at
> the beginning of the macro to be folded.  See for instance the
> implementation of TeX-fold-cite-display.
>
> For this reason, I'm inclined to first implement the proposal without
> changing how optional args are used - we could change that later, if
> desired.

I think the difference between passing optional arg now vs later would
be backward compatibility. Since the the signature part of spec is new
there are no backward compatibility concerns. However if people start
using the feature assuming no optional arguments are passed to the
function and we start passing them later there can be breakage.

I think passing the arguments directly to the function is more user
friendly. However, I think documenting TeX-fold-macro-nth-arg as the way
to access optional arguments is also good enough.

> Thanks, best,
> Paul

Best,
Rahguzar