A few minor fixes

- (expand-file-name "~") uses $HOME if set, so no need to try both
- Prefer defconst to defvar where applicable
- Fix regexp for template files