From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline Date: Sun, 04 Oct 2020 22:44:22 +0300 Organization: LINKOV.NET Message-ID: <87y2klixr5.fsf@mail.linkov.net> References: <87v9ky9p6o.fsf@mail.linkov.net> <654acc31-015d-4552-bd9b-3b8c69661fcd@default> <0957af50-7f85-455a-9d2c-e96451727872@default> <6073a2d5-4024-465d-8293-88ad7f6127ed@default> <87mu172qxb.fsf@gnus.org> <87sgazi550.fsf@mail.linkov.net> <87tuvfxdsf.fsf@gnus.org> <875z7vdol3.fsf@mail.linkov.net> <87pn63xcgp.fsf@gnus.org> <874knd7mow.fsf@mail.linkov.net> <877ds91zvy.fsf@gnus.org> <87lfgpm82u.fsf@mail.linkov.net> <87sgawww8o.fsf@gnus.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="4558"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 41250@debbugs.gnu.org, Arthur Miller To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 04 21:47:12 2020 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 1kP9yS-000165-DE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Oct 2020 21:47:12 +0200 Original-Received: from localhost ([::1]:60924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kP9yR-0006yA-Cu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Oct 2020 15:47:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kP9yI-0006wb-QU for bug-gnu-emacs@gnu.org; Sun, 04 Oct 2020 15:47:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35285) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kP9yI-0002rO-HB for bug-gnu-emacs@gnu.org; Sun, 04 Oct 2020 15:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kP9yI-0002Mh-FQ for bug-gnu-emacs@gnu.org; Sun, 04 Oct 2020 15:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Oct 2020 19:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41250 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 41250-submit@debbugs.gnu.org id=B41250.16018407999061 (code B ref 41250); Sun, 04 Oct 2020 19:47:02 +0000 Original-Received: (at 41250) by debbugs.gnu.org; 4 Oct 2020 19:46:39 +0000 Original-Received: from localhost ([127.0.0.1]:46831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kP9xv-0002M5-Ed for submit@debbugs.gnu.org; Sun, 04 Oct 2020 15:46:39 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:54193) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kP9xt-0002LV-Qw for 41250@debbugs.gnu.org; Sun, 04 Oct 2020 15:46:38 -0400 X-Originating-IP: 91.129.108.13 Original-Received: from mail.gandi.net (m91-129-108-13.cust.tele2.ee [91.129.108.13]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 8275E240007; Sun, 4 Oct 2020 19:46:29 +0000 (UTC) In-Reply-To: <87sgawww8o.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 02 Oct 2020 16:14:31 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:189767 Archived-At: >> on every use I need to wrap it with such code: >> >> (let ((ellipsis (cond >> (truncate-string-ellipsis) >> ((char-displayable-p ?…) "…") >> ("...")))) >> (truncate-string-to-width string max nil nil ellipsis)) >> >> Preferably, this should be fixed with this patch: > > Your patch is a distinct improvement on the current state of affairs, so > please go ahead and push to master (with a NEWS item). Pushed now with a NEWS item. When I grepped for more usages of truncate-string-to-width, I found one call in Gnus. It seems this patch could improve gnus-set-mode-line, but I'm not sure, and moreover I have no idea how to test this: diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index b3ed5cb664..42ba4fbd71 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -6240,8 +6240,7 @@ gnus-set-mode-line ;; We might have to chop a bit of the string off... (when (> (length mode-string) max-len) (setq mode-string - (concat (truncate-string-to-width mode-string (- max-len 3)) - "..."))))) + (truncate-string-to-width mode-string (- max-len 3) nil nil t))))) ;; Update the mode line. (setq mode-line-buffer-identification (gnus-mode-line-buffer-identification (list mode-string))) Here is another function, and it needs not just an improvement, but a plain bug fix because its args were wrong, and this patch should fix its args, but again currently I don't yet know how to test this: diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index c9a748830c..8ff3b56c5e 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -1597,7 +1597,7 @@ ibuffer-compile-make-eliding-form (defun ibuffer-compile-make-substring-form (strvar maxvar from-end-p) (if from-end-p ;; FIXME: not sure if this case is correct (Bug#24972) - `(truncate-string-to-width str strlen (- strlen ,maxvar) nil ?\s) + `(truncate-string-to-width str strlen (- strlen ,maxvar) ?\s) `(truncate-string-to-width ,strvar ,maxvar nil ?\s))) (defun ibuffer-compile-make-format-form (strvar widthform alignment)