Subject: bug#79128: 31.0.50; shortdoc doesn't always display the correct arglist

From: Eli Zaretskii <[email-masked]>
Date: Sat, 02 Aug 2025 13:44:01 +0300

> From: Robert Pluim <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 01 Aug 2025 09:56:13 +0200
> 
> >>>>> On Fri, 01 Aug 2025 10:43:24 +0300, Eli Zaretskii <[email-masked]> said:
> 
>     Eli> Sorry, I'm confused wrt what is the bug/issue you are reporting here.
>     Eli> Are you saying that shortdoc is wrong in what it says?  If so, please
>     Eli> elaborate why, because I see nothing wrong with what it says, given
>     Eli> that shortdoc is supposed to be, well, short.
> 
> Shortdoc:
> 
>     >> (seq-empty-p arg &rest args)
> 
> C-h f
> 
>     >> (seq-empty-p SEQUENCE)
> 
> 
> The shortdoc implies that this is legal:
> 
> (seq-empty-p '() '())
> 
> but it gives:
> 
> Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 2)
>   #f(compiled-function (list) "Optimized implementation of `seq-empty-p' for lists." #<bytecode -0x155616500a964cb3>)(nil nil)

Ah, okay.  It would be helpful to know this from the get-go.

To answer your question:

> I imagine this is some interaction between `cl-defgeneric' with an
> implementation body, `cl-defmethod', and `help-function-arglist' (other
> functions in  the 'sequence group are also affected). C-h f gets it
> right, but I couldnʼt find a simple function in help-fns.el to get me
> the actual arglist.

The function used by "C-h f" to DTRT is help-fns--signature.  AFAICT,
in this case it basically ignores what help-function-arglist returns,
and uses the car of what help-split-fundoc returns:

      (let* ((use (cond
                   ((and usage (not (listp advertised))) (car usage)) <<<<<<

At this point, I'll step aside and leave it to Stefan and others to
explain how to solve this.