diff --git a/lisp/recompile-files.el b/lisp/recompile-files.el new file mode 100644 index 0000000..c3ae626 --- /dev/null +++ b/lisp/recompile-files.el @@ -0,0 +1,26 @@ +(defun recompile-stale-elcs () + (interactive) + + (with-temp-buffer + (setq-local default-directory user-emacs-directory) + + (let ((find-command (find-cmd '(prune (name ".git")) + '(name "*.elc")))) + + (shell-command find-command t t)) + + (goto-char (point-min)) + + (setq more-lines t) + + (while more-lines + (let ((start (progn (beginning-of-line) + (point))) + (end (progn (end-of-line) + (point)))) + (let ((el (buffer-substring start (- end 1))) + (elc (buffer-substring start end))) + + (if (file-newer-than-file-p el elc) + (byte-compile-file (buffer-substring start (- end 1)))))) + (setq more-lines (= 0 (forward-line 1)))))) diff --git a/recompile-files.sh b/recompile-files.sh deleted file mode 100755 index 7a93f1e..0000000 --- a/recompile-files.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -cd `dirname $0` -pwd=`pwd` - -for file in `find -iname '*.elc'` -do - elc=`basename "$file"` - el="${elc%c}" - dir=`dirname "$file"` - - cd "$dir" - - if test "$elc" -ot "$el" - then - echo "Recompiling ${el}" - - emacs --batch --eval '(byte-compile-file "'${el}'")' - fi - - cd $pwd -done