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:
parent
e4322fac7a
commit
ecbd4b7567
1 changed files with 5 additions and 6 deletions
|
@ -272,14 +272,13 @@ See `if!' for details on this macro's purpose."
|
|||
(defmacro setq! (&rest settings)
|
||||
"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
|
||||
property in its `defcustom' declaration). This trigger setters. `setq' does
|
||||
not."
|
||||
This can be used as a drop-in replacement for `setq'. Particularly when you know
|
||||
a variable has a custom setter (a :set property in its `defcustom' declaration).
|
||||
This triggers setters. `setq' does not."
|
||||
(macroexp-progn
|
||||
(cl-loop for (var val) on settings by 'cddr
|
||||
collect (list (or (get var 'custom-set) #'set)
|
||||
(list 'quote var)
|
||||
val))))
|
||||
collect `(funcall (or (get ',var 'custom-set) #'set)
|
||||
',var ,val))))
|
||||
|
||||
(defmacro delq! (elt list &optional fetcher)
|
||||
"`delq' ELT from LIST in-place.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue