[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71554: 29.3; eshell-command async buffer behavior
From: |
Thierry Volpiatto |
Subject: |
bug#71554: 29.3; eshell-command async buffer behavior |
Date: |
Sat, 15 Jun 2024 05:13:17 +0000 |
Jim Porter <jporterbugs@gmail.com> writes:
> On 6/14/2024 1:32 PM, Thierry Volpiatto wrote:
>> Because IMO what shell-command is doing is annoying, no need to duplicate
>> this annoyance, after all when running such a command in a terminal
>> already running a detached process, nothing is asked, so why doing this
>> in emacs?
>> Or at least make it optional?
>
> 'shell-command' has several possible options for this behavior. See
> 'async-shell-command-buffer'.
Ah, didn't know this one, thanks.
What about something like this reusing async-shell-command-buffer (not
fully tested)?
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 18e05a371a4..774f25d71b0 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -302,13 +302,25 @@ argument), then insert output into the current buffer at
point."
,(eshell-parse-command command))
command))
intr
+ unique
(bufname (if (eq (car-safe proc) :eshell-background)
"*Eshell Async Command Output*"
(setq intr t)
"*Eshell Command Output*")))
- (if (buffer-live-p (get-buffer bufname))
- (kill-buffer bufname))
- (rename-buffer bufname)
+ (when (buffer-live-p (get-buffer bufname))
+ (pcase async-shell-command-buffer
+ ('confirm-kill-process
+ (shell-command--same-buffer-confirm "Kill it")
+ (kill-buffer bufname))
+ ('confirm-new-buffer
+ (shell-command--same-buffer-confirm "Use a new buffer")
+ (setq unique t))
+ ('new-buffer (setq unique t))
+ ('confirm-rename-buffer
+ (shell-command--same-buffer-confirm "Rename it")
+ (kill-buffer bufname))
+ ('rename-buffer (kill-buffer bufname))))
+ (rename-buffer bufname unique)
;; things get a little coarse here, since the desire is to
;; make the output as attractive as possible, with no
;; extraneous newlines
--
Thierry
signature.asc
Description: PGP signature
- bug#71554: 29.3; eshell-command async buffer behavior, Christopher Howard, 2024/06/14
- bug#71554: 29.3; eshell-command async buffer behavior, Thierry Volpiatto, 2024/06/14
- bug#71554: 29.3; eshell-command async buffer behavior, Eli Zaretskii, 2024/06/14
- bug#71554: 29.3; eshell-command async buffer behavior, Thierry Volpiatto, 2024/06/14
- bug#71554: 29.3; eshell-command async buffer behavior, Jim Porter, 2024/06/14
- bug#71554: 29.3; eshell-command async buffer behavior,
Thierry Volpiatto <=
- bug#71554: 29.3; eshell-command async buffer behavior, Thierry Volpiatto, 2024/06/20
- bug#71554: 29.3; eshell-command async buffer behavior, Jim Porter, 2024/06/24
- bug#71554: 29.3; eshell-command async buffer behavior, Thierry Volpiatto, 2024/06/24
- bug#71554: 29.3; eshell-command async buffer behavior, Eli Zaretskii, 2024/06/24
bug#71554: 29.3; eshell-command async buffer behavior, Christopher Howard, 2024/06/24