From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Irving Kimura Newsgroups: gmane.emacs.help Subject: Can I use Emacs as pipe-thru formatter? Date: Tue, 5 Aug 2003 14:18:37 +0000 (UTC) Organization: (NONE) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org X-Trace: main.gmane.org 1060093921 17178 80.91.224.253 (5 Aug 2003 14:32:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2003 14:32:01 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 05 16:32:20 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 19k2rM-00026s-00 for ; Tue, 05 Aug 2003 16:32:20 +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 19k2pj-0003Bm-7Y for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Aug 2003 10:30:39 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!panix!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-NNTP-Posting-Host: panix3.panix.com Original-X-Trace: reader1.panix.com 1060093117 16864 166.84.1.3 (5 Aug 2003 14:18:37 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Tue, 5 Aug 2003 14:18:37 +0000 (UTC) X-No-Confirm: yes User-Agent: nn/6.6.5 Original-Xref: shelby.stanford.edu gnu.emacs.help:115685 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:11603 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11603 I'm writing a Perl script that, among other things, needs to pretty print JavaScript code. The formatting produced by the Emacs module javascript-mode.el would be adequate for my purposes, but I don't know how to apply it from within a Perl program. (I'm sure that this is trivial to do from within an Emacs Lisp script, but I am not very handy in this language, and besides, the task is part of a much larger Perl program, so I would prefer to do this from within Perl.) Since, under Unix at least, it's not too difficult for a Perl script to pipe a string through an external program, one possible way to do what I want to do would be to write an "Emacs pipe" that somehow uses javascript-mode.el to pretty print its stdin and spits the results to stdout: % cat ugly.js | emacs_js_pretty_printer > pretty.js But I have no idea about how to write such a pipe. I would greatly appreciate any help or advice on how to do this, or any other ideas on how to tackle this problem. Many thanks! -Irv