The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
Browse Source

Change recompile-files shell script to pure Elisp

It still calls `find(1)`, but everything else is Elisp. This means it is
generally faster. It still has some buffer processing overhead, though.
gerrit-package
Gergely Polonkai 6 years ago
parent
commit
ec94d552fc
  1. 26
      lisp/recompile-files.el
  2. 22
      recompile-files.sh

26
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))))))

22
recompile-files.sh

@ -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
Loading…
Cancel
Save