Functions for plugins to add to the key groups.
This commit is contained in:
parent
421182233e
commit
1f36bfb7e5
1 changed files with 26 additions and 0 deletions
|
@ -101,6 +101,32 @@
|
|||
modify this make sure you reset `magit-key-mode-key-maps' to
|
||||
nil.")
|
||||
|
||||
(defun magit-key-mode-insert-argument (for-group key desc arg read-func)
|
||||
"Add a new binding (KEY) in FOR-GROUP which will use READ-FUNC
|
||||
to receive input to apply to argument ARG git is run. DESC should
|
||||
be a brief description of the binding."
|
||||
(let* ((options (magit-key-mode-options-for-group for-group))
|
||||
(arguments (cdr (assoc 'arguments options))))
|
||||
(setcar arguments (list key desc arg read-func))
|
||||
(setq magit-key-mode-key-maps nil)))
|
||||
|
||||
(defun magit-key-mode-insert-switch (for-group key desc switch)
|
||||
"Add a new binding (KEY) in FOR-GROUP which will add SWITCH to git's
|
||||
commandline when it runs. DESC should be a brief description of
|
||||
the binding."
|
||||
(let* ((options (magit-key-mode-options-for-group for-group))
|
||||
(switches (cdr (assoc 'switches options))))
|
||||
(setcar switches (list key desc switch))
|
||||
(setq magit-key-mode-key-maps nil)))
|
||||
|
||||
(defun magit-key-mode-insert-action (for-group key desc func)
|
||||
"Add a new binding (KEY) in FOR-GROUP which will run command
|
||||
FUNC. DESC should be a brief description of the binding."
|
||||
(let* ((options (magit-key-mode-options-for-group for-group))
|
||||
(actions (cdr (assoc 'actions options))))
|
||||
(setcar actions (list key desc func))
|
||||
(setq magit-key-mode-key-maps nil)))
|
||||
|
||||
(defun magit-key-mode-options-for-group (for-group)
|
||||
(or (cdr (assoc for-group magit-key-mode-groups))
|
||||
(error "Unknown group '%s'" for-group)))
|
||||
|
|
Loading…
Reference in a new issue