Add setq! macro

A convenient alternative to setq where you don't have to care about load
order (no need for after! blocks).
This commit is contained in:
Henrik Lissner 2019-08-27 00:08:22 -04:00
parent aad0b2f842
commit 8cb1fe1874
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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'."