From 03d075eda6316d79335a71e9f5e8ebee232f49dc Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 28 Dec 2018 21:45:38 -0500 Subject: [PATCH] Fix: empty childframe when used with lsp-mode lsp-mode returns empty string as documentation from time to time, add a workaround to ignore that --- eldoc-box.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/eldoc-box.el b/eldoc-box.el index 0370894..0d661e4 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -169,15 +169,16 @@ You can use C-g to hide the doc." (defun eldoc-box--display (str) "Display STR in childframe." - (let ((doc-buffer (get-buffer-create eldoc-box--buffer))) - (with-current-buffer doc-buffer - (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 - (setq eldoc-box-hover-mode t) - (erase-buffer) - (insert str)) - (eldoc-box--get-frame doc-buffer))) + (unless (equal str "") ; WORKAROUND lsp returns empty string from time to time + (let ((doc-buffer (get-buffer-create eldoc-box--buffer))) + (with-current-buffer doc-buffer + (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 + (setq eldoc-box-hover-mode t) + (erase-buffer) + (insert str)) + (eldoc-box--get-frame doc-buffer)))) (defun eldoc-box--window-side ()