unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
@ 2021-03-25 14:05 Alex Branham
  2021-03-26 18:27 ` Basil L. Contovounesios
  2021-03-26 19:52 ` bug#47388: (no subject) QuietApe
  0 siblings, 2 replies; 21+ messages in thread
From: Alex Branham @ 2021-03-25 14:05 UTC (permalink / raw)
  To: 47388

Hello -

Emacs 27.1 ships with eldoc that defines eldoc-documentation-function as
#'ignore. If users install eglot from ELPA, this pulls in an updated
eldoc that attempts to redefine eldoc-documentation-function. However,
the value does not change (since eldoc-documentation-function is already
bound, defcustom does not update it when called in
eldoc--documentation-strategy-defcustom) so the value is still ignore,
meaning users get:

    There is no ElDoc support in this buffer

since eldoc-documentation-function is #'ignore, regardless of the value
of eldoc-documentation-functions.

Here's the bug report we received with the original issue:
https://github.com/emacs-ess/ESS/issues/1130

Thanks!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-25 14:05 bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc Alex Branham
@ 2021-03-26 18:27 ` Basil L. Contovounesios
  2021-03-26 18:50   ` João Távora
  2021-03-26 19:52 ` bug#47388: (no subject) QuietApe
  1 sibling, 1 reply; 21+ messages in thread
From: Basil L. Contovounesios @ 2021-03-26 18:27 UTC (permalink / raw)
  To: Alex Branham; +Cc: João Távora, 47388

Alex Branham <alex.branham@gmail.com> writes:

> Emacs 27.1 ships with eldoc that defines eldoc-documentation-function as
> #'ignore. If users install eglot from ELPA, this pulls in an updated
> eldoc that attempts to redefine eldoc-documentation-function. However,
> the value does not change (since eldoc-documentation-function is already
> bound, defcustom does not update it when called in
> eldoc--documentation-strategy-defcustom) so the value is still ignore,
> meaning users get:
>
>     There is no ElDoc support in this buffer
>
> since eldoc-documentation-function is #'ignore, regardless of the value
> of eldoc-documentation-functions.
>
> Here's the bug report we received with the original issue:
> https://github.com/emacs-ess/ESS/issues/1130

Thanks, CCing João.

-- 
Basil





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-26 18:27 ` Basil L. Contovounesios
@ 2021-03-26 18:50   ` João Távora
  2021-03-26 19:08     ` Alex Branham
  0 siblings, 1 reply; 21+ messages in thread
From: João Távora @ 2021-03-26 18:50 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: Alex Branham, 47388

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Alex Branham <alex.branham@gmail.com> writes:
>
>> Emacs 27.1 ships with eldoc that defines eldoc-documentation-function as
>> #'ignore. If users install eglot from ELPA, this pulls in an updated
>> eldoc that attempts to redefine eldoc-documentation-function. However,
>> the value does not change (since eldoc-documentation-function is already
>> bound, defcustom does not update it when called in
>> eldoc--documentation-strategy-defcustom) so the value is still ignore,
>> meaning users get:
>>
>>     There is no ElDoc support in this buffer
>>
>> since eldoc-documentation-function is #'ignore, regardless of the value
>> of eldoc-documentation-functions.
>>
>> Here's the bug report we received with the original issue:
>> https://github.com/emacs-ess/ESS/issues/1130
>
> Thanks, CCing João.

Thanks Basil, Alex,

Alex, exactly under what circunstances do you see that "There is no
ElDoc support in this buffer"?  In what buffer, doing what?  I
appreciate that you have investigated the implementation, but I need to
be able to understand -- and potentially reproduce -- the problem
exactly as it happened to you, so please provide as clear a recipe as
possible, perhaps starting with "downloaded Emacs 27.1, then cleared my
ELPA directory, ..., installed Eglot from xyz, ..., ".

Meanwhile (but not excluding the earlier valuable exercise), can you
show the output of:

  C-h v eldoc-documentation-function RET
  C-h v eldoc-documentation-strategy RET

?

Thanks again,
João







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-26 18:50   ` João Távora
@ 2021-03-26 19:08     ` Alex Branham
  2021-03-26 19:57       ` João Távora
  0 siblings, 1 reply; 21+ messages in thread
From: Alex Branham @ 2021-03-26 19:08 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, 47388

On Fri 26 Mar 2021 at 18:50, João Távora <joaotavora@gmail.com> wrote:

> Alex, exactly under what circunstances do you see that "There is no
> ElDoc support in this buffer"?  In what buffer, doing what?  I
> appreciate that you have investigated the implementation, but I need to
> be able to understand -- and potentially reproduce -- the problem
> exactly as it happened to you, so please provide as clear a recipe as
> possible, perhaps starting with "downloaded Emacs 27.1, then cleared my
> ELPA directory, ..., installed Eglot from xyz, ..., ".

Sure thing (though note I'm not the person who originally ran into the
bug, just was able to reproduce). From a clean install of 27.1 (no init
file, no packages), you should be able to reproduce by:

1. Add MELPA to package-archives
2. Install ESS
3. Update eldoc (potentially by installing eglot)
4. Restart Emacs
5. (require 'eglot)
6. Open an R file (eg ~/test.R)
7. At this point, eldoc-documentation-function will be #'ignore so eg
   M-x eldoc-mode will show "There is no ElDoc support in this buffer".

That's because ESS sets up eldoc in R buffers like so:

  (if (boundp 'eldoc-documentation-functions)
      (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
    (add-function :before-until (local 'eldoc-documentation-function)
                  #'ess-r-eldoc-function))

so we don't touch eldoc-documentation-function in newer eldoc versions
where it is supposed to be a user-facing customization.

> Meanwhile (but not excluding the earlier valuable exercise), can you
> show the output of:
>
>   C-h v eldoc-documentation-function RET
>   C-h v eldoc-documentation-strategy RET

Unfortunately I can't at the moment but from memory
eldoc-documentation-strategy was an obsolete alias for
eldoc-documentation-function and the value was the function ignore.

Hope that helps.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: (no subject)
  2021-03-25 14:05 bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc Alex Branham
  2021-03-26 18:27 ` Basil L. Contovounesios
@ 2021-03-26 19:52 ` QuietApe
  1 sibling, 0 replies; 21+ messages in thread
From: QuietApe @ 2021-03-26 19:52 UTC (permalink / raw)
  To: 47388

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

Hello,

I'm the user that run into this bug, the exact output of the command are:

 > C-h v eldoc-documentation-function RET

eldoc-documentation-function is a variable defined in ‘eldoc.el’.
Its value is ‘ignore’
Original value was ‘eldoc-documentation-default’
This variable has an alias: ‘eldoc-documentation-strategy’.

 > C-h v eldoc-documentation-strategy RET

eldoc-documentation-strategy is a variable defined in ‘eldoc.el’.
Its value is ‘ignore’
This variable is an alias for ‘eldoc-documentation-function’.
This variable is obsolete since eldoc-1.1.0; use 
‘eldoc-documentation-function’ instead.

If it helps to add information to what Alex said.

[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-26 19:08     ` Alex Branham
@ 2021-03-26 19:57       ` João Távora
  2021-03-26 20:23         ` Alex Branham
  0 siblings, 1 reply; 21+ messages in thread
From: João Távora @ 2021-03-26 19:57 UTC (permalink / raw)
  To: Alex Branham; +Cc: Basil L. Contovounesios, 47388

Alex Branham <alex.branham@gmail.com> writes:

> On Fri 26 Mar 2021 at 18:50, João Távora <joaotavora@gmail.com> wrote:
>
>> Alex, exactly under what circunstances do you see that "There is no
>> ElDoc support in this buffer"?  In what buffer, doing what?  I
>> appreciate that you have investigated the implementation, but I need to
>> be able to understand -- and potentially reproduce -- the problem

> 7. At this point, eldoc-documentation-function will be #'ignore so eg
                                                       ^^^^^^^^ 
So this is where I'm completely baffled.  You say this ||||||||

But earlier you said, accurately, in fact it was your first sentence, that:

>>>> Emacs 27.1 ships with eldoc that defines
>>>> eldoc-documentation-function as #'ignore.

So if it was #'ignore and still is #'ignore what exactly is the
difference that (require 'eldoc) or (require 'eglot) is introducing??

João





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-26 19:57       ` João Távora
@ 2021-03-26 20:23         ` Alex Branham
  2021-03-26 20:34           ` João Távora
  0 siblings, 1 reply; 21+ messages in thread
From: Alex Branham @ 2021-03-26 20:23 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, 47388

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

Because then we modify el-doc-functions because of the newer version of
eldoc loaded.

But the ignore value of el-doc-function prevents eldoc from working

Hopefully that helps, sorry for the brevity am on phone

On Fri, Mar 26, 2021, 3:57 PM João Távora <joaotavora@gmail.com> wrote:

> Alex Branham <alex.branham@gmail.com> writes:
>
> > On Fri 26 Mar 2021 at 18:50, João Távora <joaotavora@gmail.com> wrote:
> >
> >> Alex, exactly under what circunstances do you see that "There is no
> >> ElDoc support in this buffer"?  In what buffer, doing what?  I
> >> appreciate that you have investigated the implementation, but I need to
> >> be able to understand -- and potentially reproduce -- the problem
>
> > 7. At this point, eldoc-documentation-function will be #'ignore so eg
>                                                        ^^^^^^^^
> So this is where I'm completely baffled.  You say this ||||||||
>
> But earlier you said, accurately, in fact it was your first sentence, that:
>
> >>>> Emacs 27.1 ships with eldoc that defines
> >>>> eldoc-documentation-function as #'ignore.
>
> So if it was #'ignore and still is #'ignore what exactly is the
> difference that (require 'eldoc) or (require 'eglot) is introducing??
>
> João
>

[-- Attachment #2: Type: text/html, Size: 1964 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-26 20:23         ` Alex Branham
@ 2021-03-26 20:34           ` João Távora
  2021-03-27 12:06             ` Alex Branham
  0 siblings, 1 reply; 21+ messages in thread
From: João Távora @ 2021-03-26 20:34 UTC (permalink / raw)
  To: Alex Branham; +Cc: Basil L. Contovounesios, 47388

[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]

On Fri, Mar 26, 2021 at 8:24 PM Alex Branham <alex.branham@gmail.com> wrote:

> Because then we modify el-doc-functions because of the newer version of
> eldoc loaded.
>
> But the ignore value of el-doc-function prevents eldoc from working
>
> Hopefully that helps, sorry for the brevity am on phone
>

Ah, I get it, so ess-mode does something different.  Then
maybe it should also set eldoc-documentation-strategy
to something sensible.  Eldoc-documentation-strategy is
just the new name of eldoc-documentation-function.
If you find an `ignore` there, you're safe to change it
, buffer-locally, as you did before.  Maybe you should
even do it even if you _don't_ find an ignore there.
The fact that it's now defcustom doesn't change much
in my opinion, I don't see defcustom's as off-limits to major/minor
modes, as long as the user is still given override power
in the mode hooks.

Alternatively, ess-mode should just use the old interface.
It's still available and functional.

But I think you should select a strategy that suits `ess-mode`'s
functions.

Hope this helps,
João

[-- Attachment #2: Type: text/html, Size: 1790 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-26 20:34           ` João Távora
@ 2021-03-27 12:06             ` Alex Branham
  2021-03-27 12:53               ` João Távora
  0 siblings, 1 reply; 21+ messages in thread
From: Alex Branham @ 2021-03-27 12:06 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, 47388

On Fri 26 Mar 2021 at 20:34, João Távora <joaotavora@gmail.com> wrote:

> Ah, I get it, so ess-mode does something different.

I'm not sure I understand - different from what?

> Then maybe it should also set eldoc-documentation-strategy to
> something sensible. Eldoc-documentation-strategy is just the new name
> of eldoc-documentation-function. If you find an `ignore` there, you're
> safe to change it , buffer-locally, as you did before. Maybe you
> should even do it even if you _don't_ find an ignore there. The fact
> that it's now defcustom doesn't change much in my opinion, I don't see
> defcustom's as off-limits to major/minor modes, as long as the user is
> still given override power in the mode hooks.
>
> Alternatively, ess-mode should just use the old interface.
> It's still available and functional.
>
> But I think you should select a strategy that suits `ess-mode`'s
> functions.

So the recommended strategy to support 27.1+old eldoc, 27.1+new eldoc,
and 28.0+new eldoc is something like the below?

(if (function-equal #'ignore eldoc-documentation-function)
    (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
  (add-function :before-until (local 'eldoc-documentation-function)
                #'ess-r-eldoc-function))





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-27 12:06             ` Alex Branham
@ 2021-03-27 12:53               ` João Távora
  2021-03-28 11:23                 ` Alex Branham
  0 siblings, 1 reply; 21+ messages in thread
From: João Távora @ 2021-03-27 12:53 UTC (permalink / raw)
  To: Alex Branham, Stefan Monnier; +Cc: Basil L. Contovounesios, 47388

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]

On Sat, Mar 27, 2021 at 12:06 PM Alex Branham <alex.branham@gmail.com>
wrote:

> On Fri 26 Mar 2021 at 20:34, João Távora <joaotavora@gmail.com> wrote:
>
> > Ah, I get it, so ess-mode does something different.
>
> I'm not sure I understand - different from what?
>

It does different things depending on the situation it thinks
it finds itself in.

(if (function-equal #'ignore eldoc-documentation-function)
>     (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
>   (add-function :before-until (local 'eldoc-documentation-function)
>                 #'ess-r-eldoc-function))
>

I'm not sure you're improving much here.  My idea is that,
if you find eldoc-documentation-functions (plural) to be bound you
may need to check that eldoc-documentation-strategy (or
eldoc-documentation-function (singular)) ISN'T #ignore and
buffer-locally adjust it accordingly to something of your preference
or your users' preference.

Alternatively, you can just keep using the old technique which is a lot
of parts of Emacs do (like elisp-mode in Emacs 27.1, for example), i.e.
use the else branch in your if, and only that.  You don't seem to be using a
ny of the new ElDoc features like multiple documentation functions anyway.
That should also work for your Eglot-less rss-mode.

When using Eglot-ified rss-mode Eglot will do the right thing regardless
of the approach you take above.

All this said, I think this issue should be kept open nonetheless. If indeed
the new package's defcustom could clobber the global value of
eldoc-documentation-function if it finds it to be #'ignore I think it
should
be fine.

CC-ing Stefan Monnier for an opinion on this last part.

João Távora

[-- Attachment #2: Type: text/html, Size: 2599 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-27 12:53               ` João Távora
@ 2021-03-28 11:23                 ` Alex Branham
  2021-03-28 14:50                   ` João Távora
  0 siblings, 1 reply; 21+ messages in thread
From: Alex Branham @ 2021-03-28 11:23 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Stefan Monnier, 47388

On Sat 27 Mar 2021 at 12:53, João Távora <joaotavora@gmail.com> wrote:

> I'm not sure you're improving much here.  My idea is that,
> if you find eldoc-documentation-functions (plural) to be bound you
> may need to check that eldoc-documentation-strategy (or
> eldoc-documentation-function (singular)) ISN'T #ignore and
> buffer-locally adjust it accordingly to something of your preference
> or your users' preference.

Thanks! It sounds like the below is what you're suggesting modes do in
order to support all the possible eldoc+Emacs versions, let me know if
I've misunderstood.

(if (not (boundp 'eldoc-documentation-functions))
    ;; old eldoc
    (add-function :before-until (local 'eldoc-documentation-function)
                  #'ess-r-eldoc-function)
  ;; new eldoc
  (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
  ;; new eldoc + Emacs 27.1
  (when (and (fboundp 'eldoc-documentation-default)
             (function-equal #'ignore eldoc-documentation-function))
    (setq-local eldoc-documentation-function #'eldoc-documentation-default)))

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)

that we did before new eldoc. But maybe it's necessary, I haven't really
played around with the new eldoc features at all.

Thanks again!





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 11:23                 ` Alex Branham
@ 2021-03-28 14:50                   ` João Távora
  2021-03-28 16:05                     ` Alex Branham
  2021-03-28 16:37                     ` Stefan Monnier
  0 siblings, 2 replies; 21+ messages in thread
From: João Távora @ 2021-03-28 14:50 UTC (permalink / raw)
  To: Alex Branham; +Cc: Basil L. Contovounesios, Stefan Monnier, 47388

Alex Branham <alex.branham@gmail.com> writes:

> On Sat 27 Mar 2021 at 12:53, João Távora <joaotavora@gmail.com> wrote:
>
>> I'm not sure you're improving much here.  My idea is that,
>> if you find eldoc-documentation-functions (plural) to be bound you
>> may need to check that eldoc-documentation-strategy (or
>> eldoc-documentation-function (singular)) ISN'T #ignore and
>> buffer-locally adjust it accordingly to something of your preference
>> or your users' preference.
>
> Thanks! It sounds like the below is what you're suggesting modes do in
> order to support all the possible eldoc+Emacs versions, let me know if
> I've misunderstood.
>
> (if (not (boundp 'eldoc-documentation-functions))
>     ;; old eldoc
>     (add-function :before-until (local 'eldoc-documentation-function)
>                   #'ess-r-eldoc-function)
>   ;; new eldoc
>   (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
>   ;; new eldoc + Emacs 27.1
>   (when (and (fboundp 'eldoc-documentation-default) 
>              (function-equal #'ignore eldoc-documentation-function))
>     (setq-local eldoc-documentation-function
> #'eldoc-documentation-default)))

You don't need to be as complex as this:

(if (not (boundp 'eldoc-documentation-strategy))
    (add-function :before-until (local 'eldoc-documentation-function)
                   #'ess-r-eldoc-function)
  (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
  (when (function-equal #'ignore eldoc-documentation-function)
        (setq-local eldoc-documentation-function #'eldoc-documentation-default|compose|whatever))))

> 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.

João






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 14:50                   ` João Távora
@ 2021-03-28 16:05                     ` Alex Branham
  2021-03-28 18:45                       ` João Távora
  2021-03-28 16:37                     ` Stefan Monnier
  1 sibling, 1 reply; 21+ messages in thread
From: Alex Branham @ 2021-03-28 16:05 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Stefan Monnier, 47388-done

On Sun 28 Mar 2021 at 15:50, João Távora <joaotavora@gmail.com> wrote:

> Alex Branham <alex.branham@gmail.com> writes:
>
>> On Sat 27 Mar 2021 at 12:53, João Távora <joaotavora@gmail.com> wrote:
>>
>> Thanks! It sounds like the below is what you're suggesting modes do in
>> order to support all the possible eldoc+Emacs versions, let me know if
>> I've misunderstood.
>>
>> (if (not (boundp 'eldoc-documentation-functions))
>>     ;; old eldoc
>>     (add-function :before-until (local 'eldoc-documentation-function)
>>                   #'ess-r-eldoc-function)
>>   ;; new eldoc
>>   (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
>>   ;; new eldoc + Emacs 27.1
>>   (when (and (fboundp 'eldoc-documentation-default) 
>>              (function-equal #'ignore eldoc-documentation-function))
>>     (setq-local eldoc-documentation-function
>> #'eldoc-documentation-default)))
>
> You don't need to be as complex as this:
>
> (if (not (boundp 'eldoc-documentation-strategy))
>     (add-function :before-until (local 'eldoc-documentation-function)
>                    #'ess-r-eldoc-function)
>   (add-hook 'eldoc-documentation-functions #'ess-r-eldoc-function nil t)
>   (when (function-equal #'ignore eldoc-documentation-function)
>         (setq-local eldoc-documentation-function #'eldoc-documentation-default|compose|whatever))))

The fboundp check will avoid a byte compiler warning on Emacs<28.

>> 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.

Thanks again, closing this bug report.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 14:50                   ` João Távora
  2021-03-28 16:05                     ` Alex Branham
@ 2021-03-28 16:37                     ` Stefan Monnier
  2021-03-28 18:56                       ` João Távora
  1 sibling, 1 reply; 21+ messages in thread
From: Stefan Monnier @ 2021-03-28 16:37 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Alex Branham, 47388

>   (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.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 16:05                     ` Alex Branham
@ 2021-03-28 18:45                       ` João Távora
  0 siblings, 0 replies; 21+ messages in thread
From: João Távora @ 2021-03-28 18:45 UTC (permalink / raw)
  To: Alex Branham; +Cc: Basil L. Contovounesios, Stefan Monnier, 47388-done

Alex Branham <alex.branham@gmail.com> 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







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 16:37                     ` Stefan Monnier
@ 2021-03-28 18:56                       ` João Távora
  2021-03-28 19:09                         ` Stefan Monnier
                                           ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: João Távora @ 2021-03-28 18:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, Alex Branham, 47388

Stefan Monnier <monnier@iro.umontreal.ca> 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





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 18:56                       ` João Távora
@ 2021-03-28 19:09                         ` Stefan Monnier
  2021-03-28 19:15                           ` João Távora
  2021-03-28 19:37                         ` Stefan Monnier
  2021-03-28 19:39                         ` Stefan Monnier
  2 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier @ 2021-03-28 19:09 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Alex Branham, 47388

> 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?

We could stop preloading `elisp-mode`.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 19:09                         ` Stefan Monnier
@ 2021-03-28 19:15                           ` João Távora
  2021-03-28 19:36                             ` Stefan Monnier
  0 siblings, 1 reply; 21+ messages in thread
From: João Távora @ 2021-03-28 19:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, Alex Branham, 47388

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On Sun, Mar 28, 2021 at 8:09 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > 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?
>
> We could stop preloading `elisp-mode`.


Even better, but can you say why it's even preloaded at all?
Certainly not somebody's whim, right?

João

[-- Attachment #2: Type: text/html, Size: 783 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 19:15                           ` João Távora
@ 2021-03-28 19:36                             ` Stefan Monnier
  0 siblings, 0 replies; 21+ messages in thread
From: Stefan Monnier @ 2021-03-28 19:36 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Alex Branham, 47388

>> > 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?
>> We could stop preloading `elisp-mode`.
> Even better, but can you say why it's even preloaded at all?
> Certainly not somebody's whim, right?

The code for `emacs-lisp-mode` used to be in `lisp-mode.el` which also
contains various functions useful in all modes, so it's been preloaded
since before I started using Emacs.
When I moved (some of) the code to `progmodes/elisp-mode.el` I just
preserved that pre-existing situation.

I don't know for a fact, but based on my vague memory of what's in
`elisp-mode.el` I don't think there's a strong technical reason to
preload it.

IOW it's only preloaded because we expect it would be loaded sooner or
later anyway in many/most Emacs sessions.  I don't know if it's indeed
the case (tho it is clearly the case for *my* sessions), so you could
try to float the idea on `emacs-devel`.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 18:56                       ` João Távora
  2021-03-28 19:09                         ` Stefan Monnier
@ 2021-03-28 19:37                         ` Stefan Monnier
  2021-03-28 19:39                         ` Stefan Monnier
  2 siblings, 0 replies; 21+ messages in thread
From: Stefan Monnier @ 2021-03-28 19:37 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Alex Branham, 47388

> 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?

BTW, note also that the reason `eldoc.el` is preloaded is because
`global-eldoc-mode` is enabled by default, rather than because
`elisp-mode` is itself preloaded.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc
  2021-03-28 18:56                       ` João Távora
  2021-03-28 19:09                         ` Stefan Monnier
  2021-03-28 19:37                         ` Stefan Monnier
@ 2021-03-28 19:39                         ` Stefan Monnier
  2 siblings, 0 replies; 21+ messages in thread
From: Stefan Monnier @ 2021-03-28 19:39 UTC (permalink / raw)
  To: João Távora; +Cc: Basil L. Contovounesios, Alex Branham, 47388

>>>   (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.

I just wanted to make sure that it's only needed for backward
compatibility reasons.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-03-28 19:39 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-25 14:05 bug#47388: 27.1; eldoc-documentation-function is ignore in updated eldoc Alex Branham
2021-03-26 18:27 ` Basil L. Contovounesios
2021-03-26 18:50   ` João Távora
2021-03-26 19:08     ` Alex Branham
2021-03-26 19:57       ` João Távora
2021-03-26 20:23         ` Alex Branham
2021-03-26 20:34           ` João Távora
2021-03-27 12:06             ` Alex Branham
2021-03-27 12:53               ` João Távora
2021-03-28 11:23                 ` Alex Branham
2021-03-28 14:50                   ` João Távora
2021-03-28 16:05                     ` Alex Branham
2021-03-28 18:45                       ` João Távora
2021-03-28 16:37                     ` Stefan Monnier
2021-03-28 18:56                       ` João Távora
2021-03-28 19:09                         ` Stefan Monnier
2021-03-28 19:15                           ` João Távora
2021-03-28 19:36                             ` Stefan Monnier
2021-03-28 19:37                         ` Stefan Monnier
2021-03-28 19:39                         ` Stefan Monnier
2021-03-26 19:52 ` bug#47388: (no subject) QuietApe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).