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

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

Re: auto indent csript


From: Kai Großjohann
Subject: Re: auto indent csript
Date: Thu, 12 Jul 2001 18:02:03 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.104

On Thu, 12 Jul 2001, Noel L. Yap wrote:

> I'm trying to write some lisp meant to be used in batch mode that'll
> indent the file.
> 
> My lisp looks like:
> (indent-region (point-min) (point-max) 1)
> (save-buffer)
> 
> The output I get is:
> psdev.jpmpsdev@jpmpshome:~/proj/aoeu> emacs --batch -l aoeu.el Aoeu.java
> (No changes need to be saved)

Maybe it's easiest to put the right find-file command in aoeu.el:

(find-file "Aoeu.java")
(indent-region (point-min) (point-max) 1)
(save-buffer)

And then do like this:

emacs --batch -l aoeu.el

Another possibility is to put a function in aoeu.el:

(defun foo ()
  (indent-region (point-min) (point-max) 1)
  (save-buffer))

And then run Emacs and call the function:

emacs --batch -l aoeu.el Aoeu.java -f foo

But for batch indentation, maybe it's best to use GNU indent, a
program intended for batch indentation.

kai
-- 
~/.signature: No such file or directory



reply via email to

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