Skip to content

Commit

Permalink
refactor: refactor some redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
DCsunset committed May 17, 2023
1 parent 62f697b commit 390e287
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions modaled.el
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
;;;###autoload
(defun modaled-set-state (state)
"Set current modaled STATE."
; Do not use let as it only establishes bindings for values
; disable current mode
(message "set state to %s" state)
(when modaled-state
(funcall (modaled--get-state-mode modaled-state) 0))
(when state
Expand Down Expand Up @@ -111,7 +111,6 @@ The following options are supported:
(suppress-keymap ,keymap))
(define-minor-mode ,mode
,doc
:init-value nil
:lighter ,lighter
:keymap ,keymap
(when ,cursor-type
Expand All @@ -122,14 +121,14 @@ The following options are supported:
"Define default STATE used in global minor mode."
(let ((mode (modaled--get-state-mode state)))
`(progn
(setq modaled-default-state ,state)
(define-globalized-minor-mode modaled-global-mode
,mode
(lambda ()
(unless (minibufferp)
; enable default modaled minor modes
(modaled-set-state ,state)))
:group 'modaled)
(setq modaled-default-state ,state))))
(modaled-set-default-state)))
:group 'modaled))))

(provide 'modaled)

Expand Down

0 comments on commit 390e287

Please sign in to comment.