How to Install Emacs Package Manually

By Xah Lee. Date: . Last updated: .

This page is a tutorial on how to install emacs packages manually.

There are hundreds of useful emacs packages on the web that are not bundled with emacs. Often, there is no install instruction included, and you may notice that each's installation methods seem to differ wildly. The following gives a overview on how emacs package are installed.

Load the File

Load the File Manually

Suppose you downloaded a simple emacs package on the web named “xyz.el”. To use the package, all you have to do is to make emacs load the file.

Load File at Startup

If you want emacs to load the file when it starts, put the file in the dir ~/.emacs.d/lisp/, (create that directory if it doesn't exist.) then put the following in your emacs init file:

(add-to-list 'load-path (concat user-emacs-directory "lisp/" ))

(load "xyz") ;; best not to include the ending “.el” or “.elc”

Byte Compile

Emacs: Byte Compile Elisp Files

Auto Activate Mode When Opening File

This is usually setup by the package, but not always. Here's the basics:

(add-to-list 'auto-mode-alist '("\\.el\\'" . xah-elisp-mode))

For detail, see: Emacs: Set Default Major Mode.

Mode Documentation

Emacs mode usually comes with doc string. To view it, first activate the mode (Alt+x mode_name). Once in the mode, Alt+x describe-mode. Emacs will show its doc string.

Robust modes usually have graphical menus too. So, activate the mode, then you can check what menu commands it has in the menu bar.

Sometimes, a mode comes with complete documentation in info format (file with suffix “.info”). To read the info, type Ctrl+u Alt+x info then type the info file's name.

What is the difference between {load-file, load, autoload, require}?

See: Emacs Lisp's Library System.

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial

Emacs Init

Init Basics

Keys

Font

Text Editing

Completion

File

Restore Things

Backup/AutoSave

Line

Appearance

Misc

Advanced Init Tips

packages