Follow ElDoc convension

Instead of clearing childframe on pre-command hook,
clear when display function is passed a nil argument
This commit is contained in:
Yuan Fu 2018-12-11 16:36:34 -05:00
parent 34004bf492
commit 317cd2ddfc
No known key found for this signature in database
GPG Key ID: 1CF5ECABEC37A901

View File

@ -74,7 +74,10 @@
(defun eldoc-box-help-at-point () (defun eldoc-box-help-at-point ()
"Display hover info at point in a childframe." "Display hover info at point in a childframe."
(interactive) (interactive)
(eldoc-message (funcall eldoc-documentation-function))) (let ((doc (funcall eldoc-documentation-function)))
(when doc
(eldoc-box--display doc)
(eldoc-box--inject-quit-func))))
(defun eldoc-box-quit-frame () (defun eldoc-box-quit-frame ()
"Hide childframe used by eglot doc." "Hide childframe used by eglot doc."
@ -101,8 +104,7 @@
(setq mode-line-format nil) (setq mode-line-format nil)
(erase-buffer) (erase-buffer)
(insert str) (insert str)
(eldoc-box--get-frame doc-buffer)) (eldoc-box--get-frame doc-buffer))))
(eldoc-box--inject-quit-func)))
(defun eldoc-box-quit-hook () (defun eldoc-box-quit-hook ()
"Quit eglot doc childframe and remove self from hook." "Quit eglot doc childframe and remove self from hook."