From 8851c1f036e2b666185f9e803498e24d4a62c148 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 14 Oct 1994 23:50:35 +0000 Subject: [PATCH] (add-to-list): Doc fix. --- lisp/subr.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/subr.el b/lisp/subr.el index 7c0ae0cb914..b623658e8df 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -712,7 +712,12 @@ To make a hook variable buffer-local, always use (set-default hook hook-value))))) (defun add-to-list (list-var element) - "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet." + "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet. +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." (or (member element (symbol-value list-var)) (set list-var (cons element (symbol-value list-var))))) -- 2.39.5