Subject: 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:45:47 +0100

Alex Branham <[email-masked]> writes:

>>> If that's right, it seems like a step backwards, ease-of-setup-wise at
>>> least, from the simple
>>>
>>> (add-function :before-until (local 'eldoc-documentation-function)
>>> #'ess-r-eldoc-function)
>>
>> You can still just that and call it a day.  Just that, because the new
>> eldoc in the yet-unreleased Emacs 28 is backward compatible.  I've tried
>> to explain this three times already in this exchange.
>
> Thanks. I'd like to support the new way (so users can customize
> eldoc-documentation-function) and the old way, which I thought I had
> said previously. It seems like the above is the officially blessed way
> to do both so I suppose that's what we'll go with.

No idea what the "above" is, let me just summarize the cases:

(1) You have Emacs <= 27.1 and no new eldoc.el package
(2) You have Emacs <= 27.1 and a new eldoc.el package
(3) You have Emacs >= 28

The typical (fboundp 'eldoc-documentation-functions) check works great
for cases 1 and 3: you support the new and the old way.  Now, sometime
in 2020 I introduced the possibility of delivering new Eldoc features to
released versions, via the Eldoc ELPA "core" package.  That gave rise to
case 2: it's offering a new possiblity to support new Eldoc features
early, it doesn't remove any possibilities.

So:

a) If you want to support the new Eldoc features in cases 2 and 3, you
   have to use the more complex snippet (with or without the
   byte-compiler warning, you decide if it bothers you)

b) If, on the other hand, you just want to support 1 and 3, just use a
   check on emacs-major-version, instead of the fboundp check.

c) If you're confident that your users won't be missing the new eldoc.el
   features in rss-mode specifically (there's a good chance they won't
   since it's presumably what they're used to in rss-mode), just use the
   simple :before-until snippet.  And if these users do install something
   like Eglot, it will take care to do the right thing.

d) If you want to only support 2 and 3, and join the wave of the future,
   you can: Just make the eldoc.el ELPA package a dependency of the
   rss-mode, much like Eglot.

So I think you have lots of options here.

João