unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37456: 27.0.50; can't load .emacs file
@ 2019-09-19  1:54 Katsumi Yamaoka
  2019-09-19  8:04 ` Paul Eggert
  2019-09-19 22:00 ` Katsumi Yamaoka
  0 siblings, 2 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2019-09-19  1:54 UTC (permalink / raw)
  To: 37456

Recipe:
・Create a new directory named "~/pseudo-home" .
・Make a file named "~/pseudo-home/.emacs" with some contents.
・Do:
$ export HOME=/home/$USER/pseudo-home
$ cd
$ emacs&

Then Emacs doesn't load the .emacs file, and if installing an elpa
package it is installed under the .config/emacs/elpa/ directory.
But if there is already the .emacs.d/ directory, Emacs loads
the .emacs file and an elpa package is installed in the .emacs.d/
directory.  Contrary, Emacs 26.3.50 loads the .emacs file even if
there is no .emacs.d/ directory and create the .emacs.d/ directory.

Thanks.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-cygwin, GTK+ Version 3.22.28)
 of 2019-09-19 built on localhost
Windowing system distributor 'The Cygwin/X Project', version 11.0.12004000





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#37456: 27.0.50; can't load .emacs file
  2019-09-19  1:54 bug#37456: 27.0.50; can't load .emacs file Katsumi Yamaoka
@ 2019-09-19  8:04 ` Paul Eggert
  2019-09-19 22:00 ` Katsumi Yamaoka
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2019-09-19  8:04 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 37456

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Thanks for the bug report. I installed the attached; please give it a try.

[-- Attachment #2: 0001-Also-prefer-.emacs.d-if-.emacs-exists.patch --]
[-- Type: text/x-patch, Size: 1775 bytes --]

From 6cc1d4bdf70d58e64f95daf1a871212aefa0e47e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 19 Sep 2019 00:59:59 -0700
Subject: [PATCH] Also prefer .emacs.d if .emacs exists

Problem reported by Katsumi Yamaoka (Bug#37456).
* lisp/startup.el (startup--xdg-or-homedot): Also
prefer .emacs.d if a traditional .emacs file exists.
---
 doc/lispref/os.texi | 3 ++-
 lisp/startup.el     | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index c94e96bde8..ddbc8a8294 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -475,7 +475,8 @@ Init File
 @defvar user-emacs-directory
 This variable holds the name of the Emacs default directory.
 It defaults to @file{$@{XDG_CONFIG_HOME-'~/.config'@}/emacs/}
-if that directory exists and @file{~/.emacs.d/} does not exist,
+if that directory exists and @file{~/.emacs.d/} and @file{~/.emacs} do
+not exist,
 otherwise to @file{~/.emacs.d/} on all platforms but MS-DOS@.
 Here, @file{$@{XDG_CONFIG_HOME-'~/.config'@}}
 stands for the value of the environment variable @env{XDG_CONFIG_HOME}
diff --git a/lisp/startup.el b/lisp/startup.el
index ef6234128a..4078f23f3a 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -508,7 +508,14 @@ startup--xdg-or-homedot
 			       (if (eq system-type 'ms-dos)
 				   "/_emacs.d/"
 				 "/.emacs.d/"))))
-      (if (file-exists-p emacs-d-dir)
+      (if (or (file-exists-p emacs-d-dir)
+	      (if (eq system-type 'windows-nt)
+		  (directory-files (concat "~" user-name) nil
+				   "\\`[._]emacs\\(\\.elc?\\)?\\'")
+		(file-exists-p (concat "~" init-file-user
+				       (if (eq system-type 'ms-dos)
+					   "/_emacs"
+					 "/.emacs")))))
 	  emacs-d-dir
 	xdg-dir))))
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#37456: 27.0.50; can't load .emacs file
  2019-09-19  1:54 bug#37456: 27.0.50; can't load .emacs file Katsumi Yamaoka
  2019-09-19  8:04 ` Paul Eggert
@ 2019-09-19 22:00 ` Katsumi Yamaoka
  1 sibling, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2019-09-19 22:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 37456-done

On Thu, 19 Sep 2019 01:04:20 -0700, Paul Eggert wrote:
> Thanks for the bug report. I installed the attached; please give it a try.

I confirmed that Emacs get working as normal.
Thank you for fixing this.  Closing.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-19 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-19  1:54 bug#37456: 27.0.50; can't load .emacs file Katsumi Yamaoka
2019-09-19  8:04 ` Paul Eggert
2019-09-19 22:00 ` Katsumi Yamaoka

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).