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

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

[h-e-w] Re: help-emacs-windows Digest, Vol 79, Issue 4


From: David J. Biesack
Subject: [h-e-w] Re: help-emacs-windows Digest, Vol 79, Issue 4
Date: Mon, 08 Mar 2010 09:43:42 -0500

> Date: Sun, 7 Mar 2010 11:02:16 -0500
> From: Kenneth Goldman <address@hidden>
> Subject: [h-e-w] gnudoit untabify
> To: address@hidden
> Message-ID:
>       <address@hidden>
> 
> 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   address@hidden

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




reply via email to

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