[Top][All Lists]

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

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

From: Kevin Rodgers
Subject: Re: Can I use Emacs as pipe-thru formatter?
Date: Tue, 05 Aug 2003 09:32:26 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv: Gecko/20020406 Netscape6/6.2.2

Irving Kimura wrote:

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

Try this:

emacs --batch \
        ugly.js \
        -f javascript-mode \
        --eval '(indent-region (point-min) (point-max) nil)' \
        --eval '(write-file "pretty.js")'

Kevin Rodgers

reply via email to

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