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#30938: 27.0; `dired-do-create-files' etc.: do NOT always raise error if no files Date: Fri, 30 Mar 2018 08:01:42 -0700 (PDT) Message-ID: References: <<7ea429b5-b12e-4639-9d77-11db71504d9c@default> <87605g7xpj.fsf@mail.linkov.net> <70149736-0c90-4059-91d0-155144bf4abd@default> <87o9j6k5qx.fsf@mail.linkov.net>> <<8111e8b0-a7fb-4de4-9371-fd69c74c46e5@default>> <<83lgeac7xs.fsf@gnu.org>> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1522422011 30284 195.159.176.226 (30 Mar 2018 15:00:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 30 Mar 2018 15:00:11 +0000 (UTC) Cc: 30938@debbugs.gnu.org, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 30 17:00:06 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 1f1vVe-0007lr-4x for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Mar 2018 17:00:06 +0200 Original-Received: from localhost ([::1]:44476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1vXh-0008J6-NO for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Mar 2018 11:02:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1vXX-0008IM-AM for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 11:02:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1vXW-0006Dh-Bi for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 11:02:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f1vXW-0006DX-7o for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 11:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f1vXV-0001H0-NS for bug-gnu-emacs@gnu.org; Fri, 30 Mar 2018 11:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Mar 2018 15:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30938 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30938-submit@debbugs.gnu.org id=B30938.15224221154882 (code B ref 30938); Fri, 30 Mar 2018 15:02:01 +0000 Original-Received: (at 30938) by debbugs.gnu.org; 30 Mar 2018 15:01:55 +0000 Original-Received: from localhost ([127.0.0.1]:60351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f1vXP-0001Gf-I2 for submit@debbugs.gnu.org; Fri, 30 Mar 2018 11:01:55 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:48180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f1vXN-0001GM-6P for 30938@debbugs.gnu.org; Fri, 30 Mar 2018 11:01:53 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2UEswri094097; Fri, 30 Mar 2018 15:01:47 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=B+4pEW/8X26+wp4Ckq2yIS6NtPtBLgOq1dPRCkiq91E=; b=j1nLuHr8JmhcDwq7rxaw36usJBS7OUoLZ4sJvu2BDINfZC2/o+WZySLve59meU5wJJ4c 4TKk7NINyJtuyys/4Zt+rbltHWXFWDH0/7BooB1umN/QHFfxC2JYHpmQRJm2UJNhPzoa AueuOUMDgtxx/zXDcNCH31xocV9gxbf8vXbe/SkTxjBIWl6OyJQbrQPpDaGwQPDlYHGI ItvqX3NBqrjuOuww3+rZMp1YvS19Ozr1k8XvMDX1DYqfIGTDF6jJdje/F1wftcsXxs4X 8UJPebpaAvHEYtnyLmiipTH0U1P/HaEoUuGEVfpL6B0Wt4BS6CuEjyiZp5QxA560JzfE tg== Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2h1qdyr0xd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Mar 2018 15:01:46 +0000 Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2UF1jSA022910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Mar 2018 15:01:45 GMT Original-Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2UF1iAS018861; Fri, 30 Mar 2018 15:01:44 GMT In-Reply-To: <<83lgeac7xs.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4666.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8847 signatures=668697 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-1803300148 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:144743 Archived-At: > A lot of discussion gone under the bridge, but I asked a question in > the very beginning that was apparently ignored: >=20 > Please provide at least one example (preferably more than one) of a > real-life use case where these changes get in the way. >=20 > Without an answer to that, I cannot see why we have to do anything > about this issue, because up front I see no problem here at all, not > one that has been spelled out. I answered your question, pointing to the example of calling `dired-do-isearch' (or any of the other such commands) non-interactively - e.g., by creating a command that uses it. If you don't believe that a user or another library could or would define such a command (or in any other way would call an existing function that calls the workhorse function `dired-get-marked-files', then too bad. In that case your idea of real-life use of Emacs Lisp differs from mine; you will close the bug; and we will move on. I've already fixed my code to work around this change (except for `dired-do-chxxx' repercussions - see below). --- `dired-get-marked-files' is no less a utility function than is, say, `dired-get-filename'. And functions, including commands, that call it are themselves candidates for reuse in defining other functions, including other commands. In addition, users often look to the definitions of Emacs commands when creating similar or derivative commands. Imagine that a user wants a command similar to `dired-do-search' but that does things a bit differently. S?he might look at the def of `dired-do-isearch' for inspiration, and thus copy its use of `dired-marked-files'. Hard-coding a non-nil 5th arg for it is a bad model. (Same thing for `dired-do-search' etc. and the other commands that, for some reason (?), have not yet undergone this change.) --- Similarly, for `dired-do-chxxx', which is NOT a command, and which currently hardcodes a non-nil 5th arg to `dired-get-marked-files' just like the commands do. To fix that aberration a bit more surgery is required, no doubt. We could add an optional ERROR-IF-NONE-P arg to `dired-do-chxxx', and obtain that from an optional INTERACTIVEP arg to `dired-do-chmod' etc. IOW, same kind of fix. Or perhaps Juri has a better fix in mind. And as for "real-life" examples, BTW, I do define `-mouse-' versions of the `dired-do-ch*' commands. E.g.: (defun diredp-mouse-do-chmod (event) "Change the mode of this file. This calls chmod, so symbolic modes like `g+w' are allowed." (interactive "e") (let ((mouse-pos (event-start event))) (select-window (posn-window mouse-pos)) (goto-char (posn-point mouse-pos))) (dired-do-chxxx "Mode" "chmod" 'chmod 1) (diredp-previous-line 1)) As I haven't yet bothered to fix the now-bugged `dired-do-chxxx' locally, such "real-life" commands of mine are still broken by this recent change (for the moment). You can do nothing to fix this bug, and wait to see whether Drew is the only one who has or will ever have code that gets bitten by it. Or you can DTRT and not hardcode raising an error systematically whenever `dired-get-marked-files' would come up with no files.