Date: Mon, 21 Feb 2000 10:46:06 -0500 (EST) From: Lowell Gilbert <lowell@world.std.com> To: mark.ovens@uk.radan.com, freebsd-questions@freebsd.org Subject: Re: Running shell commands in Emacs Message-ID: <200002211546.KAA08401@world.std.com> In-Reply-To: <38B15713.F501C93B@uk.radan.com> (message from Mark Ovens on Mon, 21 Feb 2000 15:17:39 %2B0000) References: <38B120A2.7E104808@uk.radan.com> <rd63dqmk3sw.fsf@world.std.com> <38B15713.F501C93B@uk.radan.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Date: Mon, 21 Feb 2000 15:17:39 +0000 From: Mark Ovens <mark.ovens@uk.radan.com> Lowell Gilbert wrote: > > Mark Ovens <mark.ovens@uk.radan.com> 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. 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. - Lowell To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002211546.KAA08401>