Introduce autodefs to replace some settings

+ :popup -> set-popup-rule!
+ :popups -> set-popup-rules!
+ :company-backend -> set-company-backend!
+ :evil-state -> set-evil-initial-state!

I am slowly phasing out the setting system (def-setting! and set!),
starting with these.

What are autodefs? These are functions that are always defined, whether
or not their respective modules are enabled. However, when their modules
are disabled, they are replaced with macros that no-op and don't
waste time evaluating their arguments.

The old set! function will still work, for a while.
This commit is contained in:
Henrik Lissner 2018-06-15 02:58:12 +02:00
parent 6693db48af
commit d8b1e469bc
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
54 changed files with 329 additions and 248 deletions

View file

@ -357,7 +357,7 @@ omitted. eg. (featurep! +flag1)"
;;
;; Cross-module configuration
;; Cross-module configuration (DEPRECATED)
;;
;; I needed a way to reliably cross-configure modules without littering my
@ -375,8 +375,16 @@ Do not use this for configuring Doom core."
(declare (indent defun) (doc-string 3))
(or (keywordp keyword)
(signal 'wrong-type-argument (list 'keywordp keyword)))
`(fset ',(intern (format "doom--set%s" keyword))
(lambda ,arglist ,docstring ,@forms)))
(let ((alias (plist-get forms :obsolete)))
(when alias
(setq forms (plist-put forms :obsolete 'nil)))
`(fset ',(intern (format "doom--set%s" keyword))
(lambda ,arglist ,docstring
(prog1 (progn ,@forms)
,(when alias
`(unless noninteractive
(message ,(format "The `%s' setting is deprecated, use `%s' instead"
keyword alias)))))))))
(defmacro set! (keyword &rest values)
"Set an option defined by `def-setting!'. Skip if doesn't exist. See