magit-simple-keys essentially aliases magit-key-mode-popup-* commands
to sane default functions. It is provided as an alternative to
magit-key-mode for users who prefer Magit's older behavior. To use,
simply require magit-simple-keys instead of magit-key-mode in
magit.el.

Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
  This is just a start- it's not complete by any means. In future,
  seamless switching between "basic" and "advanced" modes
  (corresponding to magit-simple-keys and magit-key-mode) is planned.

 magit-simple-keys.el |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 magit-simple-keys.el

diff --git a/magit-simple-keys.el b/magit-simple-keys.el
new file mode 100644
index 0000000..8ee787a
--- /dev/null
+++ b/magit-simple-keys.el
@@ -0,0 +1,25 @@
+;; This file is part of Magit
+
+(defvar magit-key-mode-mapping
+  '((logging magit-display-log)
+    (running magit-shell-command)
+    (fetching magit-fetch-current)
+    (pushing magit-push)
+    (pulling magit-pull)
+    (branching magit-checkout)
+    (tagging magit-tag)
+    (stashing magit-stash)
+    (merging magit-merge)
+    (submodule magit-submodule-update)))
+
+(defun magit-key-mode-generate (term mapping-function)
+  "Generate alias for the key-group term"
+  `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
+       mapping-function))
+
+;; generate the aliases using the mapping in key-mode-mapping
+(mapc (lambda (g)
+        (magit-key-mode-generate (car g) (cadr g)))
+      magit-key-mode-mapping)
+
+(provide 'magit-simple-keys)
-- 
1.7.2.2.409.gdbb11.dirty

Reply via email to