Improve eldoc-box-body face

Now every attribute takes effect.
This commit is contained in:
Yuan Fu 2019-08-13 13:42:44 +08:00
parent 8aa2b6d35a
commit 93f89087b8
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442
2 changed files with 4 additions and 7 deletions

View File

@ -22,7 +22,7 @@ It is also available on [[https://melpa.org/#/eldoc-box][MELPA]]
- =eldoc-box-eglot-help-at-point= :: See below. - =eldoc-box-eglot-help-at-point= :: See below.
** Face ** Face
- =eldoc-box-border= :: Adjust =:background= of this face for border color. - =eldoc-box-border= :: Adjust =:background= of this face for border color.
- =eldoc-box-body= :: Adjust =:background= and =:font= of this face for background color and font of the childframe. I suggest to use a nice Sans Serif font, such as Source Sans Pro. - =eldoc-box-body= :: Default face used by childframe. I suggest to use a nice Sans Serif font such as Source Sans Pro, and a lighter or darker background.
** Variable ** Variable
- =eldoc-box-max-pixel-width= & =eldoc-box-max-pixel-height= :: Set them according to the screen resolution of your machine. - =eldoc-box-max-pixel-width= & =eldoc-box-max-pixel-height= :: Set them according to the screen resolution of your machine.
- =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. - =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.

View File

@ -51,7 +51,7 @@
"The border color used in childframe.") "The border color used in childframe.")
(defface eldoc-box-body '((t . (:background nil))) (defface eldoc-box-body '((t . (:background nil)))
"Body face used in eglot doc childframe. Only :background and :font are used.") "Body face used in eglot doc childframe.")
(defvar eldoc-box-only-multi-line nil (defvar eldoc-box-only-multi-line nil
"If non-nil, only use childframe when there are more than one line.") "If non-nil, only use childframe when there are more than one line.")
@ -182,6 +182,7 @@ You can use C-g to hide the doc."
(setq mode-line-format nil) (setq mode-line-format nil)
;; without this, clicking childframe will make doc buffer the current buffer ;; without this, clicking childframe will make doc buffer the current buffer
;; and `eldoc-box--maybe-cleanup' in `eldoc-box--cleanup-timer' will clear the childframe ;; and `eldoc-box--maybe-cleanup' in `eldoc-box--cleanup-timer' will clear the childframe
(buffer-face-set 'eldoc-box-body)
(setq eldoc-box-hover-mode t) (setq eldoc-box-hover-mode t)
(erase-buffer) (erase-buffer)
(insert str) (insert str)
@ -299,14 +300,10 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
buffer buffer
`((child-frame-parameters . ,parameter)))) `((child-frame-parameters . ,parameter))))
(setq frame (window-frame window))) (setq frame (window-frame window)))
(set-face-attribute 'fringe frame :background nil :inherit 'default) (set-face-attribute 'fringe frame :background nil :inherit 'eldoc-box-body)
(set-window-dedicated-p window t) (set-window-dedicated-p window t)
(redirect-frame-focus frame (frame-parent frame)) (redirect-frame-focus frame (frame-parent frame))
(set-face-attribute 'internal-border frame :inherit 'eldoc-box-border) (set-face-attribute 'internal-border frame :inherit 'eldoc-box-border)
(set-face-attribute 'default frame
:background (face-attribute 'eldoc-box-body :background main-frame)
:font (face-attribute 'eldoc-box-body :font main-frame))
;; set size ;; set size
(eldoc-box--update-childframe-geometry frame window) (eldoc-box--update-childframe-geometry frame window)
(setq eldoc-box--frame frame) (setq eldoc-box--frame frame)