Does anyone else have this problem? You’ve made some changes to one of your start-up emacs files. Then you fire up a new instance of emacs to check if your new feature works. However, none of your changes seem to have made a difference. So you spend some time looking into what you did wrong. And finally you realise – Emacs loads compiled emacs-lisp code in preference to uncompiled code, even when the uncompiled code is newer.
True story – this has happened to me more than a couple of times. The fifth second time I decided to fix it. I’ve come up with a solution that I’m fairly happy with: Emacs is started from a script called run_emacs.sh that runs another script called compile.sh (I’ve done it this way so I can run compile.sh independently).
#!/bin/sh $HOME/emacs-files/compile.sh emacs $*
compile.sh calls batch-byte-compile-if-not-done.
#!/bin/sh
cd $HOME/emacs-files
emacs --batch \
--eval "(add-to-list 'load-path (expand-file-name \"~/emacs-files\"))" \
--eval "(add-to-list 'load-path (expand-file-name \"~/emacs-files/org-xxx\"))" \
--eval "(batch-byte-compile-if-not-done)" *.el
And last but not least I alias emacs to run_emacs.sh.
$ alias emacs='$HOME/emacs-files/run_emacs.sh'