# HG changeset patch # User Gerd Moellmann # Date 964728527 0 # Node ID 6165183bc490b20119d4ced5c43839daa2ae3bb5 # Parent 42bf9adb59a3bc3186b7d6348bc6fe87d8c3a82a (remove, remq): New functions. diff -r 42bf9adb59a3 -r 6165183bc490 lisp/subr.el --- a/lisp/subr.el Thu Jul 27 20:07:12 2000 +0000 +++ b/lisp/subr.el Thu Jul 27 20:08:47 2000 +0000 @@ -135,6 +135,22 @@ (setq x (cdr x))) x)) +(defun remove (elt seq) + "Return a copy of SEQ with all occurences of ELT removed. +SEQ must be a list, vector, or string. The comparison is done with `equal'." + (if (nlistp seq) + ;; If SEQ isn't a list, there's no need to copy SEQ because + ;; `delete' will return a new object. + (delete elt seq) + (delete elt (copy-sequence seq)))) + +(defun remq (elt list) + "Return a copy of LIST with all occurences of ELT removed. +The comparison is done with `eq'." + (if (memq elt list) + (delq elt (copy-sequence list)) + list)) + (defun assoc-default (key alist &optional test default) "Find object KEY in a pseudo-alist ALIST. ALIST is a list of conses or objects. Each element (or the element's car,