all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Piping output to a buffer
@ 2008-02-25  0:30 cothrige
  2008-02-25  6:35 ` Barry Margolin
  0 siblings, 1 reply; 6+ messages in thread
From: cothrige @ 2008-02-25  0:30 UTC (permalink / raw)
  To: help-gnu-emacs


I have noticed that in vim one can invoke an external command and pipe
the output into the current buffer via the `!!` or `:r!` commands.
While I have not made a habit of really using this command in vim, as I
have also not made a habit of using vim, I did realize that this could
be a really useful capability.  So, how might one do this in emacs?

Patrick


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Piping output to a buffer
  2008-02-25  0:30 Piping output to a buffer cothrige
@ 2008-02-25  6:35 ` Barry Margolin
  2008-02-25  6:56   ` David Kastrup
  2008-02-26  5:25   ` cothrige
  0 siblings, 2 replies; 6+ messages in thread
From: Barry Margolin @ 2008-02-25  6:35 UTC (permalink / raw)
  To: help-gnu-emacs

In article <877igtho8a.fsf@celephais.home.net>,
 cothrige <cothrige@yahoo.com> wrote:

> I have noticed that in vim one can invoke an external command and pipe
> the output into the current buffer via the `!!` or `:r!` commands.
> While I have not made a habit of really using this command in vim, as I
> have also not made a habit of using vim, I did realize that this could
> be a really useful capability.  So, how might one do this in emacs?

C-u M-!

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Piping output to a buffer
  2008-02-25  6:35 ` Barry Margolin
@ 2008-02-25  6:56   ` David Kastrup
  2008-02-26  3:11     ` Barry Margolin
  2008-02-26  5:56     ` cothrige
  2008-02-26  5:25   ` cothrige
  1 sibling, 2 replies; 6+ messages in thread
From: David Kastrup @ 2008-02-25  6:56 UTC (permalink / raw)
  To: help-gnu-emacs

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <877igtho8a.fsf@celephais.home.net>,
>  cothrige <cothrige@yahoo.com> wrote:
>
>> I have noticed that in vim one can invoke an external command and pipe
>> the output into the current buffer via the `!!` or `:r!` commands.
>> While I have not made a habit of really using this command in vim, as I
>> have also not made a habit of using vim, I did realize that this could
>> be a really useful capability.  So, how might one do this in emacs?
>
> C-u M-!

!! pipes the current line through the external command.  The Emacs
equivalent to that would be marking the line and then using

C-u M-|

I consider it more likely that your variant will be needed, however:
more often than not, !! eating the current line is a nuisance rather
than a benefit in vi.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Piping output to a buffer
  2008-02-25  6:56   ` David Kastrup
@ 2008-02-26  3:11     ` Barry Margolin
  2008-02-26  5:56     ` cothrige
  1 sibling, 0 replies; 6+ messages in thread
From: Barry Margolin @ 2008-02-26  3:11 UTC (permalink / raw)
  To: help-gnu-emacs

In article <853arhy156.fsf@lola.goethe.zz>, David Kastrup <dak@gnu.org> 
wrote:

> Barry Margolin <barmar@alum.mit.edu> writes:
> 
> > In article <877igtho8a.fsf@celephais.home.net>,
> >  cothrige <cothrige@yahoo.com> wrote:
> >
> >> I have noticed that in vim one can invoke an external command and pipe
> >> the output into the current buffer via the `!!` or `:r!` commands.
> >> While I have not made a habit of really using this command in vim, as I
> >> have also not made a habit of using vim, I did realize that this could
> >> be a really useful capability.  So, how might one do this in emacs?
> >
> > C-u M-!
> 
> !! pipes the current line through the external command.  The Emacs
> equivalent to that would be marking the line and then using
> 
> C-u M-|
> 
> I consider it more likely that your variant will be needed, however:
> more often than not, !! eating the current line is a nuisance rather
> than a benefit in vi.

Actually, I tend to use C-u M-| more often than C-u M-!.  For instance, 
when I want to reformat a file in the current buffer using awk, I use 
C-u M-|.  Had I realized that the vi commands the OP was talking about 
piped the buffer contents into the command, I would have mentioned M-| 
in my response.

I use M-! frequently as well, but I hardly ever insert the output into 
the buffer.  I usually use it just to run quick commands without 
switching to and cluttering up my shell buffer.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Piping output to a buffer
  2008-02-25  6:35 ` Barry Margolin
  2008-02-25  6:56   ` David Kastrup
@ 2008-02-26  5:25   ` cothrige
  1 sibling, 0 replies; 6+ messages in thread
From: cothrige @ 2008-02-26  5:25 UTC (permalink / raw)
  To: help-gnu-emacs

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <877igtho8a.fsf@celephais.home.net>,
>  cothrige <cothrige@yahoo.com> wrote:
>
>> I have noticed that in vim one can invoke an external command and pipe
>> the output into the current buffer via the `!!` or `:r!` commands.
>> While I have not made a habit of really using this command in vim, as I
>> have also not made a habit of using vim, I did realize that this could
>> be a really useful capability.  So, how might one do this in emacs?
>
> C-u M-!

Yep, that did it alright.  I had assumed that emacs could do it, just
wondered how.  I do believe that will be a convenient and useful trick
to know.  I thank you for filling me in on it.

Many thanks,

Patrick


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Piping output to a buffer
  2008-02-25  6:56   ` David Kastrup
  2008-02-26  3:11     ` Barry Margolin
@ 2008-02-26  5:56     ` cothrige
  1 sibling, 0 replies; 6+ messages in thread
From: cothrige @ 2008-02-26  5:56 UTC (permalink / raw)
  To: help-gnu-emacs

David Kastrup <dak@gnu.org> writes:

> !! pipes the current line through the external command.  The Emacs
> equivalent to that would be marking the line and then using
>
> C-u M-|

Okay, I have to admit that I was totally ignorant that `!!` actually did
that.  That could really be very useful indeed, though maybe a tad
esoteric for the likes of me.  Thanks very much for pointing this out
for me, and of course for sharing how it can be done in emacs.

Patrick


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-26  5:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-25  0:30 Piping output to a buffer cothrige
2008-02-25  6:35 ` Barry Margolin
2008-02-25  6:56   ` David Kastrup
2008-02-26  3:11     ` Barry Margolin
2008-02-26  5:56     ` cothrige
2008-02-26  5:25   ` cothrige

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.