unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* dired-do-shell-command blocks C-z suspension, switching buffers
@ 2003-12-17 16:35 Dan Jacobson
       [not found] ` <E1AYHMN-0005KE-1e@fencepost.gnu.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Jacobson @ 2003-12-17 16:35 UTC (permalink / raw)


! runs the command dired-do-shell-command
   which is an interactive compiled Lisp function in `dired-aux'.

However, trying either
$ emacs -q --no-site-file /tmp
$ emacs -q --no-site-file -nw /tmp
and then
SPC ! s l e e p SPC 4 4 4 4 SPC # <return>
makes a state where one's C-z attempts at suspension are ignored.

I was thinking it could continue to do its thing on its own, if we
suspend emacs or not, and at least let us switch buffers, but no, all
must wait.  Same with ! s l e e p SPC 6 6 & l s

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dired-do-shell-command blocks C-z suspension, switching buffers
       [not found] <mailman.228.1071707727.868.bug-gnu-emacs@gnu.org>
@ 2003-12-18 16:48 ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-12-18 16:48 UTC (permalink / raw)


Dan Jacobson wrote:

> ! runs the command dired-do-shell-command
>    which is an interactive compiled Lisp function in `dired-aux'.
> 
> However, trying either
> $ emacs -q --no-site-file /tmp
> $ emacs -q --no-site-file -nw /tmp
> and then
> SPC ! s l e e p SPC 4 4 4 4 SPC # <return>
> makes a state where one's C-z attempts at suspension are ignored.


`C-z' is bound to 2 different commands, depending on the -nw option:

C-z runs the command iconify-or-deiconify-frame
C-z runs the command suspend-emacs

So running under a window system, you could not expect `C-z' to suspend emacs.


In both cases, `C-g' will interrupt the shell command.


> I was thinking it could continue to do its thing on its own, if we
> suspend emacs or not, and at least let us switch buffers, but no, all
> must wait.  Same with ! s l e e p SPC 6 6 & l s

Just use `M-!' instead of `!', and terminate your command with "&" to run it

in the background so you can continue to use emacs (including `C-z') any way
you wish.


-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dired-do-shell-command blocks C-z suspension, switching buffers
       [not found] ` <E1AYHMN-0005KE-1e@fencepost.gnu.org>
@ 2003-12-23 18:46   ` Dan Jacobson
       [not found]   ` <mailman.552.1072236993.868.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Jacobson @ 2003-12-23 18:46 UTC (permalink / raw)


RMS> This command is defined to wait for the shell command to finish.
RMS> You can interrupt it by typing C-g.

Well, we are sort of thrown back to the age of MSDOS single tasking
systems, when we cannot pop in and out of emacs with a ^Z (-nw or
not), without affecting subjobs... and I don't see what is gained this
way, other than code simplicity perhaps.

Hmm, plain old ESC ! (shell-command) acts that way too.

Anyway, let's examine what we might do when the user types
ESC ! sleep 111 RET C-z
1. nothing, not even a message. (current behavior)
2. suspension, just as if when the user had typed sleep 111&
3. suspension, even suspending the sleep job

Anyway, at least there could be some message printed for [1],
especially since you aren't saving our C-z intending to send it to the
stdin of our subjob.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: dired-do-shell-command blocks C-z suspension, switching buffers
       [not found]   ` <mailman.552.1072236993.868.bug-gnu-emacs@gnu.org>
@ 2003-12-24 17:36     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-12-24 17:36 UTC (permalink / raw)


Dan Jacobson wrote:

> RMS> This command is defined to wait for the shell command to finish.
> RMS> You can interrupt it by typing C-g.
> 
> Well, we are sort of thrown back to the age of MSDOS single tasking
> systems, when we cannot pop in and out of emacs with a ^Z (-nw or
> not), without affecting subjobs... and I don't see what is gained this
> way, other than code simplicity perhaps.
> 
> Hmm, plain old ESC ! (shell-command) acts that way too.
> 
> Anyway, let's examine what we might do when the user types
> ESC ! sleep 111 RET C-z
> 1. nothing, not even a message. (current behavior)
> 2. suspension, just as if when the user had typed sleep 111&
> 3. suspension, even suspending the sleep job
> 
> Anyway, at least there could be some message printed for [1],
> especially since you aren't saving our C-z intending to send it to the
> stdin of our subjob.

shell-command is used to run a command synchronously (unless it ends
with "&"), with standard input effectively bound to null-device.  You
can see that by running `ESC ! cat RET', which returns immediately with
the message "(Shell command succeeded with no output)" instead of
waiting for EOF.

If you want the command to read its standard input from the minibuffer,
I'm sure a patch would be welcome.  Even then, the command would still
be run synchronously.  However, it ought to be possible to stop and then
resume an asynchronous command:

(defun stop-async-shell-command ()
  "Stop executing the current asynchronous shell command."
  (interactive)
  (stop-process (get-buffer-process
		 (or (get-buffer "*Async Shell Command*")
		     (error "No asynchronous shell command is running")))))

(defun continue-async-shell-command ()
  "Resume executing the current asynchronous shell command."
  (interactive)
  (continue-process (get-buffer-process
		     (or (get-buffer "*Async Shell Command*")
			 (error "No asynchronous shell command is running")))))

;; (global-set-key "\C-c\C-z" 'stop-async-shell-command)
;; (global-set-key "\C-c\C-a" 'continue-async-shell-command)


-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-24 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-17 16:35 dired-do-shell-command blocks C-z suspension, switching buffers Dan Jacobson
     [not found] ` <E1AYHMN-0005KE-1e@fencepost.gnu.org>
2003-12-23 18:46   ` Dan Jacobson
     [not found]   ` <mailman.552.1072236993.868.bug-gnu-emacs@gnu.org>
2003-12-24 17:36     ` Kevin Rodgers
     [not found] <mailman.228.1071707727.868.bug-gnu-emacs@gnu.org>
2003-12-18 16:48 ` Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).