> Date: Sun, 7 Mar 2010 11:02:16 -0500
> From: Kenneth Goldman <[email protected]>
> Subject: [h-e-w] gnudoit untabify
> To: [email protected]
> Message-ID:
> <of38b8a7b9.3e4010f9-on852576df.0057edb9-852576df.00581...@us.ibm.com>
>
> I need to run my code through emacs and 'untabify'.
>
> I sense that gnudoit can do this in batch mode. Can someone give me a
> sample or at least a hint as to how to do this?
>
> --
> Ken Goldman [email protected]
I usually start by trying to keep the external interface as small as possible.
So, from a shell you would do
gnudoit '(untabify-file "c:/path/to/filename.x")
or
emacsclient -e '(untabify-file "c:/path/to/filename.x")
(I use Cygwin's bash shell; adjust the quoting if you use Windows CMD shell).
This means you need to write the untabify-file function in emacs and load it
before calling it from gnudoit/emacsclient :
(defun untabify-file (filename)
"Load the file FILENAME and untabify and save it."
(interactive "f")
(save-excursion
(let* ((buffer (get-file-buffer filename)) ;; see if file is already loaded
(file (or buffer (find-file-noselect filename))))
(set-buffer file)
(untabify (point-min) (point-max))
(and (buffer-modified-p)
(save-buffer))
; if file was not already loaded, kill it
(or buffer (kill-buffer file)))))
--
David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com (919) 531-7771