What has you here today?    work history (html) about me tajik bookmarks

1st of November, 2004 POST·MERIDIEM 02:50

Here’s some Lisp to automatically recompile your ~/.xemacs/init.el after you’ve changed it. (I tend not to save until I’ve made a compilable change.) Byte-compiling it makes for a slightly faster startup, and doing it after every change means 21.4 doesn’t pick up the compiled, obsolete init.elc when it should take the newer one.

;; When I’m changing ~/.xemacs/init.el, I want it automatically recompiled 
;; on every save. 
(require ’after-save-commands)
(let ((our-startup-file user-init-file) 
      (user-file-quoted nil)) 
  ;; Chop off the c of the “.elc”, if it’s there. 
  (if (equal (substring our-startup-file -4) “.elc”) 
      (setq our-startup-file (substring our-startup-file 0 -1))) 
  ;; Quote it as a regexp.  
  (setq user-file-quoted (regexp-quote our-startup-file)) 
  ;; Now, push it onto the After-save-alist, together with the lisp 
  ;; necessary to recompile it on every save. 
  (push ‘(,user-file-quoted nil nil (byte-compile-file ,our-startup-file)) 

Note the comma used to allow evaluation for the following element within the backquote—this is the main difference between the backquote and the normal quote, and it’s what makes it more interesting.

I’m using 21.4 because it’s usable in a TTY on Linux for me—21.5 just isn’t, it loses keystrokes far too often.

 [No extant comments for this entry.]

Comments are currently disabled.