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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I use Emacs as pipe-thru formatter?


From: Oliver Scholz
Subject: Re: Can I use Emacs as pipe-thru formatter?
Date: Tue, 05 Aug 2003 18:21:28 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

Barry Margolin <address@hidden> 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é!


reply via email to

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