all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: dired, toggle ls flags? [elisp]
Date: Mon, 29 Apr 2024 13:17:18 +0700	[thread overview]
Message-ID: <CAP_d_8XW-66NKM7AcNAJYfHF159Ge5BZArtraH_D4M92DeV4dg@mail.gmail.com> (raw)
In-Reply-To: <87y18x9ijn.fsf@dataswamp.org>

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	other threads:[~2024-04-29  6:17 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 [this message]
2024-04-29 11:27       ` Emanuel Berg

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

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

  git send-email \
    --in-reply-to=CAP_d_8XW-66NKM7AcNAJYfHF159Ge5BZArtraH_D4M92DeV4dg@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.