Skip to content

Commit

Permalink
feat!: remove deprecated function and switch to keymap-set
Browse files Browse the repository at this point in the history
  • Loading branch information
DCsunset committed Jul 21, 2024
1 parent 3a5fb96 commit 6c5bea1
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions modaled.el
Original file line number Diff line number Diff line change
Expand Up @@ -161,38 +161,6 @@ Used when the major mode is enabled and by `modaled-set-default-state'.")
(dolist (k keys)
(define-key (symbol-value keymap) k def))))))

;;;###autoload
(defun modaled-define-state-keys (state &rest keybindings)
"Define KEYBINDINGS for the STATE.
Deprecated. Use `modaled-define-keys' instead.
STATE can be a single state or a list of states.
If it's a list, KEYBINDINGS will be applied to all states in list."
(declare (indent defun))
(let ((states (if (listp state) state (list state))))
(modaled--define-keymap (mapcar #'modaled-get-state-keymap states) keybindings)))

;;;###autoload
(defun modaled-define-substate-keys (substate &rest keybindings)
"Define KEYBINDINGS for the SUBSTATE.
Deprecated. Use `modaled-define-keys' instead.
SUBSTATE can be a single substate or a list of substates.
If it's a list, KEYBINDINGS will be applied to all substates in list."
(declare (indent defun))
(let ((states (if (listp substate) substate `(,substate))))
(modaled--define-keymap (mapcar #'modaled-get-substate-keymap states) keybindings)))

;;;###autoload
(defun modaled-define-global-keys (&rest keybindings)
"Define KEYBINDINGS globally.
Deprecated. Use `modaled-define-keys' instead."
(declare (indent 0))
(pcase-dolist (`(,key . ,def) keybindings)
(let ((keys (if (listp key) key (list key))))
(dolist (k keys)
(global-set-key k def)))))

;;;###autoload
(defun modaled-define-keys (&rest body)
"Define keybindings for the states, substates, or globally.
Expand All @@ -216,9 +184,9 @@ The following options can be set in BODY:
(let ((keys (if (listp key) key (list key))))
(dolist (k keys)
(dolist (keymap keymaps)
(define-key (symbol-value keymap) k def))
(keymap-set (symbol-value keymap) k def))
(when global
(global-set-key k def)))))))
(keymap-global-set k def)))))))

;;;###autoload
(defmacro modaled--define-minor-mode (mode keymap body)
Expand Down

0 comments on commit 6c5bea1

Please sign in to comment.