summary refs log tree commit diff
path: root/emacs/guix-ui.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-11-21 12:25:19 +0300
committerAlex Kost <alezost@gmail.com>2016-01-02 17:25:35 +0300
commite40b3c33f4750dcbe83012eb4e5b8e786f9f71b1 (patch)
treeb0a90c77821e1798a51533b53fa681368374ec4c /emacs/guix-ui.el
parentc8e2666a8a6f0c96f389f8775f1d8dbad38153c1 (diff)
downloadguix-e40b3c33f4750dcbe83012eb4e5b8e786f9f71b1.tar.gz
emacs: Split 'guix-root-map' keymap.
* emacs/guix-base.el: (guix-root-map): Split into...
  (guix-buffer-map): ... this and...
* emacs/guix-ui.el (guix-ui-map): ... this.
  (guix-ui-define-interface): Generate
  'guix-ENTRY-TYPE-BUFFER-TYPE-mode-map' keymaps inheriting them from
  'guix-ui-map' and 'guix-BUFFER-TYPE-mode-map'.
* emacs/guix-info.el (guix-info-mode-map): Use 'guix-buffer-map'.
* emacs/guix-list.el (guix-list-mode-map): Likewise.
* doc/emacs.texi (Emacs Keymaps): Document new keymaps.
Diffstat (limited to 'emacs/guix-ui.el')
-rw-r--r--emacs/guix-ui.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/emacs/guix-ui.el b/emacs/guix-ui.el
index 4f4688250b..25b110c815 100644
--- a/emacs/guix-ui.el
+++ b/emacs/guix-ui.el
@@ -27,6 +27,13 @@
 (require 'cl-lib)
 (require 'guix-utils)
 
+(defvar guix-ui-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "M") 'guix-apply-manifest)
+    (define-key map (kbd "C-c C-z") 'guix-switch-to-repl)
+    map)
+  "Parent keymap for Guix package/generation buffers.")
+
 (defun guix-ui-list-describe (ids)
   "Describe 'ui' entries with IDS (list of identifiers)."
   (apply #'guix-get-show-entries
@@ -52,12 +59,23 @@ The rest keyword arguments are passed to
          (buffer-type-str (symbol-name buffer-type))
          (prefix          (concat "guix-" entry-type-str "-"
                                   buffer-type-str))
+         (mode-str        (concat prefix "-mode"))
+         (mode-map        (intern (concat mode-str "-map")))
+         (parent-map      (intern (format "guix-%s-mode-map"
+                                          buffer-type-str)))
          (required-var    (intern (concat prefix "-required-params")))
          (definer         (intern (format "guix-%s-define-interface"
                                           buffer-type-str))))
     (guix-keyword-args-let args
         ((required-val    :required ''(id)))
       `(progn
+         (defvar ,mode-map
+           (let ((map (make-sparse-keymap)))
+             (set-keymap-parent
+              map (make-composed-keymap ,parent-map guix-ui-map))
+             map)
+           ,(format "Keymap for `%s' buffers." mode-str))
+
          (defvar ,required-var ,required-val
            ,(format "\
 List of the required '%s' parameters for '%s' buffer.