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 22:10:42 +0100

Dmitry Gutov <[email-masked]> writes:

> > 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'?
>
> You could use :after-hook argument.

Thanks.

> But it doesn't seem like what we should in do cases like this: what
> would (eldoc-mode -1) do if the globalized mode has modified the
> global hook values? We can't modify those locally.

Yes.  I think turning `globalized-eldoc-mode' could change the default
value of `eldoc-mode', while the local `eldoc-mode' changes the local
value (as it does now).

But that would lead to another problem: if the user has both modes off,
then turns on the local mode in some buffer, and after that turns on the
global mode as well, we have the stuff in both the global and the local
hook bindings.

Hmm, I think the only way out would be to add the stuff to the global
hook bindings unconditionally when eldoc is loaded - no matter whether
the global mode is on or not, and never remove it.  And use only one
(buffer local) variable for controlling, `eldoc-mode', that the local
mode sets locally.  The variable `global-eldoc-mode' would not appear in
the code any more.  `global-eldoc-mode' would become a trivial
globalized minor mode that would only turn the local value of
`eldoc-mode' in all buffers.  Would that make sense?

The alternative would be, of course, do what you suggested.

Michael.