From owner-freebsd-questions Mon Feb 21 11:58:38 2000 Delivered-To: freebsd-questions@freebsd.org Received: from typhoon.mail.pipex.net (typhoon.mail.pipex.net [158.43.128.27]) by hub.freebsd.org (Postfix) with SMTP id E427F37B50C for ; Mon, 21 Feb 2000 11:58:29 -0800 (PST) (envelope-from mark@dogma.freebsd-uk.eu.org) Received: (qmail 1608 invoked from network); 21 Feb 2000 19:58:27 -0000 Received: from userca03.uk.uudial.com (HELO marder-1.) (62.188.150.71) by smtp.dial.pipex.com with SMTP; 21 Feb 2000 19:58:27 -0000 Received: (from mark@localhost) by marder-1. (8.9.3/8.9.3) id SAA01202; Mon, 21 Feb 2000 18:28:16 GMT (envelope-from mark) Date: Mon, 21 Feb 2000 18:28:16 +0000 From: Mark Ovens To: Lowell Gilbert Cc: mark.ovens@uk.radan.com, freebsd-questions@freebsd.org Subject: Re: Running shell commands in Emacs Message-ID: <20000221182816.D326@marder-1> References: <38B120A2.7E104808@uk.radan.com> <38B15713.F501C93B@uk.radan.com> <200002211546.KAA08401@world.std.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: <200002211546.KAA08401@world.std.com> Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Feb 21, 2000 at 10:46:06AM -0500, Lowell Gilbert wrote: > Date: Mon, 21 Feb 2000 15:17:39 +0000 > From: Mark Ovens > > Lowell Gilbert wrote: > > > > Mark Ovens writes: > > > > > Is it possible to run a shell command from within emacs and have the > > > output written to the current buffer at the cursor position, as the ex > > > command ``r!'' in vi?, which is useful for adding the output of ``uname > > > -a'' or ``dmesg'' into an e-mail, for instance. > > > > > > I know there is ``shell-command'' but that writes the output to a new > > > buffer (*Shell Command Output*) so you then have to cut 'n' paste. > > > > If you specify the (optional) second parameter to shell-command, the > > output will be inserted in the current buffer. "C-u shell-command" > > Where do I type that? You need to run "M-x shell-command", then enter the > command at the "Shell command: " prompt. I didn't think it was possible to > enter the second parameter when running interactively. > > Oops. Typo on my part -- "C-u M-x shell-command" will work. Sorry > about that. > Ah right, thanks. I've also found that ``M-x shell-command'' is bound to M-!, so ``C-u M-!'' does the trick. > And, of course, as you correctly imply, writing a wrapper function for > shell-command to do this by default is a pretty simple matter (it > would be trivial, except for the interactive behaviour of prompting > for the command). > > Another approach I've used, when I didn't necessarily want all of the > command's output, is to use a keyboard macro to go to the shell output > buffer, kill some of the output from there, switch back to the > original buffer, and yank it into the spot where I wanted it. > I haven't worked my way up to keyboard macros yet :) Thanks for the help. > - Lowell > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Microsoft: Where do you want to go today? Linux: Where do you want to go tomorrow? BSD: Are you guys coming, or what? -Poster at LinuxWorld 2000 ________________________________________________________________ FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://ukug.uk.freebsd.org/~mark/ mailto:mark@ukug.uk.freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message