all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: C K Kashyap <ckkashyap@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Redirecting the output of a commend in "shell" into a buffer
Date: Sat, 06 Sep 2014 00:02:40 +0100	[thread overview]
Message-ID: <87fvg58ycv.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <CAGdT1gqU+DEJpny9=qnjY9oaUEGDMcVWo8ymSxeG1p-u61QobA@mail.gmail.com> (message from C K Kashyap on Wed, 3 Sep 2014 14:10:58 +0530)

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



  parent reply	other threads:[~2014-09-05 23:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03  8:40 Redirecting the output of a commend in "shell" into a buffer C K Kashyap
2014-09-03 20:22 ` Memnon Anon
     [not found] ` <mailman.8221.1409775768.1147.help-gnu-emacs@gnu.org>
2014-09-04  1:59   ` Rusi
2014-09-04  4:13     ` C K Kashyap
     [not found]     ` <mailman.8237.1409804019.1147.help-gnu-emacs@gnu.org>
2014-09-04 18:48       ` Emanuel Berg
2014-09-05 23:02 ` Robert Thorpe [this message]
2014-09-06  8:21   ` C K Kashyap
     [not found] <mailman.8181.1409733682.1147.help-gnu-emacs@gnu.org>
2014-09-03 16:35 ` Emanuel Berg
2014-09-03 17:49 ` Emanuel Berg

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=87fvg58ycv.fsf@robertthorpeconsulting.com \
    --to=rt@robertthorpeconsulting.com \
    --cc=ckkashyap@gmail.com \
    --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.