Subject: Re: bug#71049: async-shell-command ends with "Process *Async Shell Command* finished" when remote "direct-async-process"

From: Dmitry Gutov <[email-masked]>
Date: Wed, 29 May 2024 23:40:28 +0300

On 29/05/2024 21:38, Michael Albinus wrote:
> Dmitry Gutov<[email-masked]>  writes:
> 
>> On 29/05/2024 20:42, Michael Albinus wrote:
>>> I made also the proposal to suppress reading
>>> the remote history file for shell-command by default (performance!)
>> How is that going to look, code-wise?
> Not tested yet:
> 
> 
> diff --git a/lisp/tramp.el b/lisp/tramp.el
> index b2442f45..ba852cf6 100644
> --- a/lisp/tramp.el
> +++ b/lisp/tramp.el
> @@ -5260,7 +5260,17 @@ support symbolic links."
>   	      (with-current-buffer output-buffer
>   		(setq mode-line-process '(":%s"))
>   		(unless (eq major-mode 'shell-mode)
> -		  (shell-mode))
> +		  ;; We set `tramp-histfile-override' to t in order to
> +		  ;; suppress reading the remote history file by
> +		  ;; default.  Could be overridden by the user with a
> +		  ;; connection-local setting.
> +		  (let ((tramp-histfile-override t))
> +		    ;; `with-connection-local-application-variables'
> +		    ;; exists since Emacs 29.  Older Emacsen will use
> +		    ;; default application `tramp'.
> +		    (tramp-compat-with-connection-local-application-variables
> +			'shell-command
> +		      (shell-mode))))
>   		(set-process-filter p #'comint-output-filter)
>   		(set-process-sentinel p #'shell-command-sentinel)
>   		(when error-file

Thank you. I haven't tested this personally either, but it seems like 
this is the behavior we will want by default.

So the proposed solution should include it, I think.