# HG changeset patch # User David Kastrup # Date 1162248544 0 # Node ID 3f351640d09fa312c4f721e31abfee8a1e88af60 # Parent d092f1092ef0efbdc296ae2cba51aaa4d3c58317 (add-to-list): Don't continue checking if a match has been found. diff -r d092f1092ef0 -r 3f351640d09f lisp/ChangeLog --- a/lisp/ChangeLog Mon Oct 30 22:15:21 2006 +0000 +++ b/lisp/ChangeLog Mon Oct 30 22:49:04 2006 +0000 @@ -1,3 +1,8 @@ +2006-10-30 David Kastrup + + * subr.el (add-to-list): Don't continue checking if a match has + been found. + 2006-10-30 Chong Yidong * tutorial.el: Move defvars to avoid bytecomp warnings. diff -r d092f1092ef0 -r 3f351640d09f lisp/subr.el --- a/lisp/subr.el Mon Oct 30 22:15:21 2006 +0000 +++ b/lisp/subr.el Mon Oct 30 22:49:04 2006 +0000 @@ -1108,11 +1108,11 @@ ((eq compare-fn 'eql) (memql element (symbol-value list-var))) (t - (let (present) - (dolist (elt (symbol-value list-var)) - (if (funcall compare-fn element elt) - (setq present t))) - present))) + (let ((lst (symbol-value list-var))) + (while (and lst + (not (funcall compare-fn element (car lst)))) + (setq lst (cdr lst))) + lst))) (symbol-value list-var) (set list-var (if append