Eshell redirection

Mike Mattie has this awesome Emacs tip for
Eshell: redirecting to buffers and Lisp symbols!

To overwrite buffer “foo”:

ls > #<buffer foo>

To append to buffer “foo”:

ls >> #<buffer foo>

To insert at point in buffer “foo”:

ls >>> #<buffer foo>

To redirect to a Lisp symbol:

ls >#'some-variable

I had no idea Emacs could do that. Cool!

On Technorati: ,

E-Mail from Mike Mattie

Random Emacs symbol: ps-extend-face-list – Function: Extend face in ALIST-SYM.

Thanks to David Ongaro for catching that!

5 responses to “Eshell redirection”

  1. David Ongaro says:

    Nice. But probably the main points got lost in the various (?) migrations of your block. It should probably read like this:

    To overwrite buffer “foo”:
    ls > #

    To append to buffer “foo”:
    ls >> #

    To insert at point in buffer “foo”:
    ls >>> #

    1. Sacha Chua says:

      Thanks for catching that! =)

  2. David Ongaro says:

    I see, I have to escape the > and < myself X-)

    To overwrite buffer “foo”:
    ls > #<buffer foo>

    To append to buffer “foo”:
    ls >> #<buffer foo>

    To insert at point in buffer “foo”:
    ls >>> #<buffer foo>

  3. palacechan says:

    Why does something like this generate a redirection error though?

    for i in 13 288 3 {echo “$i ” | wc -c } > #

    Invalid redirection target: (#)
    Invalid redirection target: (#)
    Invalid redirection target: (#)

    1. Sacha Chua says:

      Did you specify the buffer, like this? #<buffer whatever>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>