GNU bug report logs - #63432
30.0.50; Handle current-prefix-arg in async-shell-command

Previous Next

Package: emacs;

Reported by: Gabriel <gabriel376 <at> hotmail.com>

Date: Wed, 10 May 2023 23:10:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#63432: closed (30.0.50; Handle current-prefix-arg in
 async-shell-command)
Date: Sun, 14 May 2023 06:29:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 14 May 2023 09:28:34 +0300
with message-id <83h6sfa0kt.fsf <at> gnu.org>
and subject line Re: bug#63432: 30.0.50; Handle current-prefix-arg in async-shell-command
has caused the debbugs.gnu.org bug report #63432,
regarding 30.0.50; Handle current-prefix-arg in async-shell-command
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
63432: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63432
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Handle current-prefix-arg in async-shell-command
Date: Wed, 10 May 2023 20:04:24 -0300
[Message part 3 (text/plain, inline)]
Severity: bug

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."

Patch:
[0001-Handle-current-prefix-arg-in-async-shell-command.patch (text/x-diff, attachment)]
[Message part 5 (text/plain, inline)]
---
Gabriel
[Message part 6 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriel <gabriel376 <at> hotmail.com>
Cc: 63432-done <at> debbugs.gnu.org
Subject: Re: bug#63432: 30.0.50;
 Handle current-prefix-arg in async-shell-command
Date: Sun, 14 May 2023 09:28:34 +0300
> From: Gabriel <gabriel376 <at> hotmail.com>
> Date: Sat, 13 May 2023 20:35:51 -0300
> 
> Eli Zaretskii <eliz <at> gnu.org> 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'.

I think the error signaled by shell-command is sufficient in the
non-interactive case.  We don't usually try detecting
wrong-type-argument errors in non-interactive use, we leave it to the
underlying primitives to detect and report.

> 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")

I see nothing wrong with the "before" version, it gives an accurate
description of the problem for that case.

> Here is a patch without the error message, in case it's preferable:

Thanks, installed on the emacs-29 branch, and closing the bug.


This bug report was last modified 2 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.