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

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

bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length'


From: Eli Zaretskii
Subject: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length'
Date: Wed, 15 Nov 2023 14:32:30 +0200

> From: Liu Hui <liuhui1610@gmail.com>
> Date: Wed, 15 Nov 2023 18:04:13 +0800
> Cc: 67161@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> 于2023年11月14日周二 21:26写道:
> 
> > > +(defcustom dired-filename-hiding-ellipsis "…"
> >
> > We shouldn't use non-ASCII characters by default, without checking
> > they can be displayed.
> 
> Thanks for pointing this out. I think it can be changed to "...".

I actually wonder why we need it as a defcustom.  If you use
truncate-string-ellipsis, you will get both a customizable setting and
the correct string for the terminal at hand.  Why do we need an extra
option?

> > > +    (let ((ell-len (string-width dired-filename-hiding-ellipsis))
> > > +          maxlen filename-col)
> > > +      (while (< (point) end)
> > > +        (ignore-errors
> > > +       (if (not (dired-move-to-filename))
> >
> > Did you consider using truncate-string-to-width here?
> 
> I'm not sure what you mean. Using truncate-string-to-width to shorten
> string or using truncate-string-ellipsis to obtain the ellipsis? The
> problem of truncate-string-to-width is that it produces a new string.
> I want to avoid modifying the buffer text since it would break other
> dired functionalities. Therefore this patch only changes the display
> instead of the underlying text.

So you consider using the 'invisible' property a good feature?  I
actually don't like using it for such purposes, as it gets in the way.
But maybe as an opt-in behavior that could be OK?

Stefan & Stefan, WDYT?

Btw, using string-width might not be the best possibility here.  I
would recommend string-pixel-width instead (with subsequent division
by what default-char-width returns), as that will produce a better
approximation, especially on GUI frames.





reply via email to

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