From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#30938: 27.0; `dired-do-create-files' etc.: do NOT always raise error if no files Date: Sat, 31 Mar 2018 12:07:28 +0300 Message-ID: <838ta88vfz.fsf@gnu.org> 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>>>> <<>> <<<83k1tt8ttp.fsf@gnu.org>>> <> <<83in9d8s4b.fsf@gnu.org>> <9b80ae9e-06e3-4217-89b1-eb8a3b0c93b8@default> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1522487176 21759 195.159.176.226 (31 Mar 2018 09:06:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 31 Mar 2018 09:06:16 +0000 (UTC) Cc: 30938@debbugs.gnu.org, juri@linkov.net To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 31 11:06:12 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 1f2CSf-0005Wg-5J for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Mar 2018 11:06:09 +0200 Original-Received: from localhost ([::1]:58686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f2CUi-0003lo-Qi for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Mar 2018 05:08:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f2CUY-0003jT-AV for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2018 05:08:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f2CUU-0002Ow-7i for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2018 05:08:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52751) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f2CUU-0002Oa-3A for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2018 05:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f2CUT-00008C-Qj for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2018 05:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 31 Mar 2018 09:08: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.1522487261474 (code B ref 30938); Sat, 31 Mar 2018 09:08:01 +0000 Original-Received: (at 30938) by debbugs.gnu.org; 31 Mar 2018 09:07:41 +0000 Original-Received: from localhost ([127.0.0.1]:60648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f2CU8-00007a-SS for submit@debbugs.gnu.org; Sat, 31 Mar 2018 05:07:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f2CU7-00007O-8k for 30938@debbugs.gnu.org; Sat, 31 Mar 2018 05:07:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f2CTy-000250-4h for 30938@debbugs.gnu.org; Sat, 31 Mar 2018 05:07:34 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f2CTy-00024s-0T; Sat, 31 Mar 2018 05:07:30 -0400 Original-Received: from [176.228.60.248] (port=2805 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f2CTx-0005hs-L3; Sat, 31 Mar 2018 05:07:29 -0400 In-reply-to: <9b80ae9e-06e3-4217-89b1-eb8a3b0c93b8@default> (message from Drew Adams on Fri, 30 Mar 2018 10:12:13 -0700 (PDT)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:144757 Archived-At: > Date: Fri, 30 Mar 2018 10:12:13 -0700 (PDT) > From: Drew Adams > Cc: juri@linkov.net, 30938@debbugs.gnu.org > > A non-interactive use case for an arbitrary command that > calls ` dired-get-marked-files' does not necessarily > have `user-error' as the right behavior for an empty set > of marked files. That's all I'm saying. I'm sorry, but you lost me. Let me try explaining this from my POV. First, dired-get-marked-files _can_ be invoked when no files are marked, without risking a user-error: it has the ARG argument for that. So if your hypothetical command needs for some reason to work when no files are marked, it can, at least in principle. Why your dired-insert-subdirs didn't go that way, or at least didn't pass nil as ERROR, I don't understand (and I'm not sure it's related to the issue at hand). It is true that dired-aux.el commands that call dired-get-marked-files all pass nil as ARG (and t as ERROR), but what would be the semantics of, say, dired-do-isearch-regexp when no files are marked? That command, and all the others which call dired-get-marked-files in the same manner, is to do something on "all marked files", as their doc string clearly says. So why do we need to allow these commands to be invoked when no files are marked, and expect them not to signal a user-error? IOW, even if dired-do-isearch-regexp and its ilk are invoked non-interactively, they are invoked as result of some command up the call-stack, so the invocation does come from the user. And since dired-do-isearch-regexp etc. are documented to act on marked files, it sounds appropriate to signal an error when no files are marked. A feature which wants to allow users to get away silently in this case can always check whether any files are marked and avoid calling dired-do-isearch-regexp etc. if none are. That is why I asked for real-time use-cases where this gets in the way: your argument sounds like a general philosophical issue to me: you claim that it's "completely inappropriate" for a utility function to signal an error on theoretical grounds, while in reality I still don't see any practical problem that cannot be easily resolved. If your diredp-insert-subdirs is an example of a problem, then as I said above, I don't understand why you couldn't just omit the last optional argument to dired-get-marked-files, and be done. (And since ERROR was _added_ in Emacs 27, your original code should have been already future-proof against such changes anyway.)