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: Sun, 28 Apr 2024 09:05:56 +0200	[thread overview]
Message-ID: <875xw2arvv.fsf@dataswamp.org> (raw)
In-Reply-To: 87cyqab06f.fsf@dataswamp.org

> (defun dired-ls-toggle (opt)
>   (let ((opt-re (format "\\(^\\|[[:blank:]]\\)%s\\([[:blank:]]\\|\\b\\)" opt)))
>     (if (string-match-p opt-re dired-listing-switches)
>         (setq dired-listing-switches
>           (replace-regexp-in-string opt-re " " dired-listing-switches) )
>       (setq dired-listing-switches (format "%s %s" dired-listing-switches opt)))
>     (setq dired-listing-switches (string-clean-whitespace dired-listing-switches))
>     (dired-sort-other dired-listing-switches) ))

I realized the lispy way of doing it, one should first make
a list from the string, then add or remove from that list,
then make a new string from the list.

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




  reply	other threads:[~2024-04-28  7:05 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 [this message]
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

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=875xw2arvv.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.