help-gnu-emacs
[Top][All Lists]
Advanced

[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: Robert Thorpe
Subject: Re: Redirecting the output of a commend in "shell" into a buffer
Date: Sat, 06 Sep 2014 00:02:40 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]