Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 05 Oct 2020 09:08:11 +0200

Juri Linkov <[email-masked]> writes:

> Pushed now with a NEWS item.

Great!

> 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:

[...]

> -		  (concat (truncate-string-to-width mode-string (- max-len 3))
> -			  "...")))))
> +		  (truncate-string-to-width mode-string (- max-len 3) nil nil t)))))

I applied the patch and tested it, and it looks fine, so I've pushed it
to Emacs 28.

> 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:

[...]

> -      `(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)))

Testing should be pretty easy -- just say `M-x ibuffer' and look at how
it truncates buffer names.  :-)

However, the patch doesn't fix the ellipsis stuff here, because ibuffer
has a `ibuffer-eliding-string' variable (that could be obsoleted now).

(But the patch otherwise looks "obviously correct" to me; passing in ?\s
as the ellipsis argument doesn't make much sense.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no