Skip to content

Instantly share code, notes, and snippets.

@hnw
Created April 15, 2010 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnw/367021 to your computer and use it in GitHub Desktop.
Save hnw/367021 to your computer and use it in GitHub Desktop.
;; .emacs先頭で、.emacs.elcの方が古かったら再作成する。
;; (ってこのタイミングで再作成しても間に合わない気がする…。)
(if (file-newer-than-file-p "~/.emacs" "~/.emacs.elc")
(save-excursion
(byte-compile-file "~/.emacs")))
;; .emacsをsaveしたらelcを作る
(add-hook 'after-save-hook
(function (lambda ()
(if (string= (file-truename (expand-file-name "~/.emacs"))
(file-truename (buffer-file-name)))
(save-excursion
(byte-compile-file "~/.emacs"))))))
;; その他好きな処理
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment