all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Piping output to a buffer
Date: Mon, 25 Feb 2008 22:11:20 -0500	[thread overview]
Message-ID: <barmar-78F60A.22112025022008@comcast.dca.giganews.com> (raw)
In-Reply-To: 853arhy156.fsf@lola.goethe.zz

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 ***


  reply	other threads:[~2008-02-26  3:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-02-26  5:56     ` cothrige
2008-02-26  5:25   ` cothrige

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=barmar-78F60A.22112025022008@comcast.dca.giganews.com \
    --to=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@gnu.org \
    /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.