unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Irving Kimura <irving_kimura@lycos.com>
Subject: Can I use Emacs as pipe-thru formatter?
Date: Tue, 5 Aug 2003 14:18:37 +0000 (UTC)	[thread overview]
Message-ID: <bgoebt$gf0$1@reader1.panix.com> (raw)



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	other threads:[~2003-08-05 14:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-05 14:18 Irving Kimura [this message]
2003-08-05 15:00 ` Can I use Emacs as pipe-thru formatter? Barry Margolin
2003-08-05 16:21   ` Oliver Scholz
2003-08-05 15:32 ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='bgoebt$gf0$1@reader1.panix.com' \
    --to=irving_kimura@lycos.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).