all messages for Emacs-related lists mirrored at yhetil.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 01:25:16 +0200	[thread overview]
Message-ID: <87y18x9ijn.fsf@dataswamp.org> (raw)
In-Reply-To: 87mspdvocn.fsf@web.de

Michael Heerdegen wrote:

>> How can I hit a key, say h, to toggle the -h flag for ls
>> in dired?
>>
>> Answer, like this!
>>
>> But question, is there already a better way to do it?
>
> IIUC, the intended way of changing any flags is C-u s.
> Is this good enough?

It is the general case, which one should always have.
The specific case, which you do often, you want faster than
that, often.

However this is actually a nontrivial thing to do for the
arbitrary specific case, since, well, take a look at my
initial configuration

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

So it is a lot of work for a small gain, agreed.

> We don't have a toggle for all flags.

We don't have toggle at all, right? But you can set it
explicitely to whatever you want using what is already there,
which should be fast enough.

If one wants to toggle, well, I'll use my poor man's solution
for the time being at least all tho it would be interesting to
do this so it would work for the entire ls(1) option and
argument syntax and also in an elegant lispy way. Because not
only ls use that syntax as you know, but a lot of other GNU
tools - maybe one can convince oneself it
isn't overengineering?

Also, maybe some other part of Emacs maybe has this kind of
GNU CLI parser already?

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




  reply	other threads:[~2024-04-28 23:25 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 [this message]
2024-04-29  6:17     ` Yuri Khan
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=87y18x9ijn.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 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.