unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: Re: dired, toggle ls flags? [elisp]
Date: Mon, 29 Apr 2024 13:27:47 +0200	[thread overview]
Message-ID: <87v8409znw.fsf@dataswamp.org> (raw)
In-Reply-To: CAP_d_8XW-66NKM7AcNAJYfHF159Ge5BZArtraH_D4M92DeV4dg@mail.gmail.com

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	other threads:[~2024-04-29 11:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  4:06 dired, toggle ls flags? [elisp] Emanuel Berg
2024-04-28  7:05 ` Emanuel Berg
2024-04-28  9:16 ` Michael Heerdegen via Emacs development discussions.
2024-04-28 23:25   ` Emanuel Berg
2024-04-29  6:17     ` Yuri Khan
2024-04-29 11:27       ` Emanuel Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8409znw.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).