core-lib: add pushmany! macro, refactor pushnew!
This commit is contained in:
parent
0a84d2f0a9
commit
e8ecf65cf9
1 changed files with 12 additions and 4 deletions
|
@ -284,10 +284,18 @@ MATCH is a string regexp. Only entries that match it will be included."
|
||||||
(directory-file-name (file-name-directory path))))
|
(directory-file-name (file-name-directory path))))
|
||||||
|
|
||||||
(defmacro pushnew! (place &rest values)
|
(defmacro pushnew! (place &rest values)
|
||||||
"Like `cl-pushnew', but will prepend VALUES to PLACE.
|
"Push VALUES sequentially into PLACE, if they aren't already present.
|
||||||
The order VALUES is preserved."
|
This is a variadic `cl-pushnew'."
|
||||||
`(dolist (--x-- (list ,@(nreverse values)))
|
(let ((var (make-symbol "result")))
|
||||||
(cl-pushnew --x-- ,place)))
|
`(dolist (,var (list ,@values))
|
||||||
|
(cl-pushnew ,var ,place))))
|
||||||
|
|
||||||
|
(defmacro pushmany! (place &rest values)
|
||||||
|
"Push VALUES sequentually into PLACE.
|
||||||
|
This is a variadic `push'."
|
||||||
|
(let ((var (make-symbol "result")))
|
||||||
|
`(dolist (,var ,values)
|
||||||
|
(push ,var ,place))))
|
||||||
|
|
||||||
(defmacro prependq! (sym &rest lists)
|
(defmacro prependq! (sym &rest lists)
|
||||||
"Prepend LISTS to SYM in place."
|
"Prepend LISTS to SYM in place."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue