GNU bug report logs - #18096
24.3.92; async shell command and a busy buffer leads to error

Previous Next

Package: emacs;

Reported by: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>

Date: Thu, 24 Jul 2014 12:12:02 UTC

Severity: normal

Found in version 24.3.92

Fixed in version 24.5.50

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18096 in the body.
You can then email your comments to 18096 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18096; Package emacs. (Thu, 24 Jul 2014 12:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Richard <theonewiththeevillook <at> yahoo.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Jul 2014 12:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.92; async shell command and a busy buffer leads to error
Date: Thu, 24 Jul 2014 14:13:06 +0200
Running the following and answering "yes" to the prompt leads to an error:

(let ((b (get-buffer-create "Some command")))
  (shell-command "sleep 1 &" b)
  (shell-command ":&" b))

Debugger entered--Lisp error: (wrong-type-argument stringp #<buffer Some command>)
  generate-new-buffer-name(#<buffer Some command>)
  generate-new-buffer(#<buffer Some command>)
  (setq buffer (generate-new-buffer (or output-buffer "*Async Shell Command*")))
  [hand-edited]
  shell-command(":&" #<buffer Some command>)

I suggest the following in order to have a better error message :

--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2904,7 +2904,8 @@ the use of a shell (with its need to quote arguments)."
 		      (error "Shell command in progress")))
 		   ((eq async-shell-command-buffer 'confirm-new-buffer)
 		    ;; If will create a new buffer, query first.
-		    (if (yes-or-no-p "A command is running in the default buffer.  Use a new buffer? ")
+		    (if (and (stringp output-buffer)
+                             (yes-or-no-p "A command is running in the default buffer.  Use a new buffer? "))
 			(setq buffer (generate-new-buffer
 				      (or output-buffer "*Async Shell Command*")))
 		      (error "Shell command in progress")))

-- 
Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18096; Package emacs. (Mon, 28 Jul 2014 00:00:06 GMT) Full text and rfc822 format available.

Message #8 received at 18096 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 18096 <at> debbugs.gnu.org
Subject: Re: bug#18096: 24.3.92;
 async shell command and a busy buffer leads to error
Date: Mon, 28 Jul 2014 02:53:00 +0300
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -2904,7 +2904,8 @@ the use of a shell (with its need to quote arguments)."
>  		      (error "Shell command in progress")))
>  		   ((eq async-shell-command-buffer 'confirm-new-buffer)
>  		    ;; If will create a new buffer, query first.
> -		    (if (yes-or-no-p "A command is running in the default buffer.  Use a new buffer? ")
> +		    (if (and (stringp output-buffer)
> +                             (yes-or-no-p "A command is running in the default buffer.  Use a new buffer? "))
>  			(setq buffer (generate-new-buffer
>  				      (or output-buffer "*Async Shell Command*")))
>  		      (error "Shell command in progress")))

This will ignore the user customization in `async-shell-command-buffer'
if the user want it to ask a question whether to create a new buffer.
More tolerating would be trying to get a new buffer name even when
the given argument is a buffer:

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2014-07-08 08:27:45 +0000
+++ lisp/simple.el	2014-07-27 23:44:20 +0000
@@ -2986,12 +2986,14 @@ (defun shell-command (command &optional
 		    ;; If will create a new buffer, query first.
 		    (if (yes-or-no-p "A command is running in the default buffer.  Use a new buffer? ")
 			(setq buffer (generate-new-buffer
-				      (or output-buffer "*Async Shell Command*")))
+				      (or (and (bufferp output-buffer) (buffer-name output-buffer))
+					  output-buffer "*Async Shell Command*")))
 		      (error "Shell command in progress")))
 		   ((eq async-shell-command-buffer 'new-buffer)
 		    ;; It will create a new buffer.
 		    (setq buffer (generate-new-buffer
-				  (or output-buffer "*Async Shell Command*"))))
+				  (or (and (bufferp output-buffer) (buffer-name output-buffer))
+				      output-buffer "*Async Shell Command*"))))
 		   ((eq async-shell-command-buffer 'confirm-rename-buffer)
 		    ;; If will rename the buffer, query first.
 		    (if (yes-or-no-p "A command is running in the default buffer.  Rename it? ")






bug marked as fixed in version 24.5.50, send any further explanations to 18096 <at> debbugs.gnu.org and Nicolas Richard <theonewiththeevillook <at> yahoo.fr> Request was from Juri Linkov <juri <at> jurta.org> to control <at> debbugs.gnu.org. (Sat, 08 Nov 2014 23:54:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18096; Package emacs. (Sun, 09 Nov 2014 07:01:01 GMT) Full text and rfc822 format available.

Message #13 received at 18096 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Juri Linkov <juri <at> jurta.org>
Cc: "18096 <at> debbugs.gnu.org" <18096 <at> debbugs.gnu.org>
Subject: Re: bug#18096: 24.3.92;
 async shell command and a busy buffer leads to error
Date: Sun, 9 Nov 2014 06:57:33 +0000
[Message part 1 (text/plain, inline)]
Hi Juri,

Sorry I realize I had forgotten to answer you.
Thanks for solving it.


Nicolas.
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Dec 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 194 days ago.

Previous Next


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