unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Barry Margolin <barry.margolin@level3.com>
Subject: Re: Can I use Emacs as pipe-thru formatter?
Date: Tue, 05 Aug 2003 15:00:46 GMT	[thread overview]
Message-ID: <yEPXa.3$Mg5.2@news.level3.com> (raw)
In-Reply-To: bgoebt$gf0$1@reader1.panix.com

In article <bgoebt$gf0$1@reader1.panix.com>,
Irving Kimura  <irving_kimura@lycos.com> 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
>
>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.

Someone asked almost the same question a week or two ago.

Emacs doesn't read and write stdin/stdout, so it can't be used as a filter
in a pipeline.  But you can use -batch and -eval to make it run a function
and then exit, so you could have it read ugly.js into a buffer, format it,
and then write the result out to pretty.js.

-- 
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

  reply	other threads:[~2003-08-05 15:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-05 14:18 Can I use Emacs as pipe-thru formatter? Irving Kimura
2003-08-05 15:00 ` Barry Margolin [this message]
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='yEPXa.3$Mg5.2@news.level3.com' \
    --to=barry.margolin@level3.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).