bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dired-do-shell-command blocks C-z suspension, switching buffers


From: Kevin Rodgers
Subject: Re: dired-do-shell-command blocks C-z suspension, switching buffers
Date: Wed, 24 Dec 2003 10:36:25 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]