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.
This commit is contained in:
parent
c8e2666a8a
commit
e40b3c33f4
|
@ -439,8 +439,12 @@ If you want to change default key bindings, use the following keymaps
|
||||||
(@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}):
|
(@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}):
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item guix-root-map
|
@item guix-buffer-map
|
||||||
Parent keymap with general keys for all guix modes.
|
Parent keymap with general keys for any buffer type.
|
||||||
|
|
||||||
|
@item guix-ui-map
|
||||||
|
Parent keymap with general keys for buffers used for Guix package
|
||||||
|
management (for packages, outputs and generations).
|
||||||
|
|
||||||
@item guix-list-mode-map
|
@item guix-list-mode-map
|
||||||
Parent keymap with general keys for ``list'' buffers.
|
Parent keymap with general keys for ``list'' buffers.
|
||||||
|
|
|
@ -283,16 +283,14 @@ This alist is filled by `guix-buffer-define-interface' macro.")
|
||||||
"Return 'revert-confirm' value for BUFFER-TYPE/ENTRY-TYPE."
|
"Return 'revert-confirm' value for BUFFER-TYPE/ENTRY-TYPE."
|
||||||
(guix-buffer-value buffer-type entry-type 'revert-confirm))
|
(guix-buffer-value buffer-type entry-type 'revert-confirm))
|
||||||
|
|
||||||
(defvar guix-root-map
|
(defvar guix-buffer-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map (kbd "l") 'guix-history-back)
|
(define-key map (kbd "l") 'guix-history-back)
|
||||||
(define-key map (kbd "r") 'guix-history-forward)
|
(define-key map (kbd "r") 'guix-history-forward)
|
||||||
(define-key map (kbd "g") 'revert-buffer)
|
(define-key map (kbd "g") 'revert-buffer)
|
||||||
(define-key map (kbd "R") 'guix-redisplay-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)
|
map)
|
||||||
"Parent keymap for all guix modes.")
|
"Parent keymap for Guix buffer modes.")
|
||||||
|
|
||||||
(defvar-local guix-profile nil
|
(defvar-local guix-profile nil
|
||||||
"Profile used for the current buffer.")
|
"Profile used for the current buffer.")
|
||||||
|
|
|
@ -401,10 +401,10 @@ See `insert-text-button' for the meaning of PROPERTIES."
|
||||||
(defvar guix-info-mode-map
|
(defvar guix-info-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(set-keymap-parent
|
(set-keymap-parent
|
||||||
map (make-composed-keymap (list guix-root-map button-buffer-map)
|
map (make-composed-keymap (list guix-buffer-map button-buffer-map)
|
||||||
special-mode-map))
|
special-mode-map))
|
||||||
map)
|
map)
|
||||||
"Parent keymap for info buffers.")
|
"Keymap for `guix-info-mode' buffers.")
|
||||||
|
|
||||||
(define-derived-mode guix-info-mode special-mode "Guix-Info"
|
(define-derived-mode guix-info-mode special-mode "Guix-Info"
|
||||||
"Parent mode for displaying information in info buffers.")
|
"Parent mode for displaying information in info buffers.")
|
||||||
|
|
|
@ -380,7 +380,7 @@ Same as `tabulated-list-sort', but also restore marks after sorting."
|
||||||
(defvar guix-list-mode-map
|
(defvar guix-list-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(set-keymap-parent
|
(set-keymap-parent
|
||||||
map (make-composed-keymap guix-root-map
|
map (make-composed-keymap guix-buffer-map
|
||||||
tabulated-list-mode-map))
|
tabulated-list-mode-map))
|
||||||
(define-key map (kbd "RET") 'guix-list-describe)
|
(define-key map (kbd "RET") 'guix-list-describe)
|
||||||
(define-key map (kbd "i") 'guix-list-describe)
|
(define-key map (kbd "i") 'guix-list-describe)
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'guix-utils)
|
(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)
|
(defun guix-ui-list-describe (ids)
|
||||||
"Describe 'ui' entries with IDS (list of identifiers)."
|
"Describe 'ui' entries with IDS (list of identifiers)."
|
||||||
(apply #'guix-get-show-entries
|
(apply #'guix-get-show-entries
|
||||||
|
@ -52,12 +59,23 @@ The rest keyword arguments are passed to
|
||||||
(buffer-type-str (symbol-name buffer-type))
|
(buffer-type-str (symbol-name buffer-type))
|
||||||
(prefix (concat "guix-" entry-type-str "-"
|
(prefix (concat "guix-" entry-type-str "-"
|
||||||
buffer-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")))
|
(required-var (intern (concat prefix "-required-params")))
|
||||||
(definer (intern (format "guix-%s-define-interface"
|
(definer (intern (format "guix-%s-define-interface"
|
||||||
buffer-type-str))))
|
buffer-type-str))))
|
||||||
(guix-keyword-args-let args
|
(guix-keyword-args-let args
|
||||||
((required-val :required ''(id)))
|
((required-val :required ''(id)))
|
||||||
`(progn
|
`(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
|
(defvar ,required-var ,required-val
|
||||||
,(format "\
|
,(format "\
|
||||||
List of the required '%s' parameters for '%s' buffer.
|
List of the required '%s' parameters for '%s' buffer.
|
||||||
|
|
Loading…
Reference in New Issue