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

get a list of new files.



>>fn new-el { return \
>>	`{bash -c 'for x in *.el; do [ $x -nt ${x}c ] && echo $x; done'}}
>
>echo '.SUFFIXES: .elc .el
>.el.elc: ; @echo $? ' \
>	| make -f - `{echo *.el | sed -e s/\.el/.elc/g} \
>	| sed -e '/is up to date/d'

$alz's example doesn't seem terribly robust:
    
    ; fn-make = /usr/local/gnubin/make; rsalz-el
    add-log.el
    allout.el
    ange-ftp.el
    completion.el
    make: *** No rule to make target `.elc.elc.elc'.  Stop.
    default.el
    # result = 0 1 0
    ; fn-make = /bin/make; rsalz-el
    Make: line 1: syntax error.  Stop.
    # result = 0 1 0
    ;

As for hanche's example, you don't need bash.  You can use `ls -t', and you
can still do it with just one external process (example included below).

This may be all academic, anyway.  If all you want to do is recompile .el
files in a given directory for emacs, why not simply use 
``M-x byte-recompile-directory'' ?

    fn new-el-files \
    {
      let (el-files =; elc-files =)
        {
          for (f = `{ ls -td *.el *.elc })
            if { ~ $f *.elc } \
                 { elc-files = $elc-files $f } \
               { access $f^c && ! ~ $f^c $elc-files } \
                 { el-files = $el-files $f }
          result $el-files
        }   
    }

If you don't care whether or not the .elc even exists, you can get rid of
the call to `access' in the loop.