From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#30285: dired-do-chmod vs. top line of dired Date: Thu, 1 Feb 2018 08:10:51 -0800 (PST) Message-ID: References: <87mv0wg80c.fsf@jidanni.org> <87efm8snnr.fsf@gmail.com> <83efm8irac.fsf@gnu.org> <87d11sl08v.fsf@gmail.com> <87fu6lwxxu.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1517501368 686 195.159.176.226 (1 Feb 2018 16:09:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Feb 2018 16:09:28 +0000 (UTC) Cc: 30285@debbugs.gnu.org, jidanni@jidanni.org To: Tino Calancha , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 01 17:09:23 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehHQI-0007k7-8S for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Feb 2018 17:09:14 +0100 Original-Received: from localhost ([::1]:45340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehHSJ-0006m7-CA for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Feb 2018 11:11:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehHS8-0006lH-L6 for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2018 11:11:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehHS2-0008Mz-II for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2018 11:11:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44699) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehHS2-0008Mp-Bn for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2018 11:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ehHS2-0008I2-5f for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2018 11:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Feb 2018 16:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30285 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30285-submit@debbugs.gnu.org id=B30285.151750146131859 (code B ref 30285); Thu, 01 Feb 2018 16:11:02 +0000 Original-Received: (at 30285) by debbugs.gnu.org; 1 Feb 2018 16:11:01 +0000 Original-Received: from localhost ([127.0.0.1]:52596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehHS0-0008Hm-O6 for submit@debbugs.gnu.org; Thu, 01 Feb 2018 11:11:00 -0500 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:51640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehHRz-0008HZ-CN for 30285@debbugs.gnu.org; Thu, 01 Feb 2018 11:10:59 -0500 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w11G7MEU058627; Thu, 1 Feb 2018 16:10:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=MHbyODqeespe3SAMzjVRlAAPl2BfisbA10B49TS2uPg=; b=A0mTd5G2JuwsfXFnz+pOqMphfHE/+Dpcyi4KDsnA14GSbohSc3m0BDpBVMriMdR3zlxA EOvJYupt5NKKP7f39g1pR6dBjU/RDXKvYs67CPC4DVXY2zr6Sz2TRytNrgTEpbkGoy6S r6S0KsQgT55/gGh2SB+zION1r6gYTVFV8mU+2cRIbRcROm5/plTmn8EL/eyrV4PHO6JG zK00i7zzEmFbwM2MWYTREf00VtjQlziY5tMUL56wkBQuGfvUb4r+M5Efh4zR9nnYmkXv SK1eUttAxr8BSOWZeRkqDHhTkY9vEv0IVVR6rVHbskakPWp6kA5kufGc6JZVfU9puItF JA== Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2fv5r0r5y1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Feb 2018 16:10:53 +0000 Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w11GArgH001619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2018 16:10:53 GMT Original-Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w11GAqIS012554; Thu, 1 Feb 2018 16:10:52 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4639.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8792 signatures=668660 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802010207 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:142766 Archived-At: > I would like all `dired-do...' commands behave the same under the > 'X condition': * called from the top line ** no marked files. I've already said that it's not only about the top line. It's about the ordinary Dired situation of not being on a file line. Plenty of Dired code already deals (simply) with this "X condition". The important things about a command that acts on the marked files are that (1) it acts on the N next files, if given a numeric prefix arg, (2) if no prefix arg, it acts on the marked files, if any, (3) if not prefix arg and no marked files it acts on the file of the current line, and (4) it doesn't do something confusing if there is no prefix arg, there are no marked files, and there is no file on the current line.=20 This bug is only about case (4) - a corner case. The solution is to just let the user know that s?he is not on a file line. > >> No, we don't need a function `dired-marked-files-or-file-at-point-p', > >> for that or anything else. The `dired-do-*' commands already DTRT > >> wrt the marked-files-or-file-at-point. > > > > I agree that it's better to check the =E2=80=98files=E2=80=99 returned = from > > =E2=80=98dired-get-marked-files=E2=80=99. >=20 > Today I took a deeper look in the train and I saw there are > several more commands that don't protect against X. Some > even breaks (e.g., dired-do-shell-command, > dired-do-async-shell-command). >=20 > Below patch introduce a macro to systematically handle the 'X > condition', what do you think? Sorry, Tino, but I don't have the time or the will to check your large patch. My impression is that you guys are going overboard. This bug is a _trivial_ usability bug. There is nothing really wrong with the existing behavior. But yes, it is unnecessary, and it could be slightly confusing, to prompt the user about acting on zero files. The trivial bug should be fixed; sure. But it's not a big deal. The fix is also trivial. Dired already provides what is needed, as has been pointed out: just check the return value of `dired-get-marked-files'. If no files are marked then handle use of the command as a `user-error': inform the user that there is no file on the current line and no files are marked. End of story. This is trivial to do, and the resulting (corner case) behavior will be simple, consistent, and clear to all users. If some `dired-do-*' command does not already use `dired-get-marked-files' up front, and if it is not appropriate for it to use it, then there are at least two other alternatives that Dired offers to detect this corner case. I already mentioned them. Using either of them to fix the bug is also trivial. In sum: trivial problem, trivial solution. I'm not happy seeing big changes made to Dired code gratuitously. I don't have the time to argue about it or provide alternative patches. But I hope you will not go down the road you seem to be going down. Just one opinion.