unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: liuhui1610@gmail.com, 67161@debbugs.gnu.org
Subject: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length'
Date: Sat, 25 Nov 2023 22:02:38 +0200	[thread overview]
Message-ID: <83lealbnz5.fsf@gnu.org> (raw)
In-Reply-To: <86y1elzq58.fsf@mail.linkov.net> (message from Juri Linkov on Sat, 25 Nov 2023 19:51:55 +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	other threads:[~2023-11-25 20:02 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
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 [this message]
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=83lealbnz5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=67161@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=liuhui1610@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).