Mailing List Archive


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

Re: [tlug] Emacs batch commands, over many files



>>>>> "David" == David Riggs <dariggs@example.com> writes:


    David> emacs * -batch --eval '(progn (insert "from
    David> batch")(save-buffer))'

    David> But this works on only last of the files served up by the
    David> "*" expansion, the rest of the files are ignored.

    David> How do I get emacs to see all the files passed to it?

Emacs sees and visits them; it's your Lisp program that doesn't.
Here's a mass-murder approach, but less violent APIs will be visible
if you use C-h a -buffer$ RET (in XEmacs, anyway; Emacs still seems to
believe that ordinary users don't want to see non-interactive
functions).

emacs * -batch -eval '(while (> (length (buffer-list) 0)) \
                         (insert "from batch") (save-buffer) (kill-buffer))'

(You may want to check for (equal (buffer-name) "*scratch*") and stuff
like that, too.)

Probably a more convenient way to work on this is to defun the code as
myfun in a file myprog.el and do

emacs * -batch -l myprog -f myfun

-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links