all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: dired-do-shell-command blocks C-z suspension, switching buffers
Date: Wed, 24 Dec 2003 10:36:25 -0700	[thread overview]
Message-ID: <3FE9CE99.9060700@yahoo.com> (raw)
In-Reply-To: mailman.552.1072236993.868.bug-gnu-emacs@gnu.org

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

  parent reply	other threads:[~2003-12-24 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [not found] <mailman.228.1071707727.868.bug-gnu-emacs@gnu.org>
2003-12-18 16:48 ` Kevin Rodgers

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=3FE9CE99.9060700@yahoo.com \
    --to=ihs_4664@yahoo.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.