aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-07-27 20:08:47 +0000
committerGerd Moellmann2000-07-27 20:08:47 +0000
commit13157efca3a20423a0ea0386b9a23029976d2ab8 (patch)
tree578c95db674aa397f3e580b7298496376200f2bb
parent96ce5c4f18e328e1ad139bf1eb18e1364875ce51 (diff)
downloademacs-13157efca3a20423a0ea0386b9a23029976d2ab8.tar.gz
emacs-13157efca3a20423a0ea0386b9a23029976d2ab8.zip
(remove, remq): New functions.
-rw-r--r--lisp/subr.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 9bef0025d52..767e2a8cde3 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -135,6 +135,22 @@ If N is bigger than the length of X, return X."
135 (setq x (cdr x))) 135 (setq x (cdr x)))
136 x)) 136 x))
137 137
138(defun remove (elt seq)
139 "Return a copy of SEQ with all occurences of ELT removed.
140SEQ must be a list, vector, or string. The comparison is done with `equal'."
141 (if (nlistp seq)
142 ;; If SEQ isn't a list, there's no need to copy SEQ because
143 ;; `delete' will return a new object.
144 (delete elt seq)
145 (delete elt (copy-sequence seq))))
146
147(defun remq (elt list)
148 "Return a copy of LIST with all occurences of ELT removed.
149The comparison is done with `eq'."
150 (if (memq elt list)
151 (delq elt (copy-sequence list))
152 list))
153
138(defun assoc-default (key alist &optional test default) 154(defun assoc-default (key alist &optional test default)
139 "Find object KEY in a pseudo-alist ALIST. 155 "Find object KEY in a pseudo-alist ALIST.
140ALIST is a list of conses or objects. Each element (or the element's car, 156ALIST is a list of conses or objects. Each element (or the element's car,