unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Running emacs lisp programs from command line or script
@ 2003-12-11  1:13 Ryan Newton
  2003-12-11  5:44 ` Eli Zaretskii
  2003-12-11  6:17 ` Tim Heaney
  0 siblings, 2 replies; 4+ messages in thread
From: Ryan Newton @ 2003-12-11  1:13 UTC (permalink / raw)


Hi all,

If I want to make a command line invokable script to, say, convert emacs 
enriched text documents to plain ones, how do I do it?  I want emacs to 
start up, open said document, save it in plain text mode.  Easy to write 
the emacs lisp code, but how do I call it from the command line.  What's 
the "batch" mode for emacs?

--Ryan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running emacs lisp programs from command line or script
  2003-12-11  1:13 Running emacs lisp programs from command line or script Ryan Newton
@ 2003-12-11  5:44 ` Eli Zaretskii
  2003-12-11  6:17 ` Tim Heaney
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2003-12-11  5:44 UTC (permalink / raw)


> From: Ryan Newton <newton@ai.mit.edu>
> Newsgroups: gnu.emacs.help
> Date: Wed, 10 Dec 2003 20:13:42 -0500
> 
> If I want to make a command line invokable script to, say, convert emacs 
> enriched text documents to plain ones, how do I do it?  I want emacs to 
> start up, open said document, save it in plain text mode.  Easy to write 
> the emacs lisp code, but how do I call it from the command line.  What's 
> the "batch" mode for emacs?

"emacs --help" is your friend, of course ;-)

Sounds like you want "emacs -batch -l yourLisp.elc -eval ..."
(replace the Lisp form you want Emacs to evaluate once it loads your
code in yourLisp.elc).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running emacs lisp programs from command line or script
  2003-12-11  1:13 Running emacs lisp programs from command line or script Ryan Newton
  2003-12-11  5:44 ` Eli Zaretskii
@ 2003-12-11  6:17 ` Tim Heaney
  2003-12-11 17:52   ` Kevin Rodgers
  1 sibling, 1 reply; 4+ messages in thread
From: Tim Heaney @ 2003-12-11  6:17 UTC (permalink / raw)


Ryan Newton <newton@ai.mit.edu> writes:
>
> If I want to make a command line invokable script to, say, convert
> emacs enriched text documents to plain ones, how do I do it?  I want
> emacs to start up, open said document, save it in plain text mode.
> Easy to write the emacs lisp code, but how do I call it from the
> command line.  What's the "batch" mode for emacs?

Batch. You can just run something like

  emacs -batch -l elispfile -f function inputfile

from the command line. Or make your Emacs Lisp file executable and try
the sesquicolon

  http://mail.gnu.org/archive/html/bug-gnu-emacs/2002-08/msg00229.html

I hope this helps,

Tim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running emacs lisp programs from command line or script
  2003-12-11  6:17 ` Tim Heaney
@ 2003-12-11 17:52   ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-12-11 17:52 UTC (permalink / raw)


Tim Heaney wrote:

> Ryan Newton <newton@ai.mit.edu> writes:
> 
>>If I want to make a command line invokable script to, say, convert
>>emacs enriched text documents to plain ones, how do I do it?  I want
>>emacs to start up, open said document, save it in plain text mode.
>>Easy to write the emacs lisp code, but how do I call it from the
>>command line.  What's the "batch" mode for emacs?
>>
> 
> Batch. You can just run something like
> 
>   emacs -batch -l elispfile -f function inputfile
> 
> from the command line.


Note that command line action arguments (including files to visit) are
processed in order (see the Command Arguments and Action Arguments nodes
of the Emacs manual), so:

	emacs --batch TEXT_FILE -l ELISP_FILE -f FUNCTION -f save-buffer


-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-11 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-11  1:13 Running emacs lisp programs from command line or script Ryan Newton
2003-12-11  5:44 ` Eli Zaretskii
2003-12-11  6:17 ` Tim Heaney
2003-12-11 17:52   ` Kevin Rodgers

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).