Posted By

bigfaceworm on 04/22/09


Tagged

emacs dot LISP


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

darkhawk


Auto-compiled .emacs file


 / Published in: Emacs Lisp
 

Move your current .emacs file to a new name (like .emacs.username.el), and change the "frog.el" to that new name. This code will byte compile your (newly named) .emacs file upon exit, and upon starting up will load the byte compiled (unless the source is newer).

I chose not to byte compile on startup b/c the original purpose of this code was to speed things up, and loading and byte compiling will slow things down slightly...

  1. (defconst dot-emacs (concat (getenv "HOME") "/" "frog.el")
  2. "My dot emacs file")
  3.  
  4. (require 'bytecomp)
  5. (setq compiled-dot-emacs (byte-compile-dest-file dot-emacs))
  6.  
  7. (if (or (not (file-exists-p compiled-dot-emacs))
  8. (file-newer-than-file-p dot-emacs compiled-dot-emacs)
  9. (equal (nth 4 (file-attributes dot-emacs)) (list 0 0)))
  10. (load dot-emacs)
  11. (load compiled-dot-emacs))
  12.  
  13. (add-hook 'kill-emacs-hook
  14. '(lambda () (and (file-newer-than-file-p dot-emacs compiled-dot-emacs)
  15. (byte-compile-file dot-emacs))))

Report this snippet  

You need to login to post a comment.