From e61e6d279699f4a4e51254e42843e24b24f380aa Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 20 Jul 2025 11:36:35 +0300 Subject: [PATCH] Improve error message for "C-u M-! something &" * lisp/simple.el (shell-command): User-friendlier error message when async shell command is invoked with a prefix argument. (cherry picked from commit 852009b4f1c9a821ded0cc566d63395c6986ccaa) --- lisp/simple.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index aaf64fb6adc..62130ce1cf3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4577,7 +4577,10 @@ impose the use of a shell (with its need to quote arguments)." ;; Output goes in a separate buffer. (if (string-match "[ \t]*&[ \t]*\\'" command) ;; Command ending with ampersand means asynchronous. - (let* ((buffer (get-buffer-create + (let* ((_ (or (bufferp output-buffer) + (stringp output-buffer) + (error "Asynchronous shell commands cannot output to current buffer"))) + (buffer (get-buffer-create (or output-buffer shell-command-buffer-name-async))) (bname (buffer-name buffer)) (proc (get-buffer-process buffer)) -- 2.39.5