From 93f89087b84c3c8152503101a0854ffb1f596098 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Tue, 13 Aug 2019 13:42:44 +0800 Subject: [PATCH] Improve eldoc-box-body face Now every attribute takes effect. --- README.org | 2 +- eldoc-box.el | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.org b/README.org index 2c09245..d2cc9da 100644 --- a/README.org +++ b/README.org @@ -22,7 +22,7 @@ It is also available on [[https://melpa.org/#/eldoc-box][MELPA]] - =eldoc-box-eglot-help-at-point= :: See below. ** Face - =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 - =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. diff --git a/eldoc-box.el b/eldoc-box.el index e338286..cb934b0 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -51,7 +51,7 @@ "The border color used in childframe.") (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 "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) ;; 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 + (buffer-face-set 'eldoc-box-body) (setq eldoc-box-hover-mode t) (erase-buffer) (insert str) @@ -299,14 +300,10 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'." buffer `((child-frame-parameters . ,parameter)))) (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) (redirect-frame-focus frame (frame-parent frame)) (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 (eldoc-box--update-childframe-geometry frame window) (setq eldoc-box--frame frame)