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: Liu Hui <liuhui1610 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67161 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length'
Date: Thu, 16 Nov 2023 18:07:04 +0800
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> 于2023年11月15日周三 20:32写道:

> 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?

As Stefan promptly pointed out, the ellipsis defcustom is actually
useless because the display of ellipsis is determined by the display
table. So I have deleted it in the attached patch.

> 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.

I don't know the drawback of the 'invisible' property. This patch is
inspired by dired-hide-details-mode, which uses the property to hide
file information.

> 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.

I agree using pixel width is more accurate, though the approximation
based on character width is good enough in most cases. In fact, in
addition to string-width, move-to-column also needs to be replaced by
a function that moves the point to the character at a specific pixel
position. It seems there isn't such a built-in function.
[0001-Add-option-dired-filename-display-length.patch (text/x-patch, attachment)]

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.