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

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

bug#71049: async-shell-command ends with "Process *Async Shell Command*


From: Dmitry Gutov
Subject: bug#71049: async-shell-command ends with "Process *Async Shell Command* finished" when remote "direct-async-process"
Date: Fri, 31 May 2024 15:13:31 +0300
User-agent: Mozilla Thunderbird

Hi Michael,

On 31/05/2024 10:27, Michael Albinus wrote:
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'.

My conclusion is they don't, but somebody who uses it more is welcome to argue otherwise.

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.

Sure, makes sense.

diff --git a/lisp/shell.el b/lisp/shell.el
index e6b315ee5c0..7fa84a37e83 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -838,6 +838,13 @@ shell-write-history-on-exit
        (with-current-buffer buf
          (insert (format "\nProcess %s %s\n" process event))))))

+(define-derived-mode shell-command-mode comint-mode "Shell"
+  "Major mode for the output of `async-shell-command'."

"... of asynchronous `shell-command'."

Thank you.





reply via email to

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