Right, right. It's not a pattern we can expect people to follow at this stage of Emacs evolution and popularity.

On Thu, Jan 30, 2025 at 1:47 PM Juri Linkov <juri@linkov.net> wrote:
close 75945 31.0.50
thanks

> That trick works, if a bit circuitous. Thank you.

Ok, then let's close this report.

> Is it really the case that adding an &optional argument to a hook function
> breaks those that accept only the mandatory arguments?

The caller needs to provide the optional argument in any case.
But the user still has only mandatory arguments.
Therefore the error with wrong number of arguments.

A precautious user could add '&rest args' to the end of ALL own hook
functions for the case when the callers decide to add more arguments.
Then for the caller it would be safe to call the hook
with any number of arguments.