emacs-diffs
[Top][All Lists]
Advanced

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

scratch/eldoc-async 36b900f 2/4: Simplify Eldoc one-line truncation


From: João Távora
Subject: scratch/eldoc-async 36b900f 2/4: Simplify Eldoc one-line truncation
Date: Sat, 6 Jun 2020 08:37:10 -0400 (EDT)

branch: scratch/eldoc-async
commit 36b900f0acc0160d4401c9cb9644afd1b3f66e86
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Simplify Eldoc one-line truncation
    
    * lisp/emacs-lisp/eldoc.el (eldoc--handle-docs): Simpler truncation in
    one-line case.
---
 lisp/emacs-lisp/eldoc.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 697ed99..a621c64 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -418,11 +418,11 @@ Honour most of `eldoc-echo-area-use-multiline-p'."
                         (t 1))))
       (eldoc-message nil) ; clear the echo area
       (when docs
+        (goto-char (point-min))
         (cond
          ((> available 1)
           (cl-loop
-           initially (goto-char (point-min))
-           (goto-char (line-end-position (1+ available)))
+           initially (goto-char (line-end-position (1+ available)))
            for truncated = nil then t
            for needed
            = (let ((truncate-lines message-truncate-lines))
@@ -444,7 +444,7 @@ Honour most of `eldoc-echo-area-use-multiline-p'."
           ;; truncate brutally ; FIXME: use `eldoc-prefer-doc-buffer' here, 
too?
           (eldoc-message
            (truncate-string-to-width
-            (replace-regexp-in-string "\n" " " (car (car docs))) width))))))))
+            (buffer-substring (point-min) (line-end-position 1)) width))))))))
 
 ;; this variable should be unbound, but that confuses
 ;; `describe-symbol' for some reason.



reply via email to

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