add-to-list is a compiled Lisp function in `subr.el'.

(add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)

This function has a compiler macro `add-to-list--anon-cmacro'.

Add ELEMENT to the value of LIST-VAR if it isn't there yet.
The test for presence of ELEMENT is done with `equal', or with
COMPARE-FN if that's non-nil.
If ELEMENT is added, it is added at the beginning of the list,
unless the optional argument APPEND is non-nil, in which case
ELEMENT is added at the end.

The return value is the new value of LIST-VAR.

This is handy to add some elements to configuration variables,
but please do not abuse it in Elisp code, where you are usually
better off using `push' or `cl-pushnew'.

If you want to use `add-to-list' on a variable that is not
defined until a certain package is loaded, you should put the
call to `add-to-list' into a hook function that will be run only
after loading the package. `eval-after-load' provides one way to
do this. In some cases other hooks, such as major mode hooks,
can do the job.