aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-11-30 18:04:46 -0800
committerGlenn Morris2013-11-30 18:04:46 -0800
commit2e6710c39621ab7dd18b33517699b3daa3dfbb26 (patch)
tree5390e1b9a4db69bb778c347a608b34cc92c2d802
parentc2685641ac4a9e23c87e0a1c9f078e220af592a4 (diff)
downloademacs-2e6710c39621ab7dd18b33517699b3daa3dfbb26.tar.gz
emacs-2e6710c39621ab7dd18b33517699b3daa3dfbb26.zip
* lisp/startup.el (command-line): Warn if ~/emacs.d is in load-path.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/startup.el23
2 files changed, 27 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f03abe793e2..5c6c40bc515 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12013-12-01 Glenn Morris <rgm@gnu.org>
2
3 * startup.el (command-line): Warn if ~/emacs.d is in load-path.
4
12013-11-30 Eli Zaretskii <eliz@gnu.org> 52013-11-30 Eli Zaretskii <eliz@gnu.org>
2 6
3 * startup.el (fancy-splash-frame): On MS-Windows, trigger 7 * startup.el (fancy-splash-frame): On MS-Windows, trigger
diff --git a/lisp/startup.el b/lisp/startup.el
index 25e75c994a6..a21695fe19a 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1289,6 +1289,29 @@ the `--debug-init' option to view a complete error backtrace."
1289 ;; Process the remaining args. 1289 ;; Process the remaining args.
1290 (command-line-1 (cdr command-line-args)) 1290 (command-line-1 (cdr command-line-args))
1291 1291
1292 ;; This is a problem because, e.g. if emacs.d/gnus.el exists,
1293 ;; trying to load gnus could load the wrong file.
1294 ;; OK, it would not matter if .emacs.d were at the end of load-path.
1295 ;; but for the sake of simplicity, we discourage it full-stop.
1296 ;; Ref eg http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00056.html
1297 ;;
1298 ;; A bad element could come from user-emacs-file, the command line,
1299 ;; or EMACSLOADPATH, so we basically always have to check.
1300 (let (warned)
1301 (dolist (dir load-path)
1302 (and (not warned)
1303 (string-match-p "/[._]emacs\\.d/?\\'" dir)
1304 (string-equal (file-name-as-directory (expand-file-name dir))
1305 (expand-file-name user-emacs-directory))
1306 (setq warned t)
1307 (display-warning 'initialization
1308 (format "Your `load-path' seems to contain
1309your `.emacs.d' directory: %s\n\
1310This is likely to cause problems...\n\
1311Consider using a subdirectory instead, e.g.: %s" dir
1312(expand-file-name "lisp" user-emacs-directory))
1313 :warning))))
1314
1292 ;; If -batch, terminate after processing the command options. 1315 ;; If -batch, terminate after processing the command options.
1293 (if noninteractive (kill-emacs t)) 1316 (if noninteractive (kill-emacs t))
1294 1317