Subject: bug#66025: 30.0.50; eldoc.el: eldoc--invoke-strategy: register-doc defined with 4 args, called with 5

From: Vladimir Nikishkin <[email-masked]>
Date: Sat, 16 Sep 2023 17:29:06 +0800

Vladimir Nikishkin <[email-masked]> writes:

> Emacs master, hash f13b08be11533c546fed257dcf8e3812a53b672a
>
> Line 883 in file eldoc.el defines a lexical function register-doc with 4
> argumenst (pos string plist origin), which is later, at line 931, called
> with 5 arguments, (register-doc 0 res nil nil
> eldoc-documentation-strategy), which leads to an exception.
>
> I encountered this error with mu4e, which is, I guess, using the "old
> protocol" for its documentation functions. mu4e's documentation function
> is mu4e-headers-eldoc-function, which returns a string. I haven't
> understood the differences between the "new protocol" and the "old
> protocol", but I guess, in the new protocol there is some callback to
> call with the doc message, i.e. the function cannot just return a
> string.

So far I have replaced the prototype for register-doc, from (pos string
plist origin) I have made it (pos string plist origin &rest o), and
things seem to work, although I am not sure how good this solution is.
Maybe it is worth adding a try-catch there, and process the "old
protocol" in an exception handler, since, I guess eventually everyone
should use the new protocol.

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)