From: Eli Zaretskii Date: Sun, 20 Jul 2025 08:36:35 +0000 (+0300) Subject: Improve error message for "C-u M-! something &" X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e61e6d279699f4a4e51254e42843e24b24f380aa;p=emacs.git 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) --- 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))