From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: frederik@ofb.net Newsgroups: gmane.emacs.bugs Subject: bug#25819: 25.1; Added by Package.el. Added by Package.el. Added by Package.el. Added by Package.el. Date: Wed, 22 Feb 2017 22:23:51 -0800 Message-ID: <20170223062351.GR1204@ofb.net> References: <20170220201438.GG1204@ofb.net> <8ttw7n1925.fsf@fencepost.gnu.org> <20170221230422.GJ1204@ofb.net> <20170222204852.GN1204@ofb.net> <87zihdfxot.fsf@users.sourceforge.net> Reply-To: frederik@ofb.net NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1487831121 30385 195.159.176.226 (23 Feb 2017 06:25:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Feb 2017 06:25:21 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 25819@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 23 07:25:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgmpy-0006y6-Gl for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Feb 2017 07:25:10 +0100 Original-Received: from localhost ([::1]:56907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgmq4-0003VD-JX for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Feb 2017 01:25:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgmpu-0003Pd-Uq for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2017 01:25:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgmpp-0008Dk-W8 for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2017 01:25:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53689) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cgmpp-0008DZ-T7 for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2017 01:25:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cgmpp-0004KS-Ni for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2017 01:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: frederik@ofb.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2017 06:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25819 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25819-submit@debbugs.gnu.org id=B25819.148783104216573 (code B ref 25819); Thu, 23 Feb 2017 06:25:01 +0000 Original-Received: (at 25819) by debbugs.gnu.org; 23 Feb 2017 06:24:02 +0000 Original-Received: from localhost ([127.0.0.1]:51888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgmos-0004JF-EW for submit@debbugs.gnu.org; Thu, 23 Feb 2017 01:24:02 -0500 Original-Received: from icgriddb04.seas.upenn.edu ([158.130.57.72]:49268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgmoo-0004In-6c for 25819@debbugs.gnu.org; Thu, 23 Feb 2017 01:23:58 -0500 Original-Received: from [10.13.0.6] (helo=ofb.net) by ICGRIDDB04.SEAS.upenn.edu with esmtp (Exim 4.87) (envelope-from ) id 1cgmon-0005Oj-3x; Thu, 23 Feb 2017 01:23:57 -0500 Original-Received: from thutmose (unknown [24.7.113.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ofb.net (Postfix) with ESMTPSA id B649F412AD; Wed, 22 Feb 2017 22:23:51 -0800 (PST) Original-Received: from frederik by thutmose with local (Exim 4.88) (envelope-from ) id 1cgmoh-0006mR-2D; Wed, 22 Feb 2017 22:23:51 -0800 Content-Disposition: inline In-Reply-To: <87zihdfxot.fsf@users.sourceforge.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:129682 Archived-At: Thank you! On Wed, Feb 22, 2017 at 09:28:02PM -0500, npostavs@users.sourceforge.net wrote: > forcemerge 25819 24643 > tags 25819 patch > quit > > frederik@ofb.net writes: > > > On Wed, Feb 22, 2017 at 02:28:27PM -0500, Glenn Morris wrote: > >> > >> I tested with: > >> > >> /tmp/h1/.emacs: > >> (setenv "HOME" "/tmp/h2/") > >> (setq savehist-file "/tmp/h1/.emacs-history") > >> (load "~/.emacs") > >> (setenv "HOME" "/tmp/h1/") > >> > >> /tmp/h2/.emacs: > >> (setq foo 99) > >> > >> > >> HOME=/tmp/h1 emacs-25.1 > >> M-x package-initialize > > > > You don't think my problem is common!? :) Well I'm not sure how other > > people edit files as root, > > Probably with TRAMP: https://www.emacswiki.org/emacs/TrampMode#toc20 > > > Thank you (indeed) for taking the time to trim down my problem to a > > minimal test case. If we make it a little less minimal: > > > > /tmp/h2/.emacs: > > (setq foo 99) > > (package-initialize) > > > > then I find it reproduces the problem: > > AFAICT, this is essentially the problem described in #24643 and should be > fixed by the suggestion there: > > From aeae23ab082e948eca71ead3ea50a49a4fe73251 Mon Sep 17 00:00:00 2001 > From: Noam Postavsky > Date: Wed, 22 Feb 2017 21:12:41 -0500 > Subject: [PATCH v1] Don't call package--ensure-init-file if initialized during > startup > > * lisp/emacs-lisp/package.el (package-initialize): Check > `after-init-time' rather than `load-file-name' to decide if > `package--ensure-init-file' should be called. Depending on > `load-file-name' will fail if the user calls `pacakge-initialize' in > file which is loaded from the init file (Bug#24643, Bug#25819). > --- > lisp/emacs-lisp/package.el | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index 0851c5e1fd..ee4bb750ab 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -1445,13 +1445,13 @@ package-initialize > taken care of by `package-initialize'." > (interactive) > (setq package-alist nil) > - (if (equal user-init-file load-file-name) > - ;; If `package-initialize' is being called as part of loading > - ;; the init file, it's obvious we don't need to ensure-init. > - (setq package--init-file-ensured t > - ;; And likely we don't need to run it again after init. > - package-enable-at-startup nil) > - (package--ensure-init-file)) > + (if after-init-time > + (package--ensure-init-file) > + ;; If `package-initialize' is before we finished loading the init > + ;; file, it's obvious we don't need to ensure-init. > + (setq package--init-file-ensured t > + ;; And likely we don't need to run it again after init. > + package-enable-at-startup nil)) > (package-load-all-descriptors) > (package-read-all-archive-contents) > (unless no-activate > -- > 2.11.1 >