]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve error message for "C-u M-! something &"
authorEli Zaretskii <eliz@gnu.org>
Sun, 20 Jul 2025 08:36:35 +0000 (11:36 +0300)
committerEshel Yaron <me@eshelyaron.com>
Fri, 25 Jul 2025 08:10:40 +0000 (10:10 +0200)
* 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

index aaf64fb6adc42a1daed9ebe951320162a0f5df74..62130ce1cf3c9a5000a8d26ca859e746f41ed212 100644 (file)
@@ -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))