GNU bug report logs - #41250
28.0.50; Dired displays unconditionally ls-switches on modeline

Previous Next

Package: emacs;

Reported by: Arthur Miller <arthur.miller <at> live.com>

Date: Thu, 14 May 2020 01:43:01 UTC

Severity: minor

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 41250 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>, Arthur Miller <arthur.miller <at> live.com>
Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline
Date: Sun, 04 Oct 2020 22:44:22 +0300
>> 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)




This bug report was last modified 4 years and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.