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

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Tue, 14 Nov 2023 09:55:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>, Stefan Kangas <stefankangas <at> gmail.com>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 67161 <at> debbugs.gnu.org
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 <at> gmail.com>
> Date: Wed, 15 Nov 2023 18:04:13 +0800
> Cc: 67161 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz <at> 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.




This bug report was last modified 1 year and 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.