Date: Mon, 21 Feb 2000 18:28:16 +0000 From: Mark Ovens <mark@ukug.uk.freebsd.org> To: Lowell Gilbert <lowell@world.std.com> Cc: mark.ovens@uk.radan.com, freebsd-questions@freebsd.org Subject: Re: Running shell commands in Emacs Message-ID: <20000221182816.D326@marder-1> In-Reply-To: <200002211546.KAA08401@world.std.com> References: <38B120A2.7E104808@uk.radan.com> <rd63dqmk3sw.fsf@world.std.com> <38B15713.F501C93B@uk.radan.com> <200002211546.KAA08401@world.std.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <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.
>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000221182816.D326>
