Skip to content

Commit

Permalink
Fix up the group helper functions to handle a case where there are no…
Browse files Browse the repository at this point in the history
… current bindings.
  • Loading branch information
philjackson committed Sep 10, 2010
1 parent 70c3b4d commit 4b34f17
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions magit-key-mode.el
Expand Up @@ -103,16 +103,18 @@

(defun magit-key-mode-add-group (name)
"Add a new group to `magit-key-mode-key-maps'."
(push (list name) magit-key-mode-groups))
(unless (assoc name magit-key-mode-groups)
(push (list name '(actions)) magit-key-mode-groups)))

(defun magit-key-mode-update-group (for-group thing &rest args)
"Abstraction for setting values in `magit-key-mode-key-maps'."
(let* ((options (magit-key-mode-options-for-group for-group))
(things (cdr (assoc thing options))))
(when things
(setcdr things (cons args (cdr things)))
(setq magit-key-mode-key-maps nil)
things)))
(things (assoc thing options)))
(if (cdr things)
(setcdr (cdr things) (cons args (cddr things)))
(setcdr things (list args)))
(setq magit-key-mode-key-maps nil)
things))

(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
Expand Down

0 comments on commit 4b34f17

Please sign in to comment.