From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#16087: Setting HOME environment variable in Emacs on Windows has side effects Date: Sun, 08 Dec 2013 19:38:41 +0200 Message-ID: <83ob4rz1i6.fsf@gnu.org> References: <52A388CD.8030302@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1386524421 10827 80.91.229.3 (8 Dec 2013 17:40:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Dec 2013 17:40:21 +0000 (UTC) Cc: 16087@debbugs.gnu.org To: SDS Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 08 18:40:25 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VpiL8-0007D1-Nf for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Dec 2013 18:40:22 +0100 Original-Received: from localhost ([::1]:40235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpiL8-0000eX-1o for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Dec 2013 12:40:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpiKy-0000eF-1Y for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2013 12:40:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpiKp-0003xv-Pe for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2013 12:40:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpiKp-0003xP-Mu for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2013 12:40:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VpiKo-0002uk-Tu for bug-gnu-emacs@gnu.org; Sun, 08 Dec 2013 12:40:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2013 17:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16087 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16087-submit@debbugs.gnu.org id=B16087.138652435511104 (code B ref 16087); Sun, 08 Dec 2013 17:40:02 +0000 Original-Received: (at 16087) by debbugs.gnu.org; 8 Dec 2013 17:39:15 +0000 Original-Received: from localhost ([127.0.0.1]:38450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VpiK1-0002t1-Ny for submit@debbugs.gnu.org; Sun, 08 Dec 2013 12:39:14 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:43075) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VpiJt-0002sh-Nv for 16087@debbugs.gnu.org; Sun, 08 Dec 2013 12:39:07 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MXI00L000K3W700@a-mtaout22.012.net.il> for 16087@debbugs.gnu.org; Sun, 08 Dec 2013 19:38:53 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MXI00LBQ10MRF50@a-mtaout22.012.net.il>; Sun, 08 Dec 2013 19:38:46 +0200 (IST) In-reply-to: <52A388CD.8030302@gmail.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81627 Archived-At: > Date: Sat, 07 Dec 2013 15:45:01 -0500 > From: SDS > > When running "emacs.exe -Q" for precompiled Emacs binaries on Windows, > and after setting the HOME environment variable to a path different than > the registry's HKCU\SOFTWARE\GNU\Emacs\HOME, attempting to access the > old HOME directory returns the new HOME directory. This is in no way specific to Windows. I tried similar steps on GNU/Linux, and saw very similar signs of trouble. Of course, there's no registry on Unix, but it is enough to start with step #2. > The steps to reproduce the bug are as follows: > 1) Set the registry key "HKCU\SOFTWARE\GNU\Emacs\HOME" to "C:\Old\Home" > 2) Run "emacs.exe -Q" > 3) In a scratch buffer, evaluate "(setenv "HOME" "C:/New/Home")" > 4) Using Dired (C-x d), open "C:\Old\Home" > 5) The directory in the new Dired buffer is "C:\New\Home" FWIW, I wouldn't expect this to work. Every buffer has its default directory stored as a string in its buffer object. If you change where the home directory points to, most, if not all, of these directories will become invalid, because their expansions, which always go through "~" if possible, will not exist, except by chance. And Emacs uses the default directories of the buffers freely when it manipulates file names. OTOH, the use case for supporting such a strange change in the middle of an Emacs session is entirely not clear to me. On the contrary, it seems to me like doing this is asking for a lot of trouble, and not only in Emacs (because 'setenv' modifies process-environment, so every subprocess will get this new value of HOME, so, e.g., the shell will not find its init files). Could you please describe why you needed this?