Why does add-hook allow "hook" to be invalid?

From C-h f add-hook:

HOOK should be a symbol, and FUNCTION may be any valid function.  If
HOOK is void, it is first set to nil.  If HOOK value is a single
function, it is changed to a list of functions.

and from the code:

(defun add-hook (hook function &optional append local)
  ...
  (or (boundp hook) (set hook nil))
  (or (default-boundp hook) (set-default hook nil))
  ...

What is this good for? I suppose this is somehow useful, otherwise it won’t ... I just can't come up with a good use for this ...

+3
source share
1 answer

It allows you to set hook variables before the packages that define them have been loaded.

+5
source

All Articles