Subject: Re: bug#19853: Acknowledgement (25.0.50; ElDoc is displayed whether eldoc-mode is enabled or not)

From: Michael Heerdegen <[email-masked]>
Date: Sun, 20 Mar 2016 20:53:55 +0100

Dmitry Gutov <[email-masked]> writes:

> On 03/20/2016 09:20 PM, Michael Heerdegen wrote:
>
> > Turning on the globalized local hook would not have an immediate effect
> > on the affected buffers I think.
>
> Not sure what you mean. Globalized local hook?
>
> If globalized mode was off, and you turn it on, it turns on the local
> mode in all relevant buffers, right away.
>
> Just try it with e.g. global-font-lock-mode.

Yes, correct.  I only overflew the sources and missed that part - my
mistake.

> > That's a valid point, the current implementation doesn't cover this
> > case.  I think
> >
> >   (setq-local global-eldoc-mode nil)
> >
> > should work, but it looks weird, and it should not be necessary to
> > modify a variable after we already have two modes.
>
> Yes, it looks silly, and might even break some expectations of the
> minor mode machinery.

If we want the global mode to push its stuff into the global hook
bindings, and not into all the local hook bindings in every single
buffer where the mode is applicable - can we achieve this with
`define-globalized-minor-mode'?  It doesn't seem so:
`define-globalized-minor-mode' doesn't accept any kind of BODY argument.
I think this is the cause of why the author reinvented it, and that in a
not fully compliant way.

Eldoc is not the only mode where this problem arises.  In general, it
can be beneficial to add to the global hook bindings: when a buffer is
affected by the global hook, but it is not current, the local hook
bindings are not run.  Sometimes this is useful (I can give an example
if you want).

But in this case, I think it is not.  So I tend to agree with you:
simply globalizing eldoc-mode would be better, if we don't miss
anything.

And then, I think making `define-globalized-minor-mode' accept a BODY
argument would be good - a globalized minor mode might want to do some
global setup.

Michael.