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: Sat, 25 Nov 2023 22:02:38 +0200

> From: Juri Linkov <juri@linkov.net>
> Cc: eliz@gnu.org,  liuhui1610@gmail.com
> Date: Sat, 25 Nov 2023 19:51:55 +0200
> 
> > Thanks, installed on the master branch, and closing the bug.
> 
> There is a problem with this specific configuration
> when ellipsis is a vector:
> 
>   (progn
>     (or standard-display-table (setq standard-display-table 
> (make-display-table)))
>     (let* ((face (lsh (face-id 'escape-glyph) 22))
>            (dots (+ face ?…)))
>       (set-char-table-extra-slot standard-display-table 4 (vector dots))))
> 
> that fails with
> 
>   Debugger entered--Lisp error: (wrong-type-argument characterp 88088614)
>     concat([88088614])
>     (if glyphs (concat glyphs) "...")
>     (string-width (if glyphs (concat glyphs) "..."))
>     dired--get-ellipsis-length()
>     ...
> 

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.





reply via email to

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