From b742bf086ff42bca3f93f4282e753fa478efad7b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 21 Jul 2019 14:39:16 +0200 Subject: [PATCH] core-lib: add prependq! and appendq! macros --- core/core-lib.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/core-lib.el b/core/core-lib.el index 70fee039f..87e03067a 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -180,6 +180,14 @@ The order VALUES is preserved." `(dolist (--value-- (nreverse (list ,@values))) (cl-pushnew --value-- ,place))) +(defmacro prependq! (sym &rest lists) + "Prepend LISTS to SYM in place." + `(setq ,sym (append (list ,@lists) ,sym))) + +(defmacro appendq! (sym &rest lists) + "Append LISTS to SYM in place." + `(setq ,sym (append ,sym ,@lists))) + (defmacro delq! (elt list &optional fetcher) "Delete ELT from LIST in-place." `(setq ,list