From 3cef1072ad4973c5055e6719deac27b9d9efc5f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 3 May 2020 21:37:42 +0100 Subject: [PATCH] Survive hover responses with empty markdown strings * eglot.el (eglot-help-at-point): Protect against null eglot--hover-info GitHub-reference: fix https://github.com/joaotavora/eglot/issues/433 --- lisp/progmodes/eglot.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 8fadd5f7ab3..d172f4c7cc8 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2255,15 +2255,16 @@ is not active." (eglot--dbind ((Hover) contents range) (jsonrpc-request (eglot--current-server-or-lose) :textDocument/hover (eglot--TextDocumentPositionParams)) - (if (seq-empty-p contents) - (display-local-help) - (let ((blurb (eglot--hover-info contents range)) - (sym (thing-at-point 'symbol))) - (with-current-buffer (eglot--help-buffer) - (with-help-window (current-buffer) - (rename-buffer (format "*eglot-help for %s*" sym)) - (with-current-buffer standard-output (insert blurb)) - (setq-local nobreak-char-display nil))))))) + (let ((blurb (and (not (seq-empty-p contents)) + (eglot--hover-info contents range)))) + (if blurb + (with-current-buffer (eglot--help-buffer) + (with-help-window (current-buffer) + (rename-buffer (format "*eglot-help for %s*" + (thing-at-point 'symbol))) + (with-current-buffer standard-output (insert blurb)) + (setq-local nobreak-char-display nil))) + (display-local-help))))) (defun eglot-doc-too-large-for-echo-area (string) "Return non-nil if STRING won't fit in echo area. -- 2.39.2