unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Liu Hui <liuhui1610@gmail.com>,
	Stefan Kangas <stefankangas@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 67161@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	[thread overview]
Message-ID: <83a5rfrych.fsf@gnu.org> (raw)
In-Reply-To: <CAOQTW-P4+vs+JH8BTL8fL-d1QJXOdYq3i+3O7tALTDs=qHpnzA@mail.gmail.com> (message from Liu Hui on Wed, 15 Nov 2023 18:04:13 +0800)

> 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	other threads:[~2023-11-15 12:32 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14  9:52 bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length' Liu Hui
2023-11-14 13:26 ` Eli Zaretskii
2023-11-15 10:04   ` Liu Hui
2023-11-15 12:32     ` Eli Zaretskii [this message]
2023-11-16 10:07       ` Liu Hui
2023-11-16 12:11         ` Eli Zaretskii
2023-11-18  9:23           ` Liu Hui
2023-11-18 10:55             ` Eli Zaretskii
2023-11-18 16:12               ` Drew Adams
2023-11-20  4:34               ` Liu Hui
2023-11-20 12:10                 ` Eli Zaretskii
2023-11-20 17:54                   ` Juri Linkov
2023-11-20 18:42                     ` Eli Zaretskii
2023-11-20 18:55                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-20 19:17                     ` Eli Zaretskii
2023-11-21  7:52                     ` Juri Linkov
2023-11-21 11:55                       ` Eli Zaretskii
2023-11-21 17:12                         ` Juri Linkov
2023-11-20 17:20                 ` Drew Adams
2023-11-22  5:41                 ` Liu Hui
2023-11-25 10:52                   ` Eli Zaretskii
2023-11-25 17:51                     ` Juri Linkov
2023-11-25 20:02                       ` Eli Zaretskii
2023-11-26  2:56                         ` Liu Hui
2023-11-26  5:59                           ` Eli Zaretskii
2023-11-26 10:49                             ` Eli Zaretskii
2023-11-26 14:03                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 14:53                               ` Eli Zaretskii
2023-11-26 17:08                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 17:58                                   ` Eli Zaretskii
2023-11-26 18:06                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27  7:19                           ` Juri Linkov
2023-11-27  8:32                             ` Liu Hui
2023-11-27 17:16                               ` Juri Linkov
2023-11-15 18:06     ` Drew Adams
2023-11-15 15:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16  3:44   ` Liu Hui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a5rfrych.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67161@debbugs.gnu.org \
    --cc=liuhui1610@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).