bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47432: 28.0.50; Dired using ! or & on file should fail without comma


From: Eli Zaretskii
Subject: bug#47432: 28.0.50; Dired using ! or & on file should fail without command supplied
Date: Sun, 28 Mar 2021 11:13:02 +0300

> Date: Sun, 28 Mar 2021 10:50:37 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: 47432@debbugs.gnu.org
> 
> * Arthur Miller <arthur.miller@live.com> [2021-03-27 23:29]:
> > Emacs is not executing them, Emacs is passing them to the shell. Same
> > happends as if you tried to execute that file from the command
> > prompt.
> 
> Maybe in your opinion, not that I have same opinion, look:
> 
> In Emacs, I press ! because I wish to write a command to be executed
> on the file, not to execute empty command which I did not write. When
> I press RET without entering command, I expect nothing to happen.

Is this expectation consistent with the documentation of '!'?
Specifically, how are you sure that an empty COMMAND does nothing in
the shell?

> As in shell when I press RET after prompt, nothing happens.
> 
> $ RET
> $

With that shell, perhaps.  But Emacs doesn't know what shell will be
invoked, it depends on various factors outside of Dired's control.

> - description of function does not say that empty RET should be
>   considered "COMMAND", there is no mentioning (I could miss it maybe)
>   that file itself will be executed;
> 
> - info manual does not reflect that what you are speaking. It says:
>   "The Dired command ‘!’ (‘dired-do-shell-command’) reads a shell
>   command string in the minibuffer, and runs that shell command on one
>   or more files."

None of the above says anything about the effect of an empty string as
COMMAND.

> If I press in this mail-mode buffer M-! I am invited to enter string
> that will be executed as shell command, if I then press RET, I get
> message: (Shell command succeeded with no output) -- this is also
> wrong in my opinion, as if I have not entered any command, it should
> not say "Shell command succeeded" -- rather, "No shell command
> supplied." -- as trying to execute empty string as command does not
> make sense.

You explicitly ignore the fact that many Emacs commands provide
defaults when the user just types RET?

> When I press M-& in mail-mode buffer (or other but dired), and I press
> RET, I get message like: ": finished." -- which is also incorrect
> message, it also means nothing specific. It does not help user. It is
> confusing. What means colon in this space and how is colon finished?

The colon is a shell command that does nothing.  I's probably
explained in the manual of your shell.

> However, why should ! or & in Dired try to execute non-executable
> file, they shall verify if it is directory, if no command was
> supplied, they should not try to execute directory name as shell
> command.

You are assigning certain semantics to the command arguments, but the
real semantics is assigned by the shell, not by Emacs.  As Arthur
says, Emacs just passes the arguments to the shell.

So I think your expectations, while they are true in many cases, don't
have to be true always.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]