Uses a :before-until advice on the local value of
eldoc-message-function instead of setting it directly. Thus, when we
give up because of eldoc-box-only-multi-line (or some other future
criteria), other :before-until handlers can kick in.
* eldoc-box.el (eldoc-box--eldoc-message-function): Control return of
t or nil.
(eldoc-box-hover-mode): Use add-function and
remove-function.
Don't cancel and create new timers naively.
Only cancel timer (and set to nil) when there is no live buffer
with eldoc-box-hover-mode enabled;
and only create new timer when none exists.
Add cleanup function and a idle timer
Why a timer? ElDoc is mainly use in minibuffer,
where the text is constantly being flushed by other commands
so ElDoc doesn't try very hard to cleanup
Originally I have (when str (display)), but that leaves childdrame
unchanged.
To work around that I added (eldoc-box-quit-frame).
Now childframes are cleared up nicely but it lagging.
(when (stringp str) (display)) works. (although I don't know why (when
str) doesn't, even though eldoc-messaeg passes nil to message function)
This doesn't work for some reason, maybe it's because I'm on Mac?
It might be my machine's fault because
lsp-ui's childframe doesn't have border when they clain to do, either.
Anyway, the internal-border-width parameter works fine,
and internal-border face looks good, too.
So I guess the code is ok.