From: Eli Zaretskii <eliz@gnu.org>
To: Gabriel <gabriel376@hotmail.com>
Cc: 63432@debbugs.gnu.org
Subject: bug#63432: 30.0.50; Handle current-prefix-arg in async-shell-command
Date: Sat, 13 May 2023 16:43:42 +0300 [thread overview]
Message-ID: <83ttwg9wj5.fsf@gnu.org> (raw)
In-Reply-To: <PH8PR19MB70705D7D395D1BA921D7E0298B779@PH8PR19MB7070.namprd19.prod.outlook.com> (message from Gabriel on Wed, 10 May 2023 20:04:24 -0300)
> From: Gabriel <gabriel376@hotmail.com>
> Date: Wed, 10 May 2023 20:04:24 -0300
>
> Steps:
> 1) emacs -Q from master branch (3adc1e7f379)
> 2) C-u M-& "ls"
> Error: shell-command: Wrong type argument: stringp, (4)
>
> Cause:
> When called interactively, `async-shell-command' pass argument
> OUTPUT-BUFFER as `current-prefix-arg' to `shell-command'. As per
> docstring of `shell-command':
>
> "If OUTPUT-BUFFER is not a buffer and not nil (which happens
> interactively when the prefix argument is given), insert the output in
> current buffer after point leaving mark after it. This cannot be done
> asynchronously."
Yes, this bug was there since the day async-shell-command was added to
Emacs.
> diff --git a/lisp/simple.el b/lisp/simple.el
> index 58517dd81f9..ba832581955 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -4499,10 +4499,12 @@ 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 " &")))
> + (when (and output-buffer (numberp output-buffer))
> + (error "Invalid output buffer"))
> (shell-command command output-buffer error-buffer))
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?
next prev parent reply other threads:[~2023-05-13 13:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 23:04 bug#63432: 30.0.50; Handle current-prefix-arg in async-shell-command Gabriel
2023-05-13 13:43 ` Eli Zaretskii [this message]
2023-05-13 23:35 ` Gabriel
2023-05-14 6:28 ` Eli Zaretskii
2023-05-14 7:19 ` Eli Zaretskii
2023-05-15 17:17 ` Juri Linkov
2023-05-15 18:23 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83ttwg9wj5.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=63432@debbugs.gnu.org \
--cc=gabriel376@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.