summary refs log tree commit diff
path: root/emacs/guix-base.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-06-24 10:36:18 +0300
committerAlex Kost <alezost@gmail.com>2015-06-26 16:15:45 +0300
commit74cc67372ec3771b157c015da4ba7ed5d921799f (patch)
tree9a2190ee4cffbc8e0dd51aa0e50dd610335e20ba /emacs/guix-base.el
parent1c080cb68a4c92f8b740d9daca4075f141f5b659 (diff)
downloadguix-74cc67372ec3771b157c015da4ba7ed5d921799f.tar.gz
emacs: Add 'guix-root-map'.
* emacs/guix-base.el (guix-define-buffer-type): Move common key bindings
  from here...
  (guix-root-map): ... to here.  New variable.
* emacs/guix-info.el (guix-info-mode-map): Use it.
* emacs/guix-list.el (guix-list-mode-map): Use it.
* doc/emacs.texi (Emacs Keymaps): Document it.
Diffstat (limited to 'emacs/guix-base.el')
-rw-r--r--emacs/guix-base.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 587288eaf9..fe89584f18 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -295,6 +295,17 @@ See `guix-update-after-operation' for details."
 
 ;;; Common definitions for buffer types
 
+(defvar guix-root-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "l") 'guix-history-back)
+    (define-key map (kbd "r") 'guix-history-forward)
+    (define-key map (kbd "g") 'revert-buffer)
+    (define-key map (kbd "R") 'guix-redisplay-buffer)
+    (define-key map (kbd "M") 'guix-apply-manifest)
+    (define-key map (kbd "C-c C-z") 'guix-switch-to-repl)
+    map)
+  "Parent keymap for all guix modes.")
+
 (defvar-local guix-profile nil
   "Profile used for the current buffer.")
 (put 'guix-profile 'permanent-local t)
@@ -440,15 +451,7 @@ following keywords are available:
                   "\\{" mode-map-str "}")
          (setq-local revert-buffer-function 'guix-revert-buffer)
          (setq-local guix-history-size ,history-var)
-         (and (fboundp ',mode-init-fun) (,mode-init-fun)))
-
-       (let ((map ,mode-map))
-         (define-key map (kbd "l") 'guix-history-back)
-         (define-key map (kbd "r") 'guix-history-forward)
-         (define-key map (kbd "g") 'revert-buffer)
-         (define-key map (kbd "R") 'guix-redisplay-buffer)
-         (define-key map (kbd "M") 'guix-apply-manifest)
-         (define-key map (kbd "C-c C-z") 'guix-switch-to-repl)))))
+         (and (fboundp ',mode-init-fun) (,mode-init-fun))))))
 
 (put 'guix-define-buffer-type 'lisp-indent-function 'defun)