all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 30938@debbugs.gnu.org, juri@linkov.net
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	[thread overview]
Message-ID: <838ta88vfz.fsf@gnu.org> (raw)
In-Reply-To: <9b80ae9e-06e3-4217-89b1-eb8a3b0c93b8@default> (message from Drew Adams on Fri, 30 Mar 2018 10:12:13 -0700 (PDT))

> Date: Fri, 30 Mar 2018 10:12:13 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> 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.)





  reply	other threads:[~2018-03-31  9:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-25 16:36 bug#30938: 27.0; `dired-do-create-files' etc.: do NOT always raise error if no files Drew Adams
2018-03-25 16:45 ` Drew Adams
2018-03-28 20:27   ` Juri Linkov
2018-03-28 23:45     ` Drew Adams
2018-03-29 20:04       ` Juri Linkov
2018-03-29 20:25         ` Noam Postavsky
2018-03-30  4:01           ` Drew Adams
2018-03-30  4:01         ` Drew Adams
2018-03-30  7:57           ` Eli Zaretskii
2018-04-02 19:30           ` Juri Linkov
2022-04-21 13:20             ` Lars Ingebrigtsen
2022-04-21 15:01               ` Drew Adams
     [not found]         ` <<8111e8b0-a7fb-4de4-9371-fd69c74c46e5@default>
     [not found]           ` <<83lgeac7xs.fsf@gnu.org>
2018-03-30 15:01             ` Drew Adams
2018-03-30 15:30               ` Eli Zaretskii
     [not found]         ` <<<8111e8b0-a7fb-4de4-9371-fd69c74c46e5@default>
     [not found]           ` <<<83lgeac7xs.fsf@gnu.org>
     [not found]             ` <<ea1c9d9f-2405-4377-bd42-de7f020cf9d4@default>
     [not found]               ` <<83k1tt8ttp.fsf@gnu.org>
2018-03-30 15:43                 ` Drew Adams
2018-03-30 16:07                   ` Eli Zaretskii
     [not found]         ` <<<<8111e8b0-a7fb-4de4-9371-fd69c74c46e5@default>
     [not found]           ` <<<<83lgeac7xs.fsf@gnu.org>
     [not found]             ` <<<ea1c9d9f-2405-4377-bd42-de7f020cf9d4@default>
     [not found]               ` <<<83k1tt8ttp.fsf@gnu.org>
     [not found]                 ` <<ceb6e79f-5f03-45a5-a7a4-5fe954661d5d@default>
     [not found]                   ` <<83in9d8s4b.fsf@gnu.org>
2018-03-30 17:12                     ` Drew Adams
2018-03-31  9:07                       ` Eli Zaretskii [this message]
     [not found]         ` <<<<<8111e8b0-a7fb-4de4-9371-fd69c74c46e5@default>
     [not found]           ` <<<<<83lgeac7xs.fsf@gnu.org>
     [not found]             ` <<<<ea1c9d9f-2405-4377-bd42-de7f020cf9d4@default>
     [not found]               ` <<<<83k1tt8ttp.fsf@gnu.org>
     [not found]                 ` <<<ceb6e79f-5f03-45a5-a7a4-5fe954661d5d@default>
     [not found]                   ` <<<83in9d8s4b.fsf@gnu.org>
     [not found]                     ` <<9b80ae9e-06e3-4217-89b1-eb8a3b0c93b8@default>
     [not found]                       ` <<838ta88vfz.fsf@gnu.org>
2018-03-31 16:10                         ` Drew Adams
2018-03-31 16:50                           ` Eli Zaretskii
2018-03-25 16:50 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838ta88vfz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30938@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.