From 8cb1fe187450b94ebfff7f77235695c029144257 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 27 Aug 2019 00:08:22 -0400 Subject: [PATCH] Add setq! macro A convenient alternative to setq where you don't have to care about load order (no need for after! blocks). --- core/core-lib.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/core-lib.el b/core/core-lib.el index e2290bc3d..ed2abf35b 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -164,6 +164,13 @@ at the values with which this function was called." (when-let (path (file!)) (directory-file-name (file-name-directory path)))) +(defmacro setq! (&rest settings) + "A stripped-down `customize-set-variable' with the syntax of `setq'." + (macroexp-progn + (cl-loop for (var val) on settings by 'cddr + collect `(funcall (or (get ',var 'custom-set) #'set) + ',var ,val)))) + (defmacro pushnew! (place &rest values) "Push VALUES sequentially into PLACE, if they aren't already present. This is a variadic `cl-pushnew'."