emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/elpa 487cde5 18/71: Close #443: kind of honour eldoc-ec


From: João Távora
Subject: [elpa] externals/elpa 487cde5 18/71: Close #443: kind of honour eldoc-echo-area-use-multiline-p
Date: Wed, 16 Dec 2020 11:42:16 -0500 (EST)

branch: externals/elpa
commit 487cde5f7c8eeac5e2ed105c887d0547b94d14b7
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Close #443: kind of honour eldoc-echo-area-use-multiline-p
    
    A reworking of an idea and original implementation by Andrii
    Kolomoiets <andreyk.mad@gmail.com>.  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.
---
 eglot.el | 53 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/eglot.el b/eglot.el
index adfd4e2..436e5bf 100644
--- a/eglot.el
+++ b/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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]