Mercurial > hg > xemacs-beta
comparison lisp/subr.el @ 4463:5c651a4e8ed3
Fix add-to-list.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Wed, 14 May 2008 21:54:54 -0700 |
parents | 34b42224a066 |
children | c4fd85dd95bd |
comparison
equal
deleted
inserted
replaced
4462:34b42224a066 | 4463:5c651a4e8ed3 |
---|---|
400 If you want to use `add-to-list' on a variable that is not defined | 400 If you want to use `add-to-list' on a variable that is not defined |
401 until a certain package is loaded, you should put the call to `add-to-list' | 401 until a certain package is loaded, you should put the call to `add-to-list' |
402 into a hook function that will be run only after loading the package. | 402 into a hook function that will be run only after loading the package. |
403 `eval-after-load' provides one way to do this. In some cases | 403 `eval-after-load' provides one way to do this. In some cases |
404 other hooks, such as major mode hooks, can do the job." | 404 other hooks, such as major mode hooks, can do the job." |
405 (if (member* (member* element (symbol-value list-var) | 405 (if (member* element (symbol-value list-var) :test (or compare-fn #'equal)) |
406 :test (or compare-fn #'equal))) | |
407 (symbol-value list-var) | 406 (symbol-value list-var) |
408 (set list-var | 407 (set list-var |
409 (if append | 408 (if append |
410 (append (symbol-value list-var) (list element)) | 409 (append (symbol-value list-var) (list element)) |
411 (cons element (symbol-value list-var)))))) | 410 (cons element (symbol-value list-var)))))) |