Add doom/describe-{setting,module}

This commit is contained in:
Henrik Lissner 2017-05-27 14:31:08 +02:00
parent 4ea176d04d
commit db6de01b16
2 changed files with 44 additions and 3 deletions

View file

@ -205,15 +205,19 @@ Body forms can access the hook's arguments through the let-bound variable
;; concise, do-what-I-mean front-facing configuration, believe it or not.
;;
;; Plus, it can benefit from byte-compilation.
(defvar doom-settings nil)
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)
"Define a setting macro. Like `defmacro', this should return a form to be
executed when called with `set!'. FORMS are not evaluated until `set!' calls it."
(declare (indent defun) (doc-string 3))
(unless (keywordp keyword)
(error "Not a valid property name: %s" keyword))
`(defun ,(intern (format "doom-setting--setter%s" keyword)) ,arglist
,docstring
,@forms))
`(progn
(defun ,(intern (format "doom-setting--setter%s" keyword)) ,arglist
,docstring
,@forms)
(cl-pushnew ,keyword doom-settings)))
(defmacro set! (keyword &rest values)
"Set an option defined by `def-setting!'. Skip if doesn't exist."