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

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

Can I use Emacs as pipe-thru formatter?


From: Irving Kimura
Subject: Can I use Emacs as pipe-thru formatter?
Date: Tue, 5 Aug 2003 14:18:37 +0000 (UTC)
User-agent: nn/6.6.5


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



reply via email to

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