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: Sun, 28 Apr 2024 09:05:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

> (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 via email to

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