Function: package-initialize

package-initialize is an autoloaded, interactive and byte-compiled function defined in package.el.gz.

Signature

(package-initialize &optional NO-ACTIVATE)

Documentation

Load Emacs Lisp packages, and activate them.

The variable package-load-list controls which packages to load. If optional arg NO-ACTIVATE is non-nil, don't activate packages.

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.

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.

View in manual

Probably introduced at or before Emacs version 25.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
;;;###autoload
(defun package-initialize (&optional no-activate)
  "Load Emacs Lisp packages, and activate them.
The variable `package-load-list' controls which packages to load.
If optional arg NO-ACTIVATE is non-nil, don't activate packages.

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'.

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)
  (package-load-all-descriptors)
  (package-read-all-archive-contents)
  (setq package--initialized t)
  (unless no-activate
    (package-activate-all))
  ;; This uses `package--mapc' so it must be called after
  ;; `package--initialized' is t.
  (package--build-compatibility-table))