From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#63744: 28.2; fix dired-guess-default Date: Mon, 29 May 2023 03:23:46 +0200 Message-ID: <87fs7g53rx.fsf@web.de> References: <838rdajmkk.fsf@gnu.org> <83jzwthsx5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7826"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63744@debbugs.gnu.org, Leo Liu To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 29 03:24:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1q3RcR-0001lE-7E for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 May 2023 03:24:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3RcC-0008WG-VO; Sun, 28 May 2023 21:24:04 -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 1q3RcA-0008Vj-S0 for bug-gnu-emacs@gnu.org; Sun, 28 May 2023 21:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q3RcA-0006pm-KJ for bug-gnu-emacs@gnu.org; Sun, 28 May 2023 21:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3Rc9-00018M-VI for bug-gnu-emacs@gnu.org; Sun, 28 May 2023 21:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 May 2023 01:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63744 X-GNU-PR-Package: emacs Original-Received: via spool by 63744-submit@debbugs.gnu.org id=B63744.16853234374346 (code B ref 63744); Mon, 29 May 2023 01:24:01 +0000 Original-Received: (at 63744) by debbugs.gnu.org; 29 May 2023 01:23:57 +0000 Original-Received: from localhost ([127.0.0.1]:56692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3Rc4-000182-Pu for submit@debbugs.gnu.org; Sun, 28 May 2023 21:23:57 -0400 Original-Received: from mout.web.de ([217.72.192.78]:46637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3Rc2-00017n-BN for 63744@debbugs.gnu.org; Sun, 28 May 2023 21:23:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1685323427; i=michael_heerdegen@web.de; bh=DhCbPtlcKXmFAgVoPFIXXiiWtywHUdq+Qv0HXz3HzJk=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=lNxYUZIBJ1SROURX573jKf/Z1uAv3bXT6Qte3n1JFLhxAYM7q8ZqQGPaXhpJa4zK0 BpkM/m1XurA+8mhqWMIB5C+kNDgXadBRhFbTVT6ZqN0F6dU16lAtaGXCdpQdBBEbKC XVmkuNrFRJ6aobjRSErtTanJ2DWGq/9JUv8lk7cRGs8hmZdDoXXwByiCNzzGN6i34M Pu1ALLC+rsNtHnKbsDrueHHc0d/gHkK9p8d6qNjFHeSQt0xBNjc4nu4qMn8bTInDrB s+RnecYL8xeIgmAeA5qk/kPpKHbM4D1wpNZPnnVgUccsXaaUXtUp52eaKmyqFA80FI oIhDlhGO02tUw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([178.14.74.62]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MqqPT-1qOymY10mP-00mvi6; Mon, 29 May 2023 03:23:47 +0200 In-Reply-To: <83jzwthsx5.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 28 May 2023 09:27:34 +0300") X-Provags-ID: V03:K1:g6X3QohD1Ml65oPs+C0PFutg7gCI0V5W8yL1CUtSGwS76bIIElW sGlt1f7CEPcchOGlnszZlTES4clmakjZKagoQlULxmSSyzAFHDLWLgRMVtAfNpDdzKOyctj lt+hDEavYzj59dLXyKrjGa00eaqOoQheIG+XeucFneJLsFLi00rRcj0ylbwSUU49vQ0zW86 XpLzCvIIUZyAFUEpt7hsw== UI-OutboundReport: notjunk:1;M01:P0:WFuk1ygxEm0=;LRnHtrgzE0U9YiMKrDOvbIqpfBe GJn7zu5SWTLNcW/F0sZWXp9QZwtNX1vzrIhOyQap+H3HGMDmE3bI4M9tQKmSeMh5nYl8/lNvV 54gRb1k4qL10VJhwtjk65eM50Iz00wlhDmeIidHZyfSDBGJQEi4rbGYzg6d8tpwlSicrqB2BH ntntTkU37qgy1dq5MmYekHBOoJTbI4dW3TjwJaWiy+5W+L6A/YJPd/AFPjbTEhCh0nI3UxCgC lbPgzunW8WVTsPxecsu26xvpNb0nzPTRq9i/6XKBIDi/xJ+YOY2RaUgImeu617PzP87IvcaR2 UDGpxWQrPgIcIJHSJAIZIdo+3M8d0NrSA0uDwcrBRsYKvBJ+zq9ejFRBPZ1BLiIrMYXcRvdNu mjyRRJzz1/+my/pFsxQf9Qr+adZ/DC5/pz/CTuGHXTiQMqK8dtmlPtOj7+VICKI7rQdmcdQ1B QujOfGSEzAVXTzX1FnSXTPsCyqmi38EslUJeT0Aom06qUobiWnkbSHFPnucq1t/ouqj3LesRj hsiDHRRrk6Zh4Vc1UZwOo6bgN4i4XEG8Oxe9phDcRgRsydc/nEogAM14qyqoMmhJECK6YIMRJ 4M+HwkYP4+dW3FHzakqr9/RXJhTZGM1QG2+GPseeQTvwa/vnA2UsnEcF1jK3Wy0fsqvya673n LYEgjvH7hWq1tfMrFlv4jGfJq9CxUblyK2BXbxeafg6QMwJMPGdvtWqXAk8NbwKvA06uQYA2K y2sVhAxvF6QFQ4jKEMjS2PXrujwQ2wHtbR0L//u5N1ogDnSt1n63RG1W2PQzVyeawqLuBmCq X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262553 Archived-At: Eli Zaretskii writes: > > There is no alternative at the moment other than redefining > > dired-guess-default. > > But your suggestion is also a change in that function, so what's the > difference? I think he means: the user should not have to do this. > > If you have a static list it can be expressed as an element in > > dired-guess-shell-alist-user as such: > > > > (RE "STR1" "STR2" ...) > > > > If you have a dynamic list (for example a list from querying the OS) y= ou > > are stuck. The patch makes this possible and in my view makes > > dired-guess-shell-alist-user more coherent. (RE "STR1" "STR2" ...) can > > be regarded as another syntax for > > > > (RE ("STR1" "STR2" ...)) > > Can't you generate the entire value of dired-guess-shell-alist-user > dynamically, including the RE part? It's a real difference, actually a real win. Please don't only have constant lists in mind. "Dynamically" means that dired can inspect the matched file (the file name is provided via the variable 'file' bound when evaluating the expression). This means the EXPR can look at the properties of the file, it's type and modes etc, which allows a more fine grained user customization. With such a change one can have entries looking like (RE (if COND (GET-DEFAULTS-FOR-COND) (GET-OTHER-DEFAULTS))) which would currently be have to be specified as several entries like (RE (when COND DEFAULT-FOR-COND-1)) (RE (when COND DEFAULT-FOR-COND-2)) ... (RE (when COND DEFAULT-FOR-COND-n)) (RE (when (not COND) OTHER-DEFAULT-1)) ... (RE (when (not COND) OTHER-DEFAULT-m)) and, much worse, testing the CONDITION would have to be performed many times. Other things are currently impossible, for example, taking the current screen setup into account (which can change within an Emacs session). @Leo: > However, it's too late for such extensions on the emacs-29 release > branch, so it could only go to master, for Emacs 30. And it should be > properly documented, of course. `dired-guess-default' lives in "dired-aux" now. > If several COMMANDs are given, the first one will be the default > and the rest will be added temporarily to the history and can be retrie= ved > @@ -975,9 +975,9 @@ See `dired-guess-shell-alist-user'." > (let* ((case-fold-search dired-guess-shell-case-fold-search) > (programs > (delete-dups > - (mapcar > + (mapcan > (lambda (command) > - (eval command `((file . ,(car files))))) > + (ensure-list (eval command `((file . ,(car files)))))) I think we should avoid `nconc'ing: if a user does specify literal lists. the config will be destructively altered (right?). I think we better use (apply #'append (mapcar ...)) or something like that. Michael.