1) [first patch] We can add a new major mode, for 'M-&' to use instead
of the full-blown 'shell-mode' - it could be very simple: just apply
font-lock keywords and maybe set list-buffers-directory.
Problems? I suppose someone might be using shell-mode-hook to do
something in the async-shell-command output buffer, and it won't fire
anymore. Seemingly very minor concern.
This is not only for 'M-&', but for any place asynchronous
'shell-command' is called. You miss a lot of settings 'shell-mode'
applies. No idea whether people need this in async 'shell-command'.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 9385b023392..f0c64a7a90f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5247,8 +5247,8 @@ tramp-handle-shell-command
;; Display output.
(with-current-buffer output-buffer
(setq mode-line-process '(":%s"))
- (unless (eq major-mode 'shell-mode)
- (shell-mode))
+ (unless (eq major-mode 'shell-command-mode)
+ (shell-command-mode))
(set-process-filter p #'comint-output-filter)
(set-process-sentinel p #'shell-command-sentinel)
(when error-file
You want to make this backward compatible, down to Emacs 27.