unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: redirect stdout to emacs scratch
Date: Tue, 09 Dec 2008 04:59:31 +0100	[thread overview]
Message-ID: <1228795237.998087@arno.fh-trier.de> (raw)
In-Reply-To: <mailman.2219.1228741415.26697.help-gnu-emacs@gnu.org>

pagod wrote:
> hi everyone!
> 
> this is probably a very easy question (there has to be a way!), but i
> haven't been able to find the answer, so i'm turning to this forum, hoping
> someone can give me a hint!
> 
> what i want to do is very simple: i want to be able to redirect the stdout
> of any program on the command line into emacs' scratch buffer -- the way it
> works with less or joe or whatever. i want to do it with emacs because i'm
> used to using it and i need syntax coloring, but when i try it i get the
> message "standard input is not a tty". then what is it? the way i've tried
> it is quite the usual way:
> 
> pagod> echo "hello, world" | emacs
> emacs: standard input is not a tty

$ tty
/dev/pts/1

$ ls | tty
not a tty

You could pick up the piped input, put it somewhere and make emacs read
it after the pipe finished and input comes again from the terminal.

alias emacs-with-stdin='cat > /tmp/emacs_stdin ; emacs -nw -Q --eval "(insert-file \"/tmp/emacs_stdin\")"'

This works in bash, I don't know about zsh.

-ap
> 
> my emacs is aliased to "emacs -nw" because i'm in a terminal, so the option
> is assumed by default anyway. i'm using the no-window version of emacs
> because i run it from within an ssh session running zsh on a linux server,
> connecting using putty from a windows workstation. emacs version is 22.2.1,
> running in a SuSE 11.0.
> 
> it'd be great if someone could help me do that!
> 
> thx a lot
> 
> David
> 


       reply	other threads:[~2008-12-09  3:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2219.1228741415.26697.help-gnu-emacs@gnu.org>
2008-12-09  3:59 ` Andreas Politz [this message]
2008-12-18  9:38 ` redirect stdout to emacs scratch harven
     [not found] <mailman.2220.1228741417.26697.help-gnu-emacs@gnu.org>
2008-12-08 15:22 ` Chetan
2008-12-08 15:43   ` Teemu Likonen
2008-12-08 19:30     ` harven
2008-12-08 19:09   ` Chetan
2008-12-08  8:55 pagod

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228795237.998087@arno.fh-trier.de \
    --to=politza@fh-trier.de \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).