From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Dired subdirectories & the ls option time-style with the %R sequence Date: Wed, 24 May 2023 13:36:00 +0200 Message-ID: <87cz2qneqn.fsf@gmail.com> References: <87fs7mugwv.fsf@gautierponsinet.xyz> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31140"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Gautier Ponsinet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 24 13:36:43 2023 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 1q1mnL-0007un-5c for ged-emacs-devel@m.gmane-mx.org; Wed, 24 May 2023 13:36:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1mml-0001Db-NC; Wed, 24 May 2023 07:36:07 -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 1q1mmj-0001D3-Sn for emacs-devel@gnu.org; Wed, 24 May 2023 07:36:05 -0400 Original-Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1mmi-0003Fn-76 for emacs-devel@gnu.org; Wed, 24 May 2023 07:36:05 -0400 Original-Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3f6094cb2d2so9940005e9.2 for ; Wed, 24 May 2023 04:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684928162; x=1687520162; h=mime-version:message-id:date:gmane-reply-to-list:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5HYnpWx0p81aDwpcgCr8LkwDTPcWEPryVF88C/Aunq4=; b=nbUoAfkqmRyu7Zz4/3s1QM+9B6DYS799nJ8KPxuBSh4be0CxwyQTbkBk7e5kb3fO1i mD/WZuz0r8kLfnNJFSluykXsyeaSgYbuL67v6IZtIdGWXRG5cyKtnX3fFeNQ8a2PfPfi iqAEPEgcIrA7mq5875yIJRdHIvJdk+o1qom5PDS84ukY7c6XNADifCtA6FNaszCznV59 WBaVpRpeI24F8YkB3ujP8E30Mqpn/4S+NU/BUDeNzwh2wSjdBcdoM4huIeOaLUFsMBuc VRBwEx7+JGgnCHgUedrpIklaSziWlHrdMN2FtgnhZ/Z9L5TWvlLsObJhzcz9wOEXaOpm d86g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684928162; x=1687520162; h=mime-version:message-id:date:gmane-reply-to-list:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5HYnpWx0p81aDwpcgCr8LkwDTPcWEPryVF88C/Aunq4=; b=RU/RLQJO5+cn11rfgBozb38H5G6UES86ijQiM16Dbl7yOTCxxT8xTmISwwu7JciG32 lEhDyer9uWPOWIwRCoW1TFj5aWfx7K6xldgW1OVq+OBeXXshxtS5FwoTa7LT0y4U7mTk R5sP7iECWvP32vDrsFfUo3TM1c8r5zrpwkjVX1DeCA5fE239rD0VPRlYhaWNOUx1xcZQ PAAKsrC8bIOpWS00qto2g4nTPs6YBVcFq8yhd58NnX4c7AsJvZq8dnB71nQYni4dfMqv t0Y2zNaioldueo6NBoCJEeLo3GVU/gkjp9a6EO6rD0MR3Kd9eKvf9pUldhV33WGxplrG GTnQ== X-Gm-Message-State: AC+VfDwFFh4NA0bNeLCg8xrP3kkYrcB6NxAI22BadEZE2AKQ3raDWzZY WhnAGtgi+ifH+Nzx6aOewjbSFZeKi+Q= X-Google-Smtp-Source: ACHHUZ5YsbwDTHd7dsSkADMQtTw3nYl7bRyN8CPF7ce4sYGeED4cFtNYssYkEdWp/Xu75o/R6E9vQw== X-Received: by 2002:a7b:c31a:0:b0:3f5:f83:4d84 with SMTP id k26-20020a7bc31a000000b003f50f834d84mr12362937wmj.31.1684928161550; Wed, 24 May 2023 04:36:01 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id a10-20020a05600c224a00b003f4247fbb5fsm2064748wmm.10.2023.05.24.04.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 04:36:01 -0700 (PDT) In-Reply-To: <87fs7mugwv.fsf@gautierponsinet.xyz> (Gautier Ponsinet's message of "Wed, 24 May 2023 13:07:12 +0200") Gmane-Reply-To-List: yes Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=rpluim@gmail.com; helo=mail-wm1-x336.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, T_SCC_BODY_TEXT_LINE=-0.01 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:306296 Archived-At: >>>>> On Wed, 24 May 2023 13:07:12 +0200, Gautier Ponsinet said: Gautier> Hello everyone, Gautier> I use dired with the variable `dired-listing-switches' containing the Gautier> --time-style option of ls (from the GNU coreutils), itself containing Gautier> the %R sequence. Precisely, I have: Gautier> (setq dired-listing-switches "-l -Fhv --group-directories-first \"--time-style=+%F %a %R\" ") Gautier> in my init.el file. Gautier> I have adapted the variable `directory-listing-before-filename-regexp' Gautier> accordingly and everything works fine, except when I insert a Gautier> subdirectory in dired using `dired-maybe-insert-subdir'. It seems that Gautier> the "%R" in the time-style option is interpreted as a -R option in Gautier> dired-insert-subdir and is removed (there is a (string-replace "R" "" Gautier> switches) somewhere in the function `dired-insert-subdir'). As a result, Gautier> the expected time is not printed and only a "%" appears, so my regexp Gautier> does not work and dired is confused. Gautier> Of course, I can also replace the %R by %H:%M in my config, which I do, Gautier> and I don't have this problem. Nevertheless, the bug seems there. It Gautier> took me some time to understand the problem, and I guess other people Gautier> might encounter the same problem. Gautier> Maybe `dired-insert-subdir' could search for "R" but exclude "%R"? Something like the following (untested) patch? diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index fc3f6f4f04d..dc558e13ac8 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3142,7 +3142,7 @@ dired-insert-subdir (and (not switches) cons (setq switches (cdr cons))) (dired-insert-subdir-validate dirname switches) ;; case-fold-search is nil now, so we can test for capital `R': - (if (setq switches-have-R (and switches (string-match-p "R" switches))) + (if (setq switches-have-R (and switches (string-match-p "[^%]R" switches))) ;; avoid duplicated subdirs (setq mark-alist (dired-kill-tree dirname t))) (if elt Robert --