Elisp: provide, require, features

By Xah Lee. Date: . Last updated: .

The purpose of emacs “features” is for emacs to know if a package is already loaded.

A global variable. Its value is a list of Symbols, each symbol represent a emacs “feature” that's been loaded.
(provide symbol)
Add symbol to the features list.
(require symbol &optional FILENAME NOERROR)
Checks if symbol is in variable features. If not, call load to load it. File name is guessed from symbol, or specified in the optional argument. This function are used in elisp libraries or scripts, similar to other language's “import”.

here's sample value of features:

emacs features 2020-12-07 gXj4f
emacs features 2020-12-07

emacs package system

Emacs lisp, writing a major mode. Essentials