summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2018-03-20 06:59:02 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2018-03-20 06:59:02 +0100
commit81debb519f7c448b7a5acea21fdb46eaaffe0afa (patch)
tree81cb81b1a0ab9fb095e4acabf5f21a0c925e0088
parentb3223f6fcc171b098cf1fdd1108850b7d8b69184 (diff)
downloaddotfiles-81debb519f7c448b7a5acea21fdb46eaaffe0afa.tar.xz
Stop calling package-initialize in version 27
To prevent Emacs from modifying a user's init file behind their back, the developers have decided that: - by default, Emacs will call package-initialize before loading the user's init file (thereby ensuring that out-of-the-box, when Emacs starts, it activates packages installed in a previous session); - the user can disable packages (among other things) using a new, "early-init" file that will be read before package management kicks in. This has been committed to Emacs's master branch, so versions up to 26 still need to call package-initialize. While in there, tuck package-archives in the Custom file. Hopefully in a few years I can remove all this package cruft from my init file.
-rw-r--r--.emacs8
-rw-r--r--.emacs-custom.el4
2 files changed, 9 insertions, 3 deletions
diff --git a/.emacs b/.emacs
index b7a9eb4..ab0e3e1 100644
--- a/.emacs
+++ b/.emacs
@@ -7,9 +7,11 @@
;; resets global-page-break-lines-mode to nil. Cue Custom shrugging,
;; "changed outside Customize".
-(require 'package)
-(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
-(package-initialize)
+;; NB: starting from Emacs 27, package-initialize is automatically
+;; called before loading the user's init file, unless
+;; package-enable-at-startup is set to nil in the early init file.
+(when (version< emacs-version "27")
+ (package-initialize))
(setq custom-file "~/.emacs-custom.el")
(load custom-file)
diff --git a/.emacs-custom.el b/.emacs-custom.el
index 04494cd..734cdcc 100644
--- a/.emacs-custom.el
+++ b/.emacs-custom.el
@@ -43,6 +43,10 @@
'(markdown-enable-math t)
'(markdown-header-scaling t)
'(menu-bar-mode nil)
+ '(package-archives
+ (quote
+ (("melpa" . "https://melpa.org/packages/")
+ ("gnu" . "http://elpa.gnu.org/packages/"))))
'(package-selected-packages
(quote
(rg delight paradox flycheck magit markdown-mode page-break-lines rust-mode wgrep)))