mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Fix setq! not triggering setters
Because the setters were looked up at expansion/compile time (much, much too early), rather than at runtime. This should indirectly fix "No year zero" errors for org-journal users (#3173).
This commit is contained in:
@ -272,14 +272,13 @@ See `if!' for details on this macro's purpose."
|
|||||||
(defmacro setq! (&rest settings)
|
(defmacro setq! (&rest settings)
|
||||||
"A stripped-down `customize-set-variable' with the syntax of `setq'.
|
"A stripped-down `customize-set-variable' with the syntax of `setq'.
|
||||||
|
|
||||||
Use this instead of `setq' when you know a variable has a custom setter (a :set
|
This can be used as a drop-in replacement for `setq'. Particularly when you know
|
||||||
property in its `defcustom' declaration). This trigger setters. `setq' does
|
a variable has a custom setter (a :set property in its `defcustom' declaration).
|
||||||
not."
|
This triggers setters. `setq' does not."
|
||||||
(macroexp-progn
|
(macroexp-progn
|
||||||
(cl-loop for (var val) on settings by 'cddr
|
(cl-loop for (var val) on settings by 'cddr
|
||||||
collect (list (or (get var 'custom-set) #'set)
|
collect `(funcall (or (get ',var 'custom-set) #'set)
|
||||||
(list 'quote var)
|
',var ,val))))
|
||||||
val))))
|
|
||||||
|
|
||||||
(defmacro delq! (elt list &optional fetcher)
|
(defmacro delq! (elt list &optional fetcher)
|
||||||
"`delq' ELT from LIST in-place.
|
"`delq' ELT from LIST in-place.
|
||||||
|
Reference in New Issue
Block a user