aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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,