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

From: Drew Adams <[email-masked]>
Date: Fri, 15 May 2020 11:55:46 -0700 (PDT)

> I think format string asks for more documentation and
> more cognitive effort on part of user :-)  and as such
> maybe it is better to have it as part of Dired+.
> 
> Kind-of more for hard-core users who prefer much
> deeper level of customization?

Emacs users are of all kinds.  No user who
doesn't understand `format' would need to
make that particular option-value choice.

This is no different from options we have
that have a catch-all choice of a function,
which they can use to get pretty much any
behavior.

And that's another reasonable alternative
here to a choice of a format string: a
function that accepts the current switches
as its (first) argument.

That's even more general, and it wouldn't
freak out a user unfamiliar with format
strings. ;-)

And that also covers truncating, trivially.
There's nothing special about truncating.
It just happens to correspond directly to
your immediate problem: a long list of
switches.

Attached is a patch that does what I think
should be done.  The option value can be:

nil - to get the current behavior
`as-is' - show the full switches
an integer - show first N chars of switches
a function - show whatever it returns, when
             passed `dired-actual-switches'

If Emacs doesn't want to go this route then
I guess I'll just use it for Dired+.
___

I do think your suggestion of mouseover
the mode-line indication showing the full
switches is a good one.

I've added command `diredp-change-ls-switches'
to Dired+, and added it to menu-bar menu `Dir'
(aka `Subdir').  It shows the current switches
in the prompt, so you can just hit `C-g' if all
you want is see what the current switches are.

And because it's in the menu, you can get to
it by clicking the lighter in the mode-line.
(Menu `Dir' is the first menu listed when you
click.)