Subject: Re: bug#77292: [PATCH] ; Add newline to 'elisp-eldoc-var-docstring-with-value'

From: Elijah Gabe Pérez <[email-masked]>
Date: Wed, 26 Mar 2025 16:12:03 -0600

Eli Zaretskii <[email-masked]> writes:

>> From: Elijah Gabe Pérez <[email-masked]>
>> Date: Wed, 26 Mar 2025 12:08:11 -0600

>> This patch display variable docstring in
>> 'elisp-eldoc-var-docstring-with-value' as:

>> font-lock-keywords: nil
>> A list of keywords and corresponding font-lock highlighting rules.
>> There are two kinds of values: user-level, and compiled.
>> [...]

>> instead:

>> font-lock-keywords: nil A list of keywords and corresponding font-lock highlighting rules.
>> There are two kinds of values: user-level, and compiled.
>> [...]

> That has the disadvantage of enlarging the mini-window.

Eldoc echo window will be truncated if documentation is very large.

Also since =elisp-eldoc-var-docstring-with-value= includes full
variable docstring (including docstring newlines and length)
I don't see any difference with an additional newline here.

> Also, what does that do when ElDoc displays the documentation on the
> mode line for some reason (like when the mini-window is taken)?

It displays (full) documentation without the newlines in the modeline.
/(Note: the newlines in modeline are displayed as a ^J char for some reason)/

I think there should be a length limit for the eldoc documentation in
modeline.

Like in the below patch:

#+begin_src diff
  diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 966158024dd..f4726798e6d 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -314,8 +314,8 @@ eldoc-minibuffer-message
 	    (setq mode-line-format
                   (funcall
                    (if (listp mode-line-format) #'append #'list)
-                   (list "" '(eldoc-mode-line-string
-			      (" " eldoc-mode-line-string " ")))
+                   (list "" '((truncate-string-to-width eldoc-mode-line-string 50 nil nil t)
+			      (" " (truncate-string-to-width eldoc-mode-line-string 50 nil nil t) " ")))
                    mode-line-format)))
           (setq eldoc-mode-line-string
                 (when (stringp format-string)
#+end_src

-- 
                                          - E.G via GNU Emacs and Org.