Subject: Re: bug#63432: 30.0.50; Handle current-prefix-arg in async-shell-command

From: Gabriel <[email-masked]>
Date: Sat, 13 May 2023 20:35:51 -0300

Eli Zaretskii <[email-masked]> writes:

> Thanks, but I don't understand why we need the error message.  Isn't
> it enough to pass nil as 2nd argument to shell-command?

The error message is just for noninteractive cases where a caller passes
a numeric argument as the second argument of `async-shell-command'.  For
interactive cases, a nil value will be always passed to `shell-command'.

Example:
    Before patch:
        (async-shell-command "ls" 1) => error: (wrong-type-argument stringp 1)
    After patch:
        (async-shell-command "ls" 1) => error: (error "Invalid output buffer")

Here is a patch without the error message, in case it's preferable:
>From 60f901126d5c883cc1c1d60a2b2b71ad3524f065 Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <[email-masked]>
Date: Sat, 13 May 2023 20:31:24 -0300
Subject: [PATCH 1/1] Ignore current-prefix-arg in async-shell-command.

* lisp/simple.el (async-shell-command): Ignore current-prefix-arg and
  always pass nil to second argument of `shell-command'.
---
 lisp/simple.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 73c2dfa365d..98278ef2a18 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4499,7 +4499,7 @@ async-shell-command
 				((eq major-mode 'dired-mode)
 				 (dired-get-filename nil t)))))
 			  (and filename (file-relative-name filename))))
-    current-prefix-arg
+    nil
     shell-command-default-error-buffer))
   (unless (string-match "&[ \t]*\\'" command)
     (setq command (concat command " &")))
-- 
2.34.1

---
Gabriel