Skip to content

Commit

Permalink
Fix package initialization on Emacs 27
Browse files Browse the repository at this point in the history
Before Emacs 27, the init file was responsible for initializing the package
manager by calling `package-initialize'.  Emacs 27 changed the default
behavior: It now calls `package-initialize' before loading the init file.
This behavior would prevent Spacemacs's own package initialization from
running.  However, Emacs 27 also loads the "early init" file (this file)
before it initializes the package manager, and Spacemacs can use this early
init file to prevent Emacs from initializing the package manager.  (See
<http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b>.)

Earlier Emacs versions do not load the early init file and do not initialize
the package manager before loading the init file, so this file is neither
needed nor loaded on those versions.
  • Loading branch information
Miciah authored and syl20bnr committed Feb 25, 2018
1 parent ef36dbb commit 8395465
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions early-init.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
;;; early-init.el --- Spacemacs Early Init File
;;
;; Copyright (c) 2018 Sylvain Benner & Contributors
;;
;; Author: Miciah Dashiel Butler Masters <[email protected]>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;; Before Emacs 27, the init file was responsible for initializing the package
;; manager by calling `package-initialize'. Emacs 27 changed the default
;; behavior: It now calls `package-initialize' before loading the init file.
;; This behavior would prevent Spacemacs's own package initialization from
;; running. However, Emacs 27 also loads the "early init" file (this file)
;; before it initializes the package manager, and Spacemacs can use this early
;; init file to prevent Emacs from initializing the package manager. (See
;; <http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b>.)
;;
;; Earlier Emacs versions do not load the early init file and do not initialize
;; the package manager before loading the init file, so this file is neither
;; needed nor loaded on those versions.
(setq package-enable-at-startup nil)

0 comments on commit 8395465

Please sign in to comment.