Make sure you have a local directory where you put elisp files. I use ~/elisp, for example.
Make sure this directory is listed in your
‘load-path’ variable. I use the following statement in my ~/.emacs file to make sure it is:
(add-to-list 'load-path "~/elisp")
XEmacs documentation (21.4 (patch 14)) for load-path says: “Note that the elements of this list may not begin with ‘~’, so you must call
expand-file-name on them before adding them to this list.” So, for XEmacs, the above should be:
(add-to-list 'load-path (expand-file-name "~/elisp"))
You can read more about the
‘load-path’ at LoadPath. You can also add the needed paths to the
EMACSLOADPATH environment variable, if you prefer.
If the code in the elisp file is supposed to be a mode for files whose names match a pattern, see AutoModeAlist. If the code in the elisp file is supposed to be a mode for files who are run by certain interpreters, see InterpreterModeAlist.
For bigger packages such as Gnus or BBDB, you usually install them somewhere, run ./configure; make; make install and then figure out where the package got installed. Then add that directory to your load-path.
Some packages can be run uncompiled. In that case, just unpack them, and add the corresponding directory to your load-path.
(add-to-list 'load-path "/home/alex/src/erc") (require 'erc-auto) (autoload 'erc "erc")
This requires some knowledge about the package, of course. In the above case, for example, I knew that erc-auto defines lots of autoloads, but does not autoload erc itself (use erc-select to connect to network)…
Some packages exist whose only purpose is to update another single package: