Skip to content

Instantly share code, notes, and snippets.

@gleitz
Created October 6, 2011 03:32
Show Gist options
  • Save gleitz/1266438 to your computer and use it in GitHub Desktop.
Save gleitz/1266438 to your computer and use it in GitHub Desktop.
;; load customization packages
(let ((base "~/.emacs.d/"))
(dolist (f '("my-general.el" "my-lint.el" "my-external.el" "my-local.el" "my-optional.el"))
(let ((name (concat base "/" f)))
(if (or (not (file-exists-p (byte-compile-dest-file (expand-file-name name))))
(file-newer-than-file-p (expand-file-name name) (byte-compile-dest-file (expand-file-name name)))
(equal (nth 4 (file-attributes (expand-file-name name))) (list 0 0)))
(load (expand-file-name name))
(load (byte-compile-dest-file (expand-file-name name)))))))
;; byte-compile all my-*.el files upon exit
(add-hook 'kill-emacs-hook
'(lambda () (let ((base "~/.emacs.d"))
(dolist (f (directory-files base))
(let ((name (concat base "/" f)))
(when (and (file-regular-p name)
(string-match "/my-.*\\.el$" name)
(file-newer-than-file-p (expand-file-name name) (byte-compile-dest-file (expand-file-name name))))
(byte-compile-file (expand-file-name name))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment