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

From: Liu Hui <[email-masked]>
Date: Sun, 26 Nov 2023 10:56:52 +0800

Eli Zaretskii <[email-masked]> 于2023年11月26日周日 04:02写道：

> Does the below fix the problem, and is the Dired display after the
> change correct when file names are truncated?
>
> diff --git a/lisp/dired.el b/lisp/dired.el
> index 23a6fc0..096d6a8 100644
> --- a/lisp/dired.el
> +++ b/lisp/dired.el
> @@ -2021,8 +2021,12 @@ dired--get-ellipsis-length
>    (let* ((dt (or (window-display-table)
>                   buffer-display-table
>                   standard-display-table))
> -         (glyphs (and dt (display-table-slot dt 'selective-display))))
> -    (string-width (if glyphs (concat glyphs) "..."))))
> +         (glyphs (and dt (display-table-slot dt 'selective-display)))
> +         (vlen (length glyphs))
> +         (char-glyphs (make-vector vlen nil)))
> +    (dotimes (i vlen)
> +      (aset char-glyphs i (glyph-char (aref glyphs i))))
> +    (string-width (if glyphs (concat char-glyphs) "..."))))
>
>  (defun dired--get-filename-display-length ()
>    "Return maximum display length of filename.

Thanks Eli! I wasn't aware of the face of glyph and I confirm the
dired display is correct with your fix.