bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#6000: describe-text-sexp does not know window-width


From: martin rudalics
Subject: bug#6000: describe-text-sexp does not know window-width
Date: Fri, 4 Jun 2021 11:18:35 +0200

>> This sounds like a good idea to me, but there wasn't a recipe to
>> reproduce whatever error this bug report was talking about, so I can't
>> test.
>>
>> Does anybody have a test case that displays the problem (in case it's
>> still in place after all these years)?
>
> Indeed a test case would be needed, but I have none.

There's no realistic test case for this.  You can do

(defun foo ()
  (interactive)
  (with-current-buffer (get-buffer-create "*foo*")
    (describe-text-sexp 'foooooooooooooooooooooooooooooooooo)))

and M-x foo in some window.  Dependent on the width of that window,
`describe-text-sexp' will decide whether to insert the expression in
*foo* or display a "Show" button instead.  When you eventually display
*foo* you will see the result.  I think a simple check like

    (if (and (not (string-match-p "\n" pp))
             (eq (window-buffer) (current-buffer))
             (<= (length pp) (- (window-width) (current-column))))
        (insert pp)

should work.

martin





reply via email to

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