Add option to leave message in minibuffer when there's only one line

This commit is contained in:
Yuan Fu 2018-12-11 11:16:02 -05:00
parent 445a56e2fb
commit 194ff4136a
No known key found for this signature in database
GPG Key ID: 1CF5ECABEC37A901
2 changed files with 12 additions and 6 deletions

View File

@ -7,11 +7,11 @@ Get the file, add to load path, and
#+END_SRC #+END_SRC
* Usage * Usage
Show the documentation of the symbol at point: =eldoc-box-help-at-point= - =eldoc-box-help-at-point= :: Show the documentation of the symbol at point.
- =eldoc-box-hover-mode= :: Show documentation upon hover. Note that you need to enable ElDoc mode for this to work.
Show documentation upon hover: =eldoc-box-hover-mode=. Note that you need to enable ElDoc mode for this to work. - =eldoc-box-border= :: Adjust =:background= of this face for border color.
- =eldoc-box-body= :: Adjust =:background= of this face for background color of childframe.
Adjust =:background= of =eldoc-box-border= face for border color. Adjust =:background= of =eldoc-box-body= face for background color of childframe. - =eldoc-box-only-multi-line= :: Set this to non-nil and eldoc-box only display multi-line message in childframe. One line messages are left in minibuffer.
** Use with eglot ** Use with eglot
As of writing this README, eglot doesn't have a public mode hook, use this hook: As of writing this README, eglot doesn't have a public mode hook, use this hook:

View File

@ -39,6 +39,9 @@
(defface eldoc-box-body '((t . (:background nil))) (defface eldoc-box-body '((t . (:background nil)))
"Body face used in eglot doc childframe. Only :background is used.") "Body face used in eglot doc childframe. Only :background is used.")
(defvar eldoc-box-only-multi-line nil
"If non-nil, only use childframe when there are more than one line.")
(defvar eldoc-box-frame-parameters (defvar eldoc-box-frame-parameters
'( '(
;; (left . -1) ;; (left . -1)
@ -169,7 +172,10 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
"Frontend for eldoc. Display STR in childframe and ARGS works like `message'." "Frontend for eldoc. Display STR in childframe and ARGS works like `message'."
(when str (when str
(eldoc-box-quit-frame) (eldoc-box-quit-frame)
(eldoc-box--display (apply #'format str args)))) (let ((doc (apply #'format str args)))
(if (and eldoc-box-only-multi-line (eq (cl-count ?\n doc) 0))
(apply #'eldoc-minibuffer-message str args)
(eldoc-box--display (apply #'format str args))))))
(define-minor-mode eldoc-box-hover-mode (define-minor-mode eldoc-box-hover-mode
"Displays hover documentations in a childframe. This mode is buffer local." "Displays hover documentations in a childframe. This mode is buffer local."