[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum p
From: |
Alan Mackenzie |
Subject: |
bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50 |
Date: |
Thu, 21 Sep 2023 17:07:58 +0000 |
Hello, Stefan.
On Thu, Sep 21, 2023 at 12:16:57 -0400, Stefan Monnier wrote:
> Alan Mackenzie [2023-09-01 14:17:12] wrote:
> > Hello, Emacs.
> > In cl-print-to-string-with-limit appears the following binding:
> > (print-length (cond
> > ((null limit) nil)
> > ((eq limit t) print-length)
> > (t (min limit 50))))
> > ^^^^^^^^^^^^
> > .. This has the effect of ignoring the parameter LIMIT (unless it is
> > very small) and instead truncating the printed size to 50. There is a
> > similar mechanism to limit print-level to 8.
> > Although the doc string doesn't explicitly say it won't truncate like
> > this, it kind of implies that LIMIT is the size it will truncate to.
> > This excessive truncation is a bug.
> See also bug#34183.
> > .. I propose fixing this bug by removing these limits on print-length and
> > print-level in cl-print-to-string-with-limit.
> Sounds a bit drastic. Strings can be obnoxiously long, so it's
> important for cl-print to be able to truncate them.
There is clearly no human-sized bound on string lengths, so they can
indeed be very long. Most of the time they're not. But they are very
frequently longer than 50 characters.
> [ IOW, I'm not happy with commit
> 761f8901fffdb155cbcc7f3b5a2329161c2c1826. ]
Well I did post about it to emacs-devel on Sunday and Monday, asking if
anybody had any objection. Nobody, not even you, responded.
I still believe that not truncating strings is better than truncating
them to the minute length of 50. In fact, why truncate strings at all in
cl-prin1? They're not truncated in prin1, etc. The reason for
truncating lists and vectors is to prevent infinite printing when there's
a circular list or vector, something which cannot happen with a string.
If somebody doesn't want a string longer that 50 to get printed, then she
shouldn't call cl-prin1 with it.
The mistake in Emacs before my patch was a category error: wrongly
believing that print-length applies to a string length too. It doesn't.
String lengths are a completely different kettle of fish from list
lengths.
To solve this problem properly, we need, as Eli has suggested, a separate
variable called something like print-string-length, to be set
independently of print-length (and print-level). A sensible value for
this variable in printing backtraces might be, say, 500.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
- bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50, Alan Mackenzie, 2023/09/01
- bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50, Alan Mackenzie, 2023/09/19
- bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50, Stefan Monnier, 2023/09/21
- bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50, Eli Zaretskii, 2023/09/21
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50, Alan Mackenzie, 2023/09/29
- bug#65680: cl-print-to-string-with-limit erroneously imposes a maximum print-length of 50, Eli Zaretskii, 2023/09/29