core: tweak a bit add-toggle macro
Add message in the echo area Slightly improve the doc string
This commit is contained in:
parent
c9ea837130
commit
b568f0b3ea
|
@ -18,6 +18,11 @@ property list (name :func FUNCTION :doc STRING :key STRING).")
|
||||||
(defmacro spacemacs|add-toggle (name &rest props)
|
(defmacro spacemacs|add-toggle (name &rest props)
|
||||||
"Add a toggle with NAME symbol.
|
"Add a toggle with NAME symbol.
|
||||||
|
|
||||||
|
This macro creates the following functions:
|
||||||
|
- spacemacs/toggle-NAME switches on or off depending on the current state
|
||||||
|
- spacemacs/toggle-NAME-on only switches on if currently disabled
|
||||||
|
- spacemacs/toggle-NAME-off only switches off if currently enabled
|
||||||
|
|
||||||
Avaiblabe PROPS:
|
Avaiblabe PROPS:
|
||||||
|
|
||||||
`:status EXPRESSION'
|
`:status EXPRESSION'
|
||||||
|
@ -65,7 +70,11 @@ used."
|
||||||
(and (or (and (symbolp ',condition) (boundp ',condition))
|
(and (or (and (symbolp ',condition) (boundp ',condition))
|
||||||
(listp ',condition))
|
(listp ',condition))
|
||||||
,condition))
|
,condition))
|
||||||
(if ,status-eval (progn ,@off-body) ,@on-body)
|
(if ,status-eval
|
||||||
|
(progn ,@off-body
|
||||||
|
(message ,(format "%s disabled." name)))
|
||||||
|
,@on-body
|
||||||
|
(message ,(format "%s enabled." name)))
|
||||||
(message "This toggle is not supported.")))
|
(message "This toggle is not supported.")))
|
||||||
;; on-function
|
;; on-function
|
||||||
(defun ,wrapper-func-on ()
|
(defun ,wrapper-func-on ()
|
||||||
|
|
Loading…
Reference in New Issue