From 58d4aff894c650ef4b3f601292314af53b961ce3 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora@gmail.com>
Date: Mon, 7 Jan 2019 08:44:37 +0000
Subject: [PATCH] Display truncated docstring if too large for echo area

* eglot.el (eglot--eldoc-message): Display first line doc.
---
 lisp/progmodes/eglot.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 9631c192e6c..2ab4bd864a9 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2071,8 +2071,12 @@ Buffer is displayed with `display-buffer', which obeys
           (if eglot-auto-display-help-buffer
               (display-buffer (current-buffer))
             (unless (get-buffer-window (current-buffer))
-              (eglot--message "Help for %s is in %s buffer" eglot--eldoc-hint
-                              (buffer-name eglot--help-buffer))))
+              (eglot--message
+               "%s\n(...truncated. Full help is in `%s')"
+               (truncate-string-to-width
+                (replace-regexp-in-string "\\(.*\\)\n.*" "\\1" string)
+                (frame-width) nil nil "...")
+               (buffer-name eglot--help-buffer))))
           (help-mode)
           t)))))
 
-- 
2.39.5