From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: Can I use Emacs as pipe-thru formatter?
Date: Tue, 05 Aug 2003 18:21:28 +0200 [thread overview]
Message-ID: <871xw0848n.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: yEPXa.3$Mg5.2@news.level3.com
Barry Margolin <barry.margolin@level3.com> writes:
> Emacs doesn't read and write stdin/stdout, so it can't be used as a filter
> in a pipeline.
Well, indeed you can not get a buffer from stdin (AFAICS). But you do
have some limited options. `print' for example prints to stdout in
batch-mode and `read' reads from stdin.
emacs -q --batch --eval '(print "hello")'
emacs -q --batch --eval '(princ (progn (insert initial-scratch-message) (buffer-substring (point-min) (point-max))))'
echo "\"lirum larum\"" | emacs -q --batch --eval '(message (read))'
Of course also:
echo '(print "Hello")' | emacs -q --batch --eval '(eval (read))'
There is even some interactivity possible:
emacs -q --batch --eval '(progn (find-file "~/.emacs") (if (y-or-n-p "Shall I print your .emacs? ") (print (buffer-substring (point-min) (point-max))) (print "O.k. Bye.")))'
Oliver
--
18 Thermidor an 211 de la Révolution
Liberté, Egalité, Fraternité!
next prev parent reply other threads:[~2003-08-05 16:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-05 14:18 Can I use Emacs as pipe-thru formatter? Irving Kimura
2003-08-05 15:00 ` Barry Margolin
2003-08-05 16:21 ` Oliver Scholz [this message]
2003-08-05 15:32 ` Kevin Rodgers
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=871xw0848n.fsf@ID-87814.user.dfncis.de \
--to=alkibiades@gmx.de \
/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).