Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could automate this with a function hung off the after-load-functions hook. Here's something off the top of my head:

     (defun foo-compile-if-newer (path)
       "A function suitable for hanging off `after-load-functions',
     which will byte-compile an Emacs Lisp source file for which there
     is no pre-existing compiled file, or there is a compiled file 
     older than the source."
       (and (save-match-data
               (not (null (string-match "el$" path))))
            (let ((elc-path (byte-compile-dest-file path)))
              (if (or (not (file-exists-p elc-path))
                      (time-less-p (nth 5 (file-attributes elc-path))
                                   (nth 5 (file-attributes path))))
                  (progn
                    (message "Auto-%scompiling %s..."
                             (if (file-exists-p elc-path) "re" "") path)
                  (byte-compile-file path))))))
     
     (add-hook 'after-load-functions
               'foo-compile-if-newer)
Adding an exclusion list, if you feel the need for one, is left as an exercise for the reader.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: