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: Emanuel Berg
Subject: Re: dired, toggle ls flags? [elisp]
Date: Mon, 29 Apr 2024 13:27:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Yuri Khan wrote:

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

Yes, I thought about this idea. It would work, and one can do
that for the local config, if desired, but not really
a solution to be excited about or push anywhere else.

But this parsing already happens everywhere, in C, if not the
tools themself wouldn't work.

Surely it must happen somewhere in Lisp as well already?

Either in Emacs or in some shell/CLI tool written in Lisp that
use the same style. For example some shell/command interpreter
written in Lisp, since it has to parse arbitrary options
and arguments.

C, bash, zsh, Python all have methods to do it, they are
optional but one is often benefited from using them including
for pretty simple possible input. They come with advantages
like automated interactive documentation and also, simple
input tends to grow when one adds new features.

So one should look for something like that in Lisp as well!

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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