From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length' Date: Sun, 26 Nov 2023 07:59:29 +0200 Message-ID: <83edgdawce.fsf@gnu.org> References: <8334x8tqi9.fsf@gnu.org> <83a5rfrych.fsf@gnu.org> <83sf55q4nc.fsf@gnu.org> <83jzqfmiuj.fsf@gnu.org> <83jzq6cdfx.fsf@gnu.org> <86y1elzq58.fsf@mail.linkov.net> <83lealbnz5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5570"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67161@debbugs.gnu.org, juri@linkov.net To: Liu Hui , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 26 07:01:47 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r78DC-0001G4-K4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Nov 2023 07:01:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r78D0-0005Sj-Iv; Sun, 26 Nov 2023 01:01:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r78CX-0005Ql-E2 for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 01:01:08 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r78CO-0006sX-Vm for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 01:01:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r78CU-00076R-FL for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2023 01:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Nov 2023 06:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67161 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67161-submit@debbugs.gnu.org id=B67161.170097840618679 (code B ref 67161); Sun, 26 Nov 2023 06:01:02 +0000 Original-Received: (at 67161) by debbugs.gnu.org; 26 Nov 2023 06:00:06 +0000 Original-Received: from localhost ([127.0.0.1]:40638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r78BZ-0004q8-Kw for submit@debbugs.gnu.org; Sun, 26 Nov 2023 01:00:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r78BX-0004fK-Dz for 67161@debbugs.gnu.org; Sun, 26 Nov 2023 01:00:03 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r78BJ-0006L6-HL; Sun, 26 Nov 2023 00:59:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=YsJm7ACef06kKdPgbc0gqlxy8MKxtyVQrt5tngRh/1s=; b=Glui6/YoExhXofP9+VJY 9Pt4df2kHG7+ZiQsB83SW+/NWLsTdXANoO7JPQMhVLeoW8BM2Se/GhGTT4PBwTOj39HDQD6voRxUj sZZiyiWe0IPPE7wzuYzpFEwxekfj8wIYSNMNrVQJ+XbQWzymBD6vJQtFgL0G81xok7jNnfi3m9l81 YbDga+c7IZlBNBqAVJdK9/cGjWnfHFBFVLCt8LTfBxwFvKV+o+HUZVd12/RvhrdKOecQLDa6652Sg vMUJ7ULU5DdMxBACM3x9JrgXt/I5Mme3w3tw6dBIWbrrAwTAbsi1kEkPyio2wxr2ijZRrzxaUQ7ef x+uTC2cyCuMEeQ==; In-Reply-To: (message from Liu Hui on Sun, 26 Nov 2023 10:56:52 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275036 Archived-At: > From: Liu Hui > Date: Sun, 26 Nov 2023 10:56:52 +0800 > Cc: Juri Linkov , 67161@debbugs.gnu.org > > Eli Zaretskii 于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. Thanks for testing. However, I'm beginning to think that this is a subtle misfeature in 'concat': it should support vector of glyphs with faces, and should preserve the face information (my patch simply discards faces, which could perhaps affect string-width result). So I think we should perhaps extend 'concat' to support vectors of glyphs with faces. Stefan, WDYT?