[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs as a command line tool
From: |
Joakim Hove |
Subject: |
Re: Emacs as a command line tool |
Date: |
Tue, 17 Feb 2004 12:46:36 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
David Rasmussen <david.rasmussen@gmx.net> writes:
> I considered that, but it just outputs the results to stdout, which
> makes it hard to use in batch runs. Or am I missing something?
Well,
how about redirection:
expand file > tmp_file ; mv tmp_file file
Here is an e-lisp solution:
(defun untabify-file (file)
(find-file file)
(untabify (point-min) (point-max))
(save-buffer)
(kill-buffer (current-buffer)))
(defun untabify-script ()
(interactive)
(dolist (file command-line-args-left)
(untabify-file file)))
which can be invoked as follows:
bash% emacs -f untabify-script file1 file2 file3 ....
But, as you can see the use of emacs from the command-line will
typically require some lisp programming to write wrappers around the
emacs functions, like e.g. the function (untabify)
HTH - Joakim
--
/--------------------------------------------------------------------\
/ Joakim Hove / hove@bccs.no / (55 5) 84076 | \
| Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
| CMU | 5231 Paradis |
\ Thormøhlensgt.55, 5020 Bergen. | 55 91 28 18 /
\--------------------------------------------------------------------/
Re: Emacs as a command line tool, address@hidden, 2004/02/17
Re: Emacs as a command line tool, Floyd Davidson, 2004/02/17