1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
;;; batch-ada-indent.el --- non-interactive indentation of Ada code
;;; Copyright (C) 1999 Samuel Tardieu.
;;; Typical use: define a script called "ada-indent" containing:
;;;
;;; #! /bin/sh
;;; emacs -batch -f batch-ada-indent "$@"
;;;
;;; then call "ada-indent *.ads *.adb" to indent your files.
;; Author: Samuel Tardieu <sam@debian.org>
(require 'ada-mode)
;;;###autoload
(defun batch-ada-indent ()
"Run `ada-indent-region' on the files remaining on the command line.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
For example, invoke \"emacs -batch -f batch-ada-indent *.ads *.adb\""
(if (not noninteractive)
(error "`batch-ada-indent' is to be used only with -batch"))
(while command-line-args-left
(let ((source (car command-line-args-left)))
(find-file source)
(ada-indent-region (point-min) (point-max))
(write-file source))
(setq command-line-args-left (cdr command-line-args-left)))
(message "Done")
(kill-emacs 0))
|