comparison lisp/subr.el @ 21409:3e8b7782f4f5

(add-to-list): Always return updated value of LIST-VAR.
author Karl Heuer <kwzh@gnu.org>
date Tue, 07 Apr 1998 18:22:28 +0000
parents e917eb0d4e01
children 6175866e1b71
comparison
equal deleted inserted replaced
21408:c284604287f3 21409:3e8b7782f4f5
662 If you want to use `add-to-list' on a variable that is not defined 662 If you want to use `add-to-list' on a variable that is not defined
663 until a certain package is loaded, you should put the call to `add-to-list' 663 until a certain package is loaded, you should put the call to `add-to-list'
664 into a hook function that will be run only after loading the package. 664 into a hook function that will be run only after loading the package.
665 `eval-after-load' provides one way to do this. In some cases 665 `eval-after-load' provides one way to do this. In some cases
666 other hooks, such as major mode hooks, can do the job." 666 other hooks, such as major mode hooks, can do the job."
667 (or (member element (symbol-value list-var)) 667 (if (member element (symbol-value list-var))
668 (set list-var (cons element (symbol-value list-var))))) 668 (symbol-value list-var)
669 (set list-var (cons element (symbol-value list-var)))))
669 670
670 ;;;; Specifying things to do after certain files are loaded. 671 ;;;; Specifying things to do after certain files are loaded.
671 672
672 (defun eval-after-load (file form) 673 (defun eval-after-load (file form)
673 "Arrange that, if FILE is ever loaded, FORM will be run at that time. 674 "Arrange that, if FILE is ever loaded, FORM will be run at that time.