From: Kim F. Storm Date: Sun, 22 Oct 2006 22:37:51 +0000 (+0000) Subject: (add-to-list): Fix last change--optimize for no compare-fn. X-Git-Tag: emacs-pretest-22.0.90~39 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=78bdfbf32065948bb4474cb24228fc0fa934f656;p=emacs.git (add-to-list): Fix last change--optimize for no compare-fn. --- diff --git a/lisp/subr.el b/lisp/subr.el index 957d098703f..43ecfd56108 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1101,18 +1101,18 @@ 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." (if (cond + ((null compare-fn) + (member element (symbol-value list-var))) ((eq compare-fn 'eq) (memq element (symbol-value list-var))) ((eq compare-fn 'eql) (memql element (symbol-value list-var))) - (compare-fn + (t (let (present) (dolist (elt (symbol-value list-var)) (if (funcall compare-fn element elt) (setq present t))) - present)) - (t - (member element (symbol-value list-var)))) + present))) (symbol-value list-var) (set list-var (if append