shell-command pops a buffer in fundamental-mode while async-shell-command is in shell-mode. AFAIK, async-shell-command is implemented via shell-command with an additional '&' sign if it doesn't end with it. To reproduce: emacs -Q M-x shell-command SPC ls RET M-x async-shell-command SPC ls RET -- Zhiwei Chen
> From: Zhiwei Chen <condy0919@gmail.com>
> Date: Sat, 24 Apr 2021 18:38:12 +0800
>
>
> shell-command pops a buffer in fundamental-mode while
> async-shell-command is in shell-mode.
That's a feature.
Why do you want the buffer in shell-mode when the command is run
synchronously?
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Zhiwei Chen <condy0919@gmail.com>
>> Date: Sat, 24 Apr 2021 18:38:12 +0800
>>
>>
>> shell-command pops a buffer in fundamental-mode while
>> async-shell-command is in shell-mode.
>
> That's a feature.
>
> Why do you want the buffer in shell-mode when the command is run
> synchronously?
The original intention is to make `async-shell-command` and
`shell-command` default to `evil-normal-state' by adding a hook in which
checks if `this-command' is `shell-command' or `async-shell-command'.
As a result, I found that they behave differently. It looks too odd that
`async-shell-command' is implemented in `shell-command' but it has a
different semantic.
Since the buffer is in `fundamental-mode', there is no way to access
`shell-mode-map' where user maybe define their own bindings.
I'm curious about the reason why it's a feature. Why the synchronous
`shell-command' should be in `fundamental-mode' while the async doesn't.
--
Zhiwei Chen
> From: Zhiwei Chen <condy0919@gmail.com>
> Cc: 47991@debbugs.gnu.org
> Date: Mon, 26 Apr 2021 00:38:10 +0800
>
> I'm curious about the reason why it's a feature. Why the synchronous
> `shell-command' should be in `fundamental-mode' while the async doesn't.
I don't know, it's been that way since 1995. Maybe Richard remembers.
[[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > I'm curious about the reason why it's a feature. Why the synchronous > > `shell-command' should be in `fundamental-mode' while the async doesn't. > I don't know, it's been that way since 1995. Maybe Richard remembers. This decision seems correct to me. The code of Shell mode is mainly meant for (1) handling the output as it arrives asynchronously and (2) editing shell input. In M-!, there is no need for either of those things. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)
Richard Stallman <rms@gnu.org> writes: > The code of Shell mode is mainly meant for (1) handling the output as > it arrives asynchronously and (2) editing shell input. > > In M-!, there is no need for either of those things. So it doesn't sound like we want to change this, and I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no