[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Redirecting the output of a commend in "shell" into a buffer
From: |
C K Kashyap |
Subject: |
Re: Redirecting the output of a commend in "shell" into a buffer |
Date: |
Sat, 6 Sep 2014 13:51:01 +0530 |
Robert - I love emacs more ... I am looking into how to
use comint-output-filter-functions - I have not figured it out yet but it
looks awesome!
Regards,
Kashyap
On Sat, Sep 6, 2014 at 4:32 AM, Robert Thorpe <rt@robertthorpeconsulting.com
> wrote:
> C K Kashyap <ckkashyap@gmail.com> writes:
>
> > Hi,
> > While using shell, is it possible to redirect output of commands into a
> > buffer?
> > Ofcourse, the shell buffer itself is editable and all but it would be
> nice
> > if I could directly pipe the output of a command into a new buffer.
>
> Emanuel gave one solution, here's another.
>
> There's a hook called "comint-filter-functions" and a command called
> "comint-send-input". Together these control what gets sent to the
> external process in things like shell buffers.
>
> You could modify these or advice them. Or you could rebind RET. For
> example, suppose you create a new "pseudo-command" called "buf". You
> write: "buf ls RET" in the shell buffer. Your function finds the "buf"
> at the beginning of the command string. It then cuts out the rest and
> sends it to shell-command which puts it in a separate buffer. If it
> doesn't find "buf" at the start then it calls comint-send-input as
> usual.
>
> I've thought about doing this myself but I've never got around to it.
>
> BR,
> Robert Thorpe
>