Emacs: Install Package from ELPA
Starting with emacs 24 (year 2012), it comes with a package system called ELPA (Emacs Lisp Package Archive). It lets you install and manage emacs packages. [see Emacs 24 (Released 2012-06)]
Add Package Repository
put this in your Emacs Init File:
(when (>= emacs-major-version 24) (progn ;; load emacs 24's package system. Add MELPA repository. (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)) (when (< emacs-major-version 27) (package-initialize)))
Install a Package
If you know the name of the package:
(package-install 'xah-fly-keys )
[see Emacs: Evaluate Elisp Code]
If you don't know the name of the package:
- Find the package you want, move cursor to the line, press Enter. A description pane will pop up.
- Put cursor on the pane, press Tab to move cursor to the “Install” button then press Enter.
- The package is now installed.
- Read the package doc to see what command to start it, if necessary. (no restart is needed)
This list is shown in
package-menu-mode. In this mode, here's the most useful keys:
- Enter (
- Describe the package under cursor.
- i (
- Mark for installation.
- u (
- d (
- Mark for deletion (removal of a installed package).
- x (
- For “execute” (start install/uninstall of marked items).
- r (
- Refresh the list from server.
(For complete list of keys,
To upgrade packages, just press U x.
- For any package that has a new version, the installed one will be marked “D” (for delete), and new one will be marked “I” (to install).
- Run the marked commands on packages.
WARNING: package upgrade may not be reliable. It is better to upgrade one package at a time. Or, just delete the package, then install the latest.
packages are installed at
You can go to that directory, open the package you are interested, and read the file header doc.
If you want to remove all external packages, you can delete this entire directory and restart emacs. It is harmless to do so.
The source of the packages are from package servers. There are several.
- FSF's GNU Emacs package repository. This repository contains package copyrighted by Free Software Foundation.
- Non-GNU repository maintained by FSF.
- MELPA (Milkypostman's Emacs Lisp Package Archive). Emacs community maintained repo. As of 2022-06-08, MELPA has most packages, and updated daily.
- By default, this is t (true).
- This determines which packages should be loaded at start-up.
[see Emacs: Show Variable Value, List Variables]
history of emacs package.el
The ELPA (aka package.el)
emacs package system, is started by Tom Tromey.
Marmalade repo (defunct) is started by
MELPA is started by Donald Ephraim Curtis
Thank you guys.