Function: package-activate

package-activate is a byte-compiled function defined in package.el.gz.

Signature

(package-activate PACKAGE &optional FORCE)

Documentation

Activate the package named PACKAGE.

If FORCE is true, (re-)activate it if it's already activated. Newer versions are always activated, regardless of FORCE.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
;; This function activates a newer version of a package if an older
;; one was already activated.  It also loads a features of this
;; package which were already loaded.
(defun package-activate (package &optional force)
  "Activate the package named PACKAGE.
If FORCE is true, (re-)activate it if it's already activated.
Newer versions are always activated, regardless of FORCE."
  (let ((pkg-desc (package--get-activatable-pkg package)))
    (cond
     ;; If no such package is found, maybe it's built-in.
     ((null pkg-desc)
      (package-built-in-p package))
     ;; If the package is already activated, just return t.
     ((and (memq package package-activated-list) (not force))
      t)
     ;; Otherwise, proceed with activation.
     (t (package-activate-1 pkg-desc nil 'deps)))))