From 05f9b47226f2653c88818d22f9ec81c59ad53c55 Mon Sep 17 00:00:00 2001 From: Pete Williamson Date: Fri, 27 Feb 2015 15:47:34 -0800 Subject: [PATCH] Allow expansion of bare tilde when looking for .emacs file On some systems, the shortcut "~user" is not expanded properly, but "~" is. So, I added code in startup.el to check first for ~user/.emacs.d/init.el, and if that is not found, to then try ~/.emacs.d/init.el. --- ChangeLog | 6 ++++++ lisp/startup.el | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bfdfbb..243dd4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-02-27 Pete Williamson + + To find the .emacs file, check both ~user/.emacs.d and ~/.emacs.d + * lisp/startup.el: If The system does not support expanding ~user, + try expanding ~ when looking for the .emacs.d/init.el file. + 2015-02-27 Paul Eggert Don't require GNU putenv diff --git a/lisp/startup.el b/lisp/startup.el index 999e53e..c0d6059 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1105,14 +1105,22 @@ please check its value") (load user-init-file-1 t t) (when (eq user-init-file t) - ;; If we did not find ~/.emacs, try - ;; ~/.emacs.d/init.el. + ;; If we did not find ~/.emacs or ~/.emacs, try + ;; ~/.emacs.d/init.el or ~/.emacs.d/init.el (let ((otherfile (expand-file-name "init" (file-name-as-directory - (concat "~" init-file-user "/.emacs.d"))))) - (load otherfile t t) + (concat "~" init-file-user "/.emacs.d")))) + ;; Generate a filename for ~/.emacs.d/init.el. + (otherfile-tilde-only + (expand-file-name + "init" + (file-name-as-directory "~/.emacs.d")))) + (when (nilp (load otherfile t t)) + ;; If ~/.emacs.d/init.el was not found, try + ;; ~/.emacs.d/init.el + (load otherfile-tilde-only t t)) ;; If we did not find the user's init file, ;; set user-init-file conclusively. -- 2.2.0.rc0.207.ga3a616c