doom-def-setting => def-setting!

This commit is contained in:
Henrik Lissner 2017-02-04 21:09:33 -05:00
parent 7703fc56f4
commit 5549e141a7
3 changed files with 44 additions and 45 deletions

View file

@ -36,13 +36,8 @@
map) map)
"Active keymap in popup windows.") "Active keymap in popup windows.")
(def-setting! :popup (&rest rule)
;; "Prepend a new popup rule to `shackle-rules'."
;; Bootstrap
;;
(doom-def-setting :popup
(lambda (&rest rule)
(let ((pattern (car rule)) (let ((pattern (car rule))
(plist (cdr rule))) (plist (cdr rule)))
;; Align popups by default (error if this doesn't happen) ;; Align popups by default (error if this doesn't happen)
@ -53,7 +48,11 @@
(plist-member plist :noselect)) (plist-member plist :noselect))
(plist-put plist :select t)) (plist-put plist :select t))
(push (cons pattern plist) shackle-rules))) (push (cons pattern plist) shackle-rules)))
"Prepend a new popup rule to `shackle-rules'.")
;;
;; Bootstrap
;;
(package! shackle :demand t (package! shackle :demand t
:init :init
@ -80,6 +79,7 @@
("*Messages*" :size 10) ("*Messages*" :size 10)
("*Warnings*" :size 10 :noselect t) ("*Warnings*" :size 10 :noselect t)
("*command-log*" :size 28 :noselect t :align right) ("*command-log*" :size 28 :noselect t :align right)
("*Shell Command Output*" :size 20 :noselect t)
(compilation-mode :size 15 :noselect t :noesc t) (compilation-mode :size 15 :noselect t :noesc t)
(ivy-occur-grep-mode :size 25 :noesc t) (ivy-occur-grep-mode :size 25 :noesc t)
(eww-mode :size 30) (eww-mode :size 30)

View file

@ -9,19 +9,18 @@
"An alist of settings, mapping setting keywords to setter functions, which can "An alist of settings, mapping setting keywords to setter functions, which can
be a lambda or symbol.") be a lambda or symbol.")
(defun doom-def-setting (keyword setter-fn &optional docstring) (defmacro def-setting! (keyword arglist &optional docstring &rest forms)
"Define a setting macro. Takes the same arguments as `defmacro'. This should "Define a setting macro. Takes the same arguments as `defmacro'. This should
return forms, which will be run when `set!' is used to call this setting." return forms, which will be run when `set!' is used to call this setting."
(declare (indent defun)) (declare (indent defun) (doc-string 3))
(unless (keywordp keyword) (unless (keywordp keyword)
(error "Not a valid property name: %s" keyword)) (error "Not a valid property name: %s" keyword))
(unless (or (symbolp setter-fn) `(push (list ,keyword
(functionp setter-fn)) :source ,(__FILE__)
(error "Not a valid setting function for %s" keyword)) :docstring ,docstring
(push (list keyword :fn (lambda ,arglist
:source load-file-name ,docstring
:docstring docstring ,@forms))
:fn setter-fn)
doom-settings)) doom-settings))
(defmacro set! (keyword &rest rest) (defmacro set! (keyword &rest rest)

View file

@ -9,15 +9,15 @@
(defvar +evil-localleader "\\" (defvar +evil-localleader "\\"
"The <localleader> key, used by the `map!' macro for :localleader bindings.") "The <localleader> key, used by the `map!' macro for :localleader bindings.")
(def-setting! :evil-state (mode state)
"Set the initialize STATE of MODE using `evil-set-initial-state'."
(evil-set-initial-state mode state))
;; ;;
;; evil-mode ;; evil-mode
;; ;;
(doom-def-setting :evil-state
'evil-set-initial-state
"Set the initialize STATE of MODE using `evil-set-initial-state'.")
(use-package! evil :demand t (use-package! evil :demand t
:init :init
(setq evil-want-C-u-scroll t (setq evil-want-C-u-scroll t