From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Jorgen_Sch=C3=A4fer?= Newsgroups: gmane.emacs.devel Subject: Re: Calling (package-initialize) sooner during initialization Date: Sun, 12 Apr 2015 14:09:15 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1428844810 14905 80.91.229.3 (12 Apr 2015 13:20:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Apr 2015 13:20:10 +0000 (UTC) To: v.schneidermann@gmail.com, emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 12 15:20:07 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YhHnz-00051z-82 for ged-emacs-devel@m.gmane.org; Sun, 12 Apr 2015 15:20:07 +0200 Original-Received: from localhost ([::1]:45325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhHny-0001PG-Hu for ged-emacs-devel@m.gmane.org; Sun, 12 Apr 2015 09:20:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGhR-0000YS-TU for emacs-devel@gnu.org; Sun, 12 Apr 2015 08:09:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhGhR-0000cK-0u for emacs-devel@gnu.org; Sun, 12 Apr 2015 08:09:17 -0400 Original-Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:37398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGhQ-0000cG-R7 for emacs-devel@gnu.org; Sun, 12 Apr 2015 08:09:16 -0400 Original-Received: by widdi4 with SMTP id di4so24736603wid.0 for ; Sun, 12 Apr 2015 05:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lvZpCkPXbufaTJS1u23Ny0gOtTK6aHkkPL30w3ldANg=; b=QCqOpNKnnBinI7RZkKD+8CUgV9i8WRHbY4H0GtKpyIGDX/fjyP3j8pc1x0FSwaxmRw Fmcr6RDjYagappdPUVbAiQ2SDlbGKkQapkGsrATVqmC6qoF0tMxe1GyQ0oS8bSrBbGjg jVJPDWbciUP02GVcQHNPeBcVM+i7PFXs2a1H46i0NYOYkk8uEmWono2tnULMJSaLSPXQ XXLCZ2QPMi8dVReElzM/hewrpAdwhqcIW7j855D3m0h7Gk9ptwoxp8KZJWrlN5HfUcwK gT7Ep6/PcZf0FiB/SspbrzF2EJvzEMubW9FLkh65dosigrOC11T10cSs1j+fHQCzVmSW vVHw== X-Received: by 10.180.74.238 with SMTP id x14mr13035974wiv.81.1428840555763; Sun, 12 Apr 2015 05:09:15 -0700 (PDT) Original-Received: by 10.27.52.194 with HTTP; Sun, 12 Apr 2015 05:09:15 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22e X-Mailman-Approved-At: Sun, 12 Apr 2015 09:19:54 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185335 Archived-At: Hello. I think a major part of the problem here is that package-initialize does a lot more things than it needs to. All that has to happen before the user init file is loaded is to load the autoload files from ~/.emacs.d/elpa/. Everything else can happen on demand or after the init file is loaded, because it is not necessary to make packages available. If package.el provided some sort of (package-load-directory DIR), and ran that on ~/.emacs.d/elpa/, that should fix most use cases already: > - package-enable-at-startup: Would be equivalent to the proposed > environment variable. That's usually set when the user runs package-initialize manually, but if the user does not want to enable packages at startup, they can simply not have anything in ~/.emacs.d/elpa/. > - package-load-list: Needs to be configured before. If the user does not want to enable certain packages, they can move them out of ~/.emacs.d/elpa/. If necessary, they can move the packages into, say, ~/.emacs.d/held/ and run (package-load-directory "~/.emacs.d/held") after configuring this variable. > - package-archives: Needs to be configured before for > non-interactive package installation. > - package-pinned-packages: Needs to be configured before for > non-interactive package installation. > - package-check-signature and package-unsigned-archives: Can be > customized afterwards > - package-directory-list: Needs to be configured before. These are all only relevant for package installation, not for package initialization. The user can configure them before installing packages in their init file, if desired. > - package-user-dir: Needs to be configured before. In the new approach, changing this only means the new directory is not loaded before the user init file is loaded. The user can simply do this manually using (package-load-directory NEW-DIR) when they need the new packages, which more or less replicates the current setup of requiring a package-initialize before packages become available, but arguable more obvious as the user has to set the variable in their init file already. That is, Emacs just needs to adjust the load-path and load auto-loads for the default location before the user init file is run to solve the original problem of user confusion. None of the config options are necessary for this, so the race condition that caused the original desire of not running package-initialize before the user init file is gone. The user can set the config options as necessary in their init file while simply using packages as expected. Regards, Jorgen