Subject: bug#19338: [PATCH 1/3] eldoc: use default eldoc function if local one gives no results

From: Michal Nazarewicz <[email-masked]>
Date: Wed, 10 Dec 2014 22:46:21 +0100

On Wed, Dec 10 2014, Stefan Monnier <[email-masked]> wrote:
>> -	 (eldoc-message (funcall eldoc-documentation-function)))))
>> +         (eldoc-message
>> +          (or (funcall eldoc-documentation-function)
>> +              ;; If local documentation function did not return anything, try
>> +              ;; global one.
>> +              (when (local-variable-p 'eldoc-documentation-function)
>> +                (let ((func (default-value 'eldoc-documentation-function)))
>> +                  (when func (funcall func)))))))))
>
> We don't need that: if the major-mode wants that to happen, it can do
> that with an appropriate call to add-function, which will take care of
> delegating to the global value if/when applicable.
>
> This works very much like the add-hook's `local' argument.

So the point here is that I don't want major-mode to be aware of what
I might have set the default value of `eldoc-documentation-function' to
(and work even if I change it at any point).

This is also why I made `eldoc-documentation-function' into a defcustom
so user can customise the default value regardless of what major-mode is
doing.

I first tried doing it with `eldoc-mode' but the result didn't seem
clean or working correctly when major mode had its own eldoc function
set.

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<[email-masked]>--<xmpp:[email-masked]>--ooO--(_)--Ooo--