earlier than the normal init file is processed. Such customizations
can be put in the early init file, @file{~/.emacs.d/early-init.el}.
This file is loaded before the package system is initialized, so in it
-you can customize variables that affect the initialization process,
-such as @code{package-enable-at-startup} and @code{package-load-list}.
-@xref{Package Installation}.
+you can customize variables that affect the package initialization
+process, such as @code{package-enable-at-startup},
+@code{package-load-list}, and @code{package-user-dir}. Note that
+variables like @code{package-archives} which only affect the
+installation of new packages, and not the process of making
+already-installed packages available, may be customized in the regular
+init file. @xref{Package Installation}.
For more information on the early init file, @pxref{Init File,,,
elisp, The Emacs Lisp Reference Manual}.
;;; Customization options
;;;###autoload
(defcustom package-enable-at-startup t
- "Whether to activate installed packages when Emacs starts.
-If non-nil, packages are activated after reading the init file
-and before `after-init-hook'. Activation is not done if
-`user-init-file' is nil (e.g. Emacs was started with \"-q\").
+ "Whether to make installed packages available when Emacs starts.
+If non-nil, packages are made available before reading the init
+file (but after reading the early init file). This means that if
+you wish to set this variable, you must do so in the early init
+file. Regardless of the value of this variable, packages are not
+made available if `user-init-file' is nil (e.g. Emacs was started
+with \"-q\").
Even if the value is nil, you can type \\[package-initialize] to
-activate the package system at any time."
+make installed packages available at any time, or you can
+call (package-initialize) in your init-file."
:type 'boolean
:version "24.1")
(defcustom package-load-list '(all)
- "List of packages for `package-initialize' to load.
+ "List of packages for `package-initialize' to make available.
Each element in this list should be a list (NAME VERSION), or the
-symbol `all'. The symbol `all' says to load the latest installed
-versions of all packages not specified by other elements.
+symbol `all'. The symbol `all' says to make available the latest
+installed versions of all packages not specified by other
+elements.
For an element (NAME VERSION), NAME is a package name (a symbol).
VERSION should be t, a string, or nil.
-If VERSION is t, the most recent version is activated.
-If VERSION is a string, only that version is ever loaded.
+If VERSION is t, the most recent version is made available.
+If VERSION is a string, only that version is ever made available.
Any other version, even if newer, is silently ignored.
Hence, the package is \"held\" at that version.
-If VERSION is nil, the package is not loaded (it is \"disabled\")."
+If VERSION is nil, the package is not made available (it is \"disabled\")."
:type '(repeat (choice (const all)
(list :tag "Specific package"
(symbol :tag "Package name")
If called as part of loading `user-init-file', set
`package-enable-at-startup' to nil, to prevent accidentally
loading packages twice.
+
It is not necessary to adjust `load-path' or `require' the
individual packages after calling `package-initialize' -- this is
-taken care of by `package-initialize'."
+taken care of by `package-initialize'.
+
+If `package-initialize' is called twice during Emacs startup,
+signal a warning, since this is a bad idea except in highly
+advanced use cases. To suppress the warning, remove the
+superfluous call to `package-initialize' from your init-file. If
+you have code which must run before `package-initialize', put
+that code in the early init-file."
(interactive)
+ (when (and package--initialized (not after-init-time))
+ (lwarn '(package reinitialization) :warning
+ "Unnecessary call to `package-initialize' in init file"))
(setq package-alist nil)
(setq package-enable-at-startup nil)
(package-load-all-descriptors)
(and command-line-args
(setcdr command-line-args args)))
+ ;; Re-evaluate predefined variables whose initial value depends on
+ ;; the runtime context.
+ (let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
+ (mapc 'custom-reevaluate-setting
+ ;; Initialize them in the same order they were loaded, in case there
+ ;; are dependencies between them.
+ (prog1 (nreverse custom-delayed-init-variables)
+ (setq custom-delayed-init-variables nil))))
+
;; Warn for invalid user name.
(when init-file-user
(if (string-match "[~/:\n]" init-file-user)
(startup--setup-quote-display)
(setq internal--text-quoting-flag t))
- ;; Re-evaluate predefined variables whose initial value depends on
- ;; the runtime context.
- (let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
- (mapc 'custom-reevaluate-setting
- ;; Initialize them in the same order they were loaded, in case there
- ;; are dependencies between them.
- (prog1 (nreverse custom-delayed-init-variables)
- (setq custom-delayed-init-variables nil))))
-
(normal-erase-is-backspace-setup-frame)
;; Register default TTY colors for the case the terminal hasn't a