Subject: Re: bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc

From: João Távora <[email-masked]>
Date: Sun, 28 Mar 2021 19:56:13 +0100

Stefan Monnier <[email-masked]> writes:

>>   (when (function-equal #'ignore eldoc-documentation-function)
>>         (setq-local eldoc-documentation-function #'eldoc-documentation-default|compose|whatever))))
>
> BTW, using code like the one above is tolerable, usually for historical
> reasons, but new APIs should aim not to need such things: comparing
> functions is fundamentally always a hack.

So is run-time version checking, the risk is mostly the same.  But sure,
it's way uglier.  It's what needs to be done, as long as the package
developer want to support these features on a "as soon as possible"
basis _without_ adding the Eldoc core package as dependency.

But a simple version check on (< emacs-major-version 28) with two simple
branches works fine as well.

(if (< emacs-major-version 28)
    (the-before-until-thingy)
  (the-modern-thingy-but-no-comparing-functions))

Anyway, have you given thought to the possibility of having Eldoc.el
clobber the default value of eldoc-documentation-function if it finds it
unchanged?  This would just fix the case of Emacs < 28 && new eldoc for
developers who don't want to write the above snippet.  Not sure if it's
worth it, but Alex's original request goes in this direction.

Note that that all this mess has to do with the silliness that is having
eldoc.el be preloaded just becuase elisp-mode.el.  How would we go about
fixing that?

João