From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Liu Hui Newsgroups: gmane.emacs.bugs Subject: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length' Date: Sun, 26 Nov 2023 10:56:52 +0800 Message-ID: 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: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26933"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67161@debbugs.gnu.org, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 26 03:58:23 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 1r75Lj-0006pS-9O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Nov 2023 03:58:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r75LN-0004bY-BG; Sat, 25 Nov 2023 21:58:02 -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 1r75LJ-0004bI-Sx for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 21:57:58 -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 1r75LJ-0000Ff-Jo for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 21:57:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r75LO-0007bD-I4 for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 21:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Liu Hui Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Nov 2023 02:58: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.170096743729146 (code B ref 67161); Sun, 26 Nov 2023 02:58:02 +0000 Original-Received: (at 67161) by debbugs.gnu.org; 26 Nov 2023 02:57:17 +0000 Original-Received: from localhost ([127.0.0.1]:40549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r75Kf-0007a1-BH for submit@debbugs.gnu.org; Sat, 25 Nov 2023 21:57:17 -0500 Original-Received: from mail-vk1-xa30.google.com ([2607:f8b0:4864:20::a30]:52716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r75Kd-0007Zn-0I for 67161@debbugs.gnu.org; Sat, 25 Nov 2023 21:57:15 -0500 Original-Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-4ac023c8f82so1035840e0c.1 for <67161@debbugs.gnu.org>; Sat, 25 Nov 2023 18:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700967424; x=1701572224; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pH/SZpe18lvAxvFDMv+ScfPmjBBZ40gWd6JXFYFSpkU=; b=Zk1944631H4zD7rshrTGmiEOFgjhdV5SabyWxAn4H2KoJD/MsGYnh0XigAsFOdFeHx Hy5cVftcYznxK5BS1UZ37D+y4KfHHifDQA7EJUCoixNgqzflevZvj8eIvQgZ3U0RpQ48 wGk+4xyXNnt4VPVg0euzHSU1AV3uetdCbx4iBDjHJIZuI9CjbfpvYYNLIxKdRkyEsAcx 23ym/uziY/cWWB1MYoaQOpg3blIfzJbLEefygLm2ubI0wYEeMOsMyTOhax3cuZcUcxyc Hn0tJnTopTYNpk7SNWCL9cEHtUCLKuCPntZ94cr36YJxET5ymkj1a0r0wRtGJNdBvKdC 4WmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700967424; x=1701572224; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pH/SZpe18lvAxvFDMv+ScfPmjBBZ40gWd6JXFYFSpkU=; b=X6EFRPNekmEr5/79eL2xq0Kp1ecF/mlDKu8z+PG+8DTTUIjeO/DemzKtCN8HE6+8Xt eDSIB2ny2SDa2dakZnWZP6quzDQlPLfzZ799/d6fp9e4/58JNuzh8LugmyKsw/gBQp3g t+/gar9jllm6DMHzkN91bdbPd/iR4bdmkNm5l7l3lk5YCNiPjEp2esyL0kkPOAXN2TB7 pVDVW73UJr0dPyateH8N5zhaINhBzFUr4tBYj1SGEE3KAXI/wPofxSju5vetFFu35rXw YCkhQNO/pmnmwNR2CrA6ALEqVBklZVc15eSSvwuwDVa/jKXnctSuvf15vA9erAtyIMmL TFHQ== X-Gm-Message-State: AOJu0YyrUjRQJG065CNN/eZLpb0hyDSt70E68qlLUcK4DaYKpq22+LrJ CdEZ3y+q5w1fZJvl7HzKjcRUPn8eP4fqyewZ8HU= X-Google-Smtp-Source: AGHT+IHFvlM/3K/SedmoqeT3RAJGWAkKXsOSBU264fcNN9LkJNZfubQeq5hGLl7Je0dbXapWrm8nkAL3Z3U1XBRjbx4= X-Received: by 2002:a67:cf4a:0:b0:462:9b33:fce5 with SMTP id f10-20020a67cf4a000000b004629b33fce5mr7851283vsm.13.1700967423794; Sat, 25 Nov 2023 18:57:03 -0800 (PST) In-Reply-To: <83lealbnz5.fsf@gnu.org> 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:275033 Archived-At: Eli Zaretskii =E4=BA=8E2023=E5=B9=B411=E6=9C=8826=E6=97=A5= =E5=91=A8=E6=97=A5 04:02=E5=86=99=E9=81=93=EF=BC=9A > 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.