From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: Can I use Emacs as pipe-thru formatter? Date: Tue, 05 Aug 2003 18:21:28 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <871xw0848n.fsf@ID-87814.user.dfncis.de> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1060101144 2745 80.91.224.253 (5 Aug 2003 16:32:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2003 16:32:24 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 05 18:32:43 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19k4jr-0000To-00 for ; Tue, 05 Aug 2003 18:32:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19k4i4-0002QW-57 for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Aug 2003 12:30:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.telebyte.nl!npeer.de.kpn-eurorings.net!fu-berlin.de!uni-berlin.de!dialin-145-254-194-171.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-NNTP-Posting-Host: dialin-145-254-194-171.arcor-ip.net (145.254.194.171) Original-X-Trace: news.uni-berlin.de 1060100649 28297408 145.254.194.171 (16 [87814]) X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:fVGvC+ctZPpG7r1Ateq4QLfVrcw= Original-Xref: shelby.stanford.edu gnu.emacs.help:115690 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11606 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11606 Barry Margolin 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é!