From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 12 12:06:22 2014 Received: (at submit) by debbugs.gnu.org; 12 Apr 2014 16:06:22 +0000 Received: from localhost ([127.0.0.1]:46359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WZ0Rh-0001US-LK for submit@debbugs.gnu.org; Sat, 12 Apr 2014 12:06:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49715) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WZ0Rf-0001UA-4I for submit@debbugs.gnu.org; Sat, 12 Apr 2014 12:06:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZ0RP-0002Hk-Gs for submit@debbugs.gnu.org; Sat, 12 Apr 2014 12:06:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:46347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZ0RP-0002Hg-EI for submit@debbugs.gnu.org; Sat, 12 Apr 2014 12:06:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZ0RG-0006Dj-L3 for bug-gnu-emacs@gnu.org; Sat, 12 Apr 2014 12:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZ0R7-0002C8-UW for bug-gnu-emacs@gnu.org; Sat, 12 Apr 2014 12:05:54 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:24749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZ0R7-0002AG-Ms for bug-gnu-emacs@gnu.org; Sat, 12 Apr 2014 12:05:45 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s3CG5guw029446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 12 Apr 2014 16:05:43 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s3CG5fBS023313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 12 Apr 2014 16:05:42 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id s3CG5fEA003098 for ; Sat, 12 Apr 2014 16:05:41 GMT MIME-Version: 1.0 Message-ID: <97d70b54-93f6-4247-9a29-68145f9d8965@default> Date: Sat, 12 Apr 2014 09:05:42 -0700 (PDT) From: Drew Adams To: bug-gnu-emacs@gnu.org Subject: 24.4.50; `dired-guess-default': wrong logic X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) The logic in the implementation of `dired-guess-default' is wrong, or at least not optimal. And it is not what users are entitled to expect, based on the doc of `dired-guess-shell-alist-user'. If this logic is kept as is (which would be unfortunate), then at least there is a doc bug here, because the doc of user option `dired-guess-shell-alist-user' does not reflect this logic. Users will thus get behavior that does not correspond to what they expect based on the doc. The doc gives the impression that if you have multiple entries in the option value that use different regexps with the same command, these will be used together, IOW, any and all of them will be associated with the same command. That is the whole point of this user option (and also of variable `dired-guess-shell-alist-default'): to associate file names with one or more commands. The regexps are only a handy means to that end. For example, from the doc, one can reasonably expect that if the option value is this: (("\\.png\\'" "foo.exe") ("\\.jpg\\'" "foo.exe")) then command "foo.exe" can be used for a list of files such as: ("toto.png" "tata.jpg") But this is not in fact what the behavior is. To get that expected behavior, the user would have to combine those entries into a single entry such as this: (("\\.\\(png\\|jpg\\)\\'" "foo.exe")) This is not at all clear from the doc. And it means extra work and better knowledge of regexps on the part of users. The culprit code is this part of `dired-guess-default': ;; If more than one file, see if all of FILES match regular expression. (while (and flist (string-match-p regexp (car flist))) (setq flist (cdr flist))) IOW, the code expects each of the files in the list of candidates to match the given regexp. In the case above, this means that the regexp "\\.png\\'" would be tested against each of the files ("toto.png" "tata.jpg"), it would fail, and so the command "foo.exe", which the user has explicitly configured as appropriate for both PNG files and JPG files, would not be available. IOW, instead of working off of the regexp only, the code should work off of the associated COMMANDS. What is important here is the COMMAND, "foo.exe", and it is clearly (according to the user) appropriate for all files whose names match either regexp (i.e., all PNG and JPG files). IOW, the implementation is overly restrictive. The true requirement is that each of the file names in the list of candidates must be mapped to the SAME COMMAND via *some* regexp. The requirement is not (should not be) that each of the file names must match the SAME REGEXP. It is the COMMAND that is important. The regexps are just a means of associating file names with commands. If you do not fix the implementation logic of `dired-guess-default' (which would be unfortunate), then please at least fix the doc string of option `dired-guess-shell-alist-user' so that it tells users that they MUST COMBINE regexps that are mapped to the same command, i.e., they must come up with a single regexp for the given command. A list of files whose names are associated with the same command via different regexps will not be handled by that command. In GNU Emacs 24.4.50.1 (i686-pc-mingw32) of 2014-04-08 on ODIEONE Bzr revision: 116956 dancol@dancol.org-20140408123940-knoyutxt4l8ws7qm Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/snapshot/trunk --enable-checking=3Dyes,glyphs 'CFLAGS=3D-O0 -g3' LDFLAGS=3D-Lc:/Devel/emacs/lib 'CPPFLAGS=3D-DGC_MCHECK=3D1 -Ic:/Devel/emacs/include'' From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 12 12:28:46 2014 Received: (at 17251) by debbugs.gnu.org; 12 Apr 2014 16:28:46 +0000 Received: from localhost ([127.0.0.1]:46384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WZ0nN-00027j-6Z for submit@debbugs.gnu.org; Sat, 12 Apr 2014 12:28:45 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:22726) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WZ0nK-00027Q-ES for 17251@debbugs.gnu.org; Sat, 12 Apr 2014 12:28:43 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s3CGSZKj010313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <17251@debbugs.gnu.org>; Sat, 12 Apr 2014 16:28:36 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s3CGSXmF025475 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <17251@debbugs.gnu.org>; Sat, 12 Apr 2014 16:28:35 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id s3CGSXb4000391 for <17251@debbugs.gnu.org>; Sat, 12 Apr 2014 16:28:33 GMT MIME-Version: 1.0 Message-ID: <0628ccb7-0ee6-4522-bfba-bc853c5e8985@default> Date: Sat, 12 Apr 2014 09:28:34 -0700 (PDT) From: Drew Adams To: 17251@debbugs.gnu.org Subject: RE: bug#17251: 24.4.50; `dired-guess-default': wrong logic References: <97d70b54-93f6-4247-9a29-68145f9d8965@default> In-Reply-To: <97d70b54-93f6-4247-9a29-68145f9d8965@default> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 17251 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) In fact, at the top of the section of `dired-x.el' which implements this, you will find an English description of the overly restrictive logic: ;;; GUESS SHELL COMMAND. ;; Brief Description: ;;; ;; * `dired-do-shell-command' is bound to `!' by dired.el. ;;; ;; * `dired-guess-shell-command' provides smarter defaults for ;;; dired-aux.el's `dired-read-shell-command'. ;;; ;; * `dired-guess-shell-command' calls `dired-guess-default' with list of ;;; marked files. ;;; ;; * Parse `dired-guess-shell-alist-user' and ;;; `dired-guess-shell-alist-default' (in that order) for the first REGEX= P ;;; that matches the first file in the file list. ;;; ;; * If the REGEXP matches all the entries of the file list then evaluate ;;; COMMAND, which is either a string or a Lisp expression returning a ;;; string. COMMAND may be a list of commands. ;;; ;; * Return this command to `dired-guess-shell-command' which prompts user ;;; with it. The list of commands is put into the list of default values= . ;;; If a command is used successfully then it is stored permanently in ;;; `dired-shell-command-history'. The inappropriate part of the logic is described in the 5th bullet. The logic should not be to require that a single REGEXP (the first regexp) "matches all the entries of the file list" in order to find the appropriate COMMAND. It should be to require that all files in the file list are associated with the same COMMAND. Individual files in the list should be able to be associated with the COMMAND in different ways (i.e., using different regexps). From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 01:50:08 2021 Received: (at 17251) by debbugs.gnu.org; 29 May 2021 05:50:08 +0000 Received: from localhost ([127.0.0.1]:55775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmrrL-0004pV-QF for submit@debbugs.gnu.org; Sat, 29 May 2021 01:50:07 -0400 Received: from quimby.gnus.org ([95.216.78.240]:35366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmrrK-0004or-24 for 17251@debbugs.gnu.org; Sat, 29 May 2021 01:50:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hgf4+p7rPJ/jZOtNFgtxlfso57f1AJT6WgOAOyNRDpw=; b=I6ZmjcB+u1DrtSTa2OQVSdNTFN ElZiQKvXxG3mYJ05JRaeBGNF3w3bFVYpr81p+kBrZHN770c44cXC3TU8kv2EIb3Rluj229V0sEz3R vBKphfmFxz/UPaqACiGhYgT75ZH9qyeOZ44Mc6Y9uBYn4wnwk0Zj7vuILl5hHMcrt+ks=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lmrrB-00025k-Ks; Sat, 29 May 2021 07:49:59 +0200 From: Lars Ingebrigtsen To: Drew Adams Subject: Re: bug#17251: 24.4.50; `dired-guess-default': wrong logic References: <97d70b54-93f6-4247-9a29-68145f9d8965@default> X-Now-Playing: Joni Mitchell's _Court and Spark_: "Trouble Child" Date: Sat, 29 May 2021 07:49:57 +0200 In-Reply-To: <97d70b54-93f6-4247-9a29-68145f9d8965@default> (Drew Adams's message of "Sat, 12 Apr 2014 09:05:42 -0700 (PDT)") Message-ID: <87eedqrsvu.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Drew Adams writes: > But this is not in fact what the behavior is. To get that expected > behavior, the user would have to combine those entries into a single > entry such as this: > > (("\\.\\(png\\|jpg\\)\\'" "foo.exe [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17251 Cc: 17251@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Drew Adams writes: > But this is not in fact what the behavior is. To get that expected > behavior, the user would have to combine those entries into a single > entry such as this: > > (("\\.\\(png\\|jpg\\)\\'" "foo.exe")) > > This is not at all clear from the doc. I've now mentioned this in the doc string. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 01:50:12 2021 Received: (at control) by debbugs.gnu.org; 29 May 2021 05:50:12 +0000 Received: from localhost ([127.0.0.1]:55778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmrrQ-0004pm-0j for submit@debbugs.gnu.org; Sat, 29 May 2021 01:50:12 -0400 Received: from quimby.gnus.org ([95.216.78.240]:35382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmrrO-0004pJ-FC for control@debbugs.gnu.org; Sat, 29 May 2021 01:50:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=10RmQoNWCRFg5pr5AKPYlJogfHrgchId5pzH69LTfuw=; b=dmPz0SEeqyUZ3wXcanljdMiCsh JPggEDtimrQyT9BjKtDwzSGKBnF6J6nX4eT9pr+pcNTdVSad/vQeq4N/6YdMH+BbqjkGPYjbk3xWU zqJelkSC7hEgItbGYXSat5WrvfLDcYT/0DFpMEbAqkGb2hEvhRZDCxJvdV3ioT9+vrEo=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lmrrG-00025v-VC for control@debbugs.gnu.org; Sat, 29 May 2021 07:50:04 +0200 Date: Sat, 29 May 2021 07:50:02 +0200 Message-Id: <87cztarsvp.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #17251 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 17251 fixed close 17251 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 17251 fixed close 17251 28.1 quit From unknown Mon Jun 23 04:11:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 26 Jun 2021 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator