stgit.el: Compact code for populating stgit-mode-map
authorGustav Hållberg <gustav@virtutech.com>
Mon, 8 Dec 2008 20:24:37 +0000 (21:24 +0100)
committerKarl Hasselström <kha@treskal.com>
Mon, 8 Dec 2008 20:39:39 +0000 (21:39 +0100)
Signed-off-by: Gustav Hållberg <gustav@virtutech.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
contrib/stgit.el

index fb25a17..9cf909f 100644 (file)
@@ -153,29 +153,30 @@ Argument DIR is the repository path."
 (unless stgit-mode-map
   (setq stgit-mode-map (make-keymap))
   (suppress-keymap stgit-mode-map)
-  (define-key stgit-mode-map " "   'stgit-mark)
-  (define-key stgit-mode-map "\d" 'stgit-unmark)
-  (define-key stgit-mode-map "?"   'stgit-help)
-  (define-key stgit-mode-map "h"   'stgit-help)
-  (define-key stgit-mode-map "p"   'previous-line)
-  (define-key stgit-mode-map "n"   'next-line)
-  (define-key stgit-mode-map "g"   'stgit-reload)
-  (define-key stgit-mode-map "r"   'stgit-refresh)
-  (define-key stgit-mode-map "\C-c\C-r" 'stgit-rename)
-  (define-key stgit-mode-map "e"   'stgit-edit)
-  (define-key stgit-mode-map "c"   'stgit-coalesce)
-  (define-key stgit-mode-map "N"   'stgit-new)
-  (define-key stgit-mode-map "R"   'stgit-repair)
-  (define-key stgit-mode-map "C"   'stgit-commit)
-  (define-key stgit-mode-map "U"   'stgit-uncommit)
-  (define-key stgit-mode-map ">"   'stgit-push-next)
-  (define-key stgit-mode-map "<"   'stgit-pop-next)
-  (define-key stgit-mode-map "P"   'stgit-push-or-pop)
-  (define-key stgit-mode-map "G"   'stgit-goto)
-  (define-key stgit-mode-map "="   'stgit-show)
-  (define-key stgit-mode-map "D"   'stgit-delete)
-  (define-key stgit-mode-map [(control ?/)] 'stgit-undo)
-  (define-key stgit-mode-map "\C-_" 'stgit-undo))
+  (mapc (lambda (arg) (define-key stgit-mode-map (car arg) (cdr arg)))
+        '((" " .        stgit-mark)
+          ("\d" .       stgit-unmark)
+          ("?" .        stgit-help)
+          ("h" .        stgit-help)
+          ("p" .        previous-line)
+          ("n" .        next-line)
+          ("g" .        stgit-reload)
+          ("r" .        stgit-refresh)
+          ("\C-c\C-r" . stgit-rename)
+          ("e" .        stgit-edit)
+          ("c" .        stgit-coalesce)
+          ("N" .        stgit-new)
+          ("R" .        stgit-repair)
+          ("C" .        stgit-commit)
+          ("U" .        stgit-uncommit)
+          (">" .        stgit-push-next)
+          ("<" .        stgit-pop-next)
+          ("P" .        stgit-push-or-pop)
+          ("G" .        stgit-goto)
+          ("=" .        stgit-show)
+          ("D" .        stgit-delete)
+          ([(control ?/)] . stgit-undo)
+          ("\C-_" .     stgit-undo))))
 
 (defun stgit-mode ()
   "Major mode for interacting with StGit.