Brian Jones wrote:
> 
> If no one else does, Paul can probably write a lisp reformatter which
> works within emacs in batch mode to automatically reformat
> everything.


You can let emacs reformat files automatically with the attached
emacs lisp.

Put the attached code in your .emacs file, run something like
'emacs *.java' or 'emacs `find . -name "*.java"`', go have a beer
or 6, then come back and close emacs.  Then remove the previously
added code from your .emacs file.


We used this to change our code from 4 to 8 space indentation, and
to remove all tab-characters from the indentation (e.g. spaces only)

JW

-- 
// John Watson
// Software Engineer         --        STScI Archive Team

-------------------------------------
;; don't make the *~ backups
(setq-default make-backup-files nil)

;; don't let emacs use tabs for indentation
(setq-default indent-tabs-mode nil)

;;
;; the function which re-indents a whole buffer
;;

(defun update-indent-region ()
  (let ()
    (setq c-basic-offset 8)
;; zero out the indentation to remove all tabs
    (indent-region (point-min) (point-max) 0 )
;; indent correctly
    (indent-region (point-min) (point-max) nil )
    (save-buffer)))

(add-hook 'java-mode-hook 'update-indent-region)
(add-hook 'c++-mode-hook 'update-indent-region)

-------------------------------------

Reply via email to