From: João Távora Date: Sat, 2 May 2020 23:43:00 +0000 (+0100) Subject: Kind of honour eldoc-echo-area-use-multiline-p X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~232 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d285e0060a721d84a35a06c1e9784cd8d8756c7a;p=emacs.git Kind of honour eldoc-echo-area-use-multiline-p A reworking of an idea and original implementation by Andrii Kolomoiets . It doesn't honor it completely because the semantics for a non-t, non-nil value are tricky. And we don't always exactly know what the symbol prefix reliably. * eglot.el (eglot--update-doc): Kind of honour eldoc-echo-area-use-multiline-p. GitHub-reference: close https://github.com/joaotavora/eglot/issues/443 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index adfd4e29f8c..436e5bfe445 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2288,29 +2288,36 @@ Buffer is displayed with `display-buffer', which obeys Honours `eglot-put-doc-in-help-buffer'. HINT is used to potentially rename EGLOT's help buffer. If STRING is nil, the echo area cleared of any previous documentation." - (if (and string - (or (eq t eglot-put-doc-in-help-buffer) - (and eglot-put-doc-in-help-buffer - (funcall eglot-put-doc-in-help-buffer string)))) - (with-current-buffer (eglot--help-buffer) - (let ((inhibit-read-only t) - (name (format "*eglot-help for %s*" hint))) - (unless (string= name (buffer-name)) - (rename-buffer (format "*eglot-help for %s*" hint)) - (erase-buffer) - (insert string) - (goto-char (point-min))) - (if eglot-auto-display-help-buffer - (display-buffer (current-buffer)) - (unless (get-buffer-window (current-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))) - (eldoc-message string))) + (cond ((and string + (or (eq t eglot-put-doc-in-help-buffer) + (and eglot-put-doc-in-help-buffer + (funcall eglot-put-doc-in-help-buffer string)))) + (with-current-buffer (eglot--help-buffer) + (let ((inhibit-read-only t) + (name (format "*eglot-help for %s*" hint))) + (unless (string= name (buffer-name)) + (rename-buffer (format "*eglot-help for %s*" hint)) + (erase-buffer) + (insert string) + (goto-char (point-min))) + (if eglot-auto-display-help-buffer + (display-buffer (current-buffer)) + (unless (get-buffer-window (current-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)))) + (eldoc-echo-area-use-multiline-p + (eldoc-message string)) + (t + (eldoc-message + (and string + (if (string-match "\n" string) + (substring string (match-end 0)) + string)))))) (defun eglot-eldoc-function () "EGLOT's `eldoc-documentation-function' function."