From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: dired, toggle ls flags? [elisp] Date: Mon, 29 Apr 2024 13:17:18 +0700 Message-ID: References: <87cyqab06f.fsf@dataswamp.org> <87mspdvocn.fsf@web.de> <87y18x9ijn.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15748"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 29 08:18:22 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s1KLG-0003sW-EJ for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Apr 2024 08:18:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1KKX-0002ud-9D; Mon, 29 Apr 2024 02:17:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1KKT-0002tD-9K for emacs-devel@gnu.org; Mon, 29 Apr 2024 02:17:33 -0400 Original-Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1KKR-0000xa-SL for emacs-devel@gnu.org; Mon, 29 Apr 2024 02:17:33 -0400 Original-Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-617e6c873f3so40622657b3.2 for ; Sun, 28 Apr 2024 23:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714371450; x=1714976250; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NgvYrUF6y5vGDuage4/cxrso8HzphL0PatljwGhDIqo=; b=FE/LA9Jn8d3lQiHIO1nf4MTmaOb+3qYkQCy13vk9EREQw6TXJ6SuutdZ+NiGjn4KCS oNvbDy7mKuyrdPiCX0Wwz1/8Plbs3Ajizxcg4Z6X1ez336K92qjFTZzRguEgqdVkyKyW qEiRY/w0AOaU3hq8ShpESHuL9u8AMHXhWiirLIPT4zk24uT7CnL3inm4eZgr6RbyqMzN diLYY4qNtbha/H54kbAluWHj+tflS8epp58yR+Z8wwLiry8A2YGiFDEDUsjMNdaJmzAi NXKjcSZzB33oX0FRGkUfANYBVpXpOEGlUoIxM0W4re9aQd/GN7VeBLSAkOAgIGUvAZJC H69Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714371450; x=1714976250; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NgvYrUF6y5vGDuage4/cxrso8HzphL0PatljwGhDIqo=; b=jrXEfBEe3KE6FGFS+SVW0S4gUoyGAb3GxXROII+l21isner3EvlDcHZaeGCj+xeSGR /rgnZMXMe3w/N10wczUQjytcAwh8iJM8nndMadwdCIvOoAjW6KBihWhqKEnvC/YRUvvM CGexf9UTE93fit9F4Na/dJohpgsRwEBe3HjWpf2lqGchbMEfaLStBAfg1T022LuO3Ccb VGYrhDQjmTu352SuXRxKe1YRCuHPIXsXfoOgjgGW7nUD8BxQrwSb1uo9E8is8FfkOW7W GgpYvcj92YlB18vK8aBESp0LUpifh21v1pbd6kLUun9fgxczQkJDATSPCMTPc0K0zZlE sqpg== X-Gm-Message-State: AOJu0YxkDry6RywG69ryTjQRuH/pVLM8bx5oC14+LTQnDS9pObWJMA6+ HEuEOAHLM5ZbKrQQVrJrsGOZWcuF6MwWO3C+4yubAM037ck9N+wh/1gGk8N4mYQiVdcyWj4Gh6Y ST7cYubhnu6Mwi+5c58Fr1SNIW+1TZg== X-Google-Smtp-Source: AGHT+IEDGlRv5dqX4g4tv9LbuYH+niZIEDlY5KsxJKChgTnFzmihV7fYvZ8A6fscRWSVpBkYDggS5gJXEsNoknRO9o0= X-Received: by 2002:a05:690c:74c6:b0:618:1202:3222 with SMTP id jw6-20020a05690c74c600b0061812023222mr9025315ywb.38.1714371449676; Sun, 28 Apr 2024 23:17:29 -0700 (PDT) In-Reply-To: <87y18x9ijn.fsf@dataswamp.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::1131; envelope-from=yurivkhan@gmail.com; helo=mail-yw1-x1131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318312 Archived-At: On Mon, 29 Apr 2024 at 12:48, Emanuel Berg wrote: > (setq dired-listing-switches > "-A -G -h -l -X --group-directories-first --time-style=3Dlong-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=E2=80=99t) I think I=E2=80=99d approach it = from the =E2=80=9Cdon=E2=80=99t even try to parse=E2=80=9D angle. 1. Choose a subset of switches supported by your =E2=80=98ls=E2=80=99. (=E2= =80=9CAll of them=E2=80=9D is a valid subset.) 2. Build a =E2=80=98transient=E2=80=99 exposing those. Have it fill out som= e reasonable data structure where each switch is a separate field. 3. From that structure, build the =E2=80=98dired-listing-switches=E2=80=99 = string and refresh the dired buffer.