emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dired, toggle ls flags? [elisp]


From: Yuri Khan
Subject: Re: dired, toggle ls flags? [elisp]
Date: Mon, 29 Apr 2024 13:17:18 +0700

On Mon, 29 Apr 2024 at 12:48, Emanuel Berg <incal@dataswamp.org> wrote:

> (setq dired-listing-switches
>   "-A -G -h -l -X --group-directories-first --time-style=long-iso -I 
> \"*.meta\" -I \"#*#\" -I \"*.elc\"")
>
> And it can actually get even worse, as those initial options
> can be expressed -AGhlX as well!
>
> So to toggle in general some arbitrary option or option
> argument, one would have to parse all those cases: short
> options with and without arguments, and the same for long
> options, and then grouped short options as well.

If I had this itch (which I don’t) I think I’d approach it from the
“don’t even try to parse” angle.

1. Choose a subset of switches supported by your ‘ls’. (“All of them”
is a valid subset.)
2. Build a ‘transient’ exposing those. Have it fill out some
reasonable data structure where each switch is a separate field.
3. From that structure, build the ‘dired-listing-switches’ string and
refresh the dired buffer.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]