GNU bug report logs - #81770
Prohibit modifying user-emacs-directory in Lisp

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "R. Diez" <rdiez-2006@HIDDEN>; dated Tue, 1 Sep 2026 16:45:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 81770 <at> debbugs.gnu.org:


Received: (at 81770) by debbugs.gnu.org; 2 Sep 2026 11:19:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 02 07:19:53 2026
Received: from localhost ([127.0.0.1]:39694 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1x1j0T-0003he-8k
	for submit <at> debbugs.gnu.org; Wed, 02 Sep 2026 07:19:53 -0400
Received: from relay.yourmailgateway.de ([188.68.63.98]:55367)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rdiez-2006@HIDDEN>)
 id 1x1j0R-0003hV-DT
 for 81770 <at> debbugs.gnu.org; Wed, 02 Sep 2026 07:19:52 -0400
Received: from mors-relay-2501.netcup.net (localhost [127.0.0.1])
 by mors-relay-2501.netcup.net (Postfix) with ESMTPS id 4hZgHV0G6Fz6Q2Y;
 Wed,  2 Sep 2026 13:19:50 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rd10.de; s=key2;
 t=1788347990; bh=j3s9hb590T9ElTjZHc6oF38t9F73nHvkbW65FHUkVJ8=;
 h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
 b=URFzFi5npF3BxYE6ylMTDwY3Ly+PzTAeze8Y9TZ3Bxsu4HVi9oWw8ZH+wDnF9JEhw
 a58rPTa0bHrjTIdAUV7q5+mjjQl8mpsvYuCP5ZLqV3ovrsqlN6IZ+Sea/qyKh08KnM
 vgUXQ47RMGO20t2i3BZwbdfsI/9/38pAFHBb09etxM2vVg4m+m7zeF3QQe06mNvh/6
 bxS6QtRIvk9tyRij7u6ubU3+JBYUyRqEXzJVZ+jdRno67SBZKRJnp6zMH/rvEGJUew
 9XfLeMUP6CgH5a/NYOWFxpQMWTJNTlQ2V869ARWLTmJkRGdXW128Z686yoGqzQgm70
 nOibjkJ3Xu7Og==
Received: from policy02-mors.netcup.net (unknown [46.38.225.35])
 by mors-relay-2501.netcup.net (Postfix) with ESMTPS id 4hZgHM6vZsz4yPZ;
 Wed,  2 Sep 2026 13:19:43 +0200 (CEST)
Received: from mx2eb1.netcup.net (unknown [10.243.12.53])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by policy02-mors.netcup.net (Postfix) with ESMTPS id 4hZgHM593Tz8svW;
 Wed,  2 Sep 2026 13:19:43 +0200 (CEST)
Received: from [192.168.117.41] (255.red-88-23-182.staticip.rima-tde.net
 [88.23.182.255])
 by mx2eb1.netcup.net (Postfix) with ESMTPSA id B94A110019A;
 Wed,  2 Sep 2026 13:19:38 +0200 (CEST)
Authentication-Results: mx2eb1;
 spf=pass (sender IP is 88.23.182.255) smtp.mailfrom=rdiez-2006@HIDDEN
 smtp.helo=[192.168.117.41]
Received-SPF: pass (mx2eb1: connection is authenticated)
Message-ID: <540f1eb8-fe9a-49ef-9bbd-d48e2d6ac462@HIDDEN>
Date: Wed, 2 Sep 2026 13:19:38 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#81770: Prohibit modifying user-emacs-directory in Lisp
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
References: <02b14b4f-1353-4f83-8151-bdbd8b3208b0@HIDDEN>
 <87cxuwy1eb.fsf@HIDDEN>
Content-Language: en-GB
From: "R. Diez" <rdiez-2006@HIDDEN>
In-Reply-To: <87cxuwy1eb.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-PPP-Message-ID: <178834797908.121254.17926623640572749138@HIDDEN>
X-Rspamd-Server: rspamd-worker-8404
X-Rspamd-Queue-Id: B94A110019A
X-NC-CID: GS8honHE6/Qb9jwf2RHy1/PQzNI9nE4goQQyM4D6
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 81770
Cc: 81770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


> I don't know if this would completely get rid of your problem, but - are
> you aware of the early init file - as described for example in
> 
>    (info "(elisp) Init File") ?

I wasn't aware, thanks for the link. I have read it now, but some questions remain.

I followed one link to (info "(emacs) Find Init"), and it does discourage setting 'user-emacs-directory' in your init files. But I still think you shouldn't have to read several manual pages to find out. The documentation for variable 'user-emacs-directory' should mention this explicitly, or at least link to the manual for more information.

Then there is the question about native compilation and customized settings like 'native-comp-jit-compilation' and 'native-comp-speed'. Emacs places the customized settings in ~/.emacs by default, so that is where I placed the code to set 'custom-file' and load that file.

But, if native compilation starts before ~/.emacs, is that not too late? Shouldn't the customized settings be set or loaded in early-init.el instead? Or is that still not early enough as far as native compilation is concerned?

The documentation in (info "(elisp) Init File") is vague about the initialisation steps. It only mentions PACKAGE-LOAD-LIST and PACKAGE-ENABLE-AT-STARTUP, and, if you follow the links, the documention for early-init.el only mentions a few settings related to package management. Incidentally, do you know why settings like PACKAGE-LOAD-LIST are written in uppercase in the manual? Their "official" names are in lowercase.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81770; Package emacs. Full text available.

Message received at 81770 <at> debbugs.gnu.org:


Received: (at 81770) by debbugs.gnu.org; 1 Sep 2026 23:53:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 19:53:27 2026
Received: from localhost ([127.0.0.1]:33916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1x1YIA-0000mW-Q5
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2026 19:53:27 -0400
Received: from mout-p-201.mailbox.org ([80.241.56.171]:38268)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1x1YI8-0000mH-0g
 for 81770 <at> debbugs.gnu.org; Tue, 01 Sep 2026 19:53:25 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4hZN3K4HjvzMlGK;
 Wed, 02 Sep 2026 01:53:17 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;
 s=mail20150812; t=1788306797;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=9rJarAf6yNiLZ2rFPbcNHynM+RQyIfhDRnKzDxhy8nI=;
 b=no//++jKh8w9sctL6xR7Wzp40WN88xa/+6+aWQzsb4xBNC5ZUAE0eSbCu6UbXK4XuYFzD2
 S8mxcJjawTDPJuZUiSdua85WZ6ZnJdET75rlBP//hkU9Qdy5x2Q00UNky6Njmr3MTa0XXr
 Fj4i/MNXzSIbe85w5lBbEEFRO0pBJQNSIVh9gz9QZXBQIswlQgjNv3EqY0Bhm5N3BMNnRY
 AVs4ETyCXzPPsBPeFMS7vhsFLeWNSk6NbKHKLWm3AuyfeQh2B5nVcXIPzpfV9gurHZfXTW
 meZzG8t+13xyy864/XMvWOuOl9dNQeQMo0MYhLallUnGzy8l3znEJYI/z4bP+A==
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;
 s=mail20150812; t=1788306796;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=9rJarAf6yNiLZ2rFPbcNHynM+RQyIfhDRnKzDxhy8nI=;
 b=AjgVWfsbqFTut3yKLUDxriPVazuBAf/RTAS9NnE+aLVUljDGEkMTJwCNSv9fM4wx0MCDr9
 4jsTi77OCLTR4t/wHYhn3ckoeV9E+6iS12hO9CvlRHHJt+ro2Pu89WkP3YmuT+JspbFzMV
 lQOM+lIGHrfU3S5N7PaR+xAYH6KvKhz/yuaaLB+wwywDe85eh+wKGlzCfkcBV60TPjV4gX
 0E0BXvPq0K3nxkk6erAfUolmC2Pe83qZauRigbfg1iI2QZYv2vRY/4xDFdZrx4VYQDpte4
 RNzvvKuJaQymxqwVhOzrITZ331rfKs4jz/RBqs0aiaBS2uqAyZ+RrtaXIpZOxg==
To: "R. Diez" <rdiez-2006@HIDDEN>
Subject: Re: bug#81770: Prohibit modifying user-emacs-directory in Lisp
In-Reply-To: <02b14b4f-1353-4f83-8151-bdbd8b3208b0@HIDDEN>
References: <02b14b4f-1353-4f83-8151-bdbd8b3208b0@HIDDEN>
Date: Wed, 02 Sep 2026 01:53:16 +0200
Message-ID: <87cxuwy1eb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-MBO-RS-META: 4uuz8dbec6e6xe96u1w5rjnbmyt7ehzo
X-MBO-RS-ID: 4580237cb4e36fe63d1
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 81770
Cc: 81770 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hello,

I don't know if this would completely get rid of your problem, but - are
you aware of the early init file - as described for example in

  (info "(elisp) Init File") ?

It exists for exactly such kinds of things.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81770; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Sep 2026 16:44:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 01 12:44:21 2026
Received: from localhost ([127.0.0.1]:59336 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1x1Rav-0007yc-FO
	for submit <at> debbugs.gnu.org; Tue, 01 Sep 2026 12:44:21 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:52558)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rdiez-2006@HIDDEN>)
 id 1x1Ras-0007y1-Hn
 for submit <at> debbugs.gnu.org; Tue, 01 Sep 2026 12:44:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rdiez-2006@HIDDEN>)
 id 1x1Ral-0000aU-6z
 for bug-gnu-emacs@HIDDEN; Tue, 01 Sep 2026 12:44:11 -0400
Received: from relay.yourmailgateway.de ([188.68.61.103])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rdiez-2006@HIDDEN>)
 id 1x1Raj-0004i5-8V
 for bug-gnu-emacs@HIDDEN; Tue, 01 Sep 2026 12:44:10 -0400
Received: from mors-relay-8403.netcup.net (localhost [127.0.0.1])
 by mors-relay-8403.netcup.net (Postfix) with ESMTPS id 4hZBWr3nTMz8NP4
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Sep 2026 18:43:52 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rd10.de; s=key2;
 t=1788281032; bh=+R/9bIbSkLf7B2GZxb0+FIlZv4YA0Iy6ALj3iCuzFpc=;
 h=Date:To:From:Subject:From;
 b=AbEINYZmqI2c/CxdJGm8XrOAL8irNuHH4+PPBD3WxJi64SchViDRjIGp+MczmiM9l
 wHf+d5uTlK4pqoPjmVxtW/wzMDNwB0lSvtntQ+o0kYk6rV1A8Yrrk2+nb92SrokJpj
 uVQP4c68fRNaxZ3iH0OVTG/fFTT9celR/CIt3a4gntkN8zm5sSIeXwQzp2djnf51oP
 THZTuTdO2ya47Przvgxl36ydwKNYumRo+Tc4T57//QVzjP7sx6wsPVHvTW9EdUt7cR
 VMwqxMWzsG8YpY7G0JUNXryfUmEtsAjW05PKmdNBl4Sften2QMCiCz285FroZH4KMm
 6qiRqpC5nkpOw==
Received: from policy01-mors.netcup.net (unknown [46.38.225.35])
 by mors-relay-8403.netcup.net (Postfix) with ESMTPS id 4hZBWn1zfnz8MZC
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Sep 2026 18:43:49 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at policy01-mors.netcup.net
X-Spam-Flag: NO
X-Spam-Score: -2.901
X-Spam-Level: 
X-Spam-Status: No, score=-2.901 required=6.31 tests=[ALL_TRUSTED=-1,
 BAYES_00=-1.9, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mx2eb1.netcup.net (unknown [10.243.12.53])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by policy01-mors.netcup.net (Postfix) with ESMTPS id 4hZBWm5kqvz8tdB
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Sep 2026 18:43:48 +0200 (CEST)
Received: from [192.168.117.41] (255.red-88-23-182.staticip.rima-tde.net
 [88.23.182.255])
 by mx2eb1.netcup.net (Postfix) with ESMTPSA id 2A4D91001D1
 for <bug-gnu-emacs@HIDDEN>; Tue,  1 Sep 2026 18:43:40 +0200 (CEST)
Authentication-Results: mx2eb1;
 spf=pass (sender IP is 88.23.182.255) smtp.mailfrom=rdiez-2006@HIDDEN
 smtp.helo=[192.168.117.41]
Received-SPF: pass (mx2eb1: connection is authenticated)
Message-ID: <02b14b4f-1353-4f83-8151-bdbd8b3208b0@HIDDEN>
Date: Tue, 1 Sep 2026 18:43:39 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: bug-gnu-emacs@HIDDEN
Content-Language: en-GB
From: "R. Diez" <rdiez-2006@HIDDEN>
Subject: Prohibit modifying user-emacs-directory in Lisp
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-PPP-Message-ID: <178828102039.570716.9795077657647072680@HIDDEN>
X-NC-CID: VDXG15a/Cd6LtOVX4J0QAuE3h3KxOlrwAKIQtAKV
Received-SPF: pass client-ip=188.68.61.103; envelope-from=rdiez-2006@HIDDEN;
 helo=relay.yourmailgateway.de
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

I am experimenting with Emacs 30.2 and 31.1, and I have tried to use a different ~/.emacs.d directory depending on the Emacs version.

My first attempt was adding this line first thing in my ~/.emacs file:

(setq user-emacs-directory "~/somewhere")

That did not work: Emacs created both ~/somewhere and ~/.emacs.d and populated them.

I was puzzled by this behaviour, so I added this command to the top of my ~/.emacs file:

(debug)

I then restarted Emacs, which immediately stopped at that very first command.

Nevertheless, some background thread in Emacs apparently started creating files under this directory:

~/.emacs.d/eln-cache/31.1-6504ca10

I found that strange. After all, the user could disable native compilation with native-comp-jit-compilation, or set native-comp-speed , in the Emacs start file, and it looks like those settings haven't been read yet at that point.

Can anybody confirm this observation?

In any case, modifying user-emacs-directory in Lisp does not seem to work. In order to prevent confusion, these are some alternatives:

1) Prohibit modifying user-emacs-directory in Lisp. Attempting to do so should raise an error explaining that command-line option '--init-directory=DIR' is the only reliable way.

2) Instead of a hard error, issue a 'display-warning'.

3) Document in user-emacs-directory that the user should use command-line option '--init-directory=DIR' instead.




Acknowledgement sent to "R. Diez" <rdiez-2006@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#81770; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 2 Sep 2026 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.