mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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.
This commit is contained in:
parent
1c080cb68a
commit
74cc67372e
4 changed files with 19 additions and 11 deletions
|
@ -426,6 +426,9 @@ If you want to change default key bindings, use the following keymaps
|
|||
(@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}):
|
||||
|
||||
@table @code
|
||||
@item guix-root-map
|
||||
Parent keymap with general keys for all guix modes.
|
||||
|
||||
@item guix-list-mode-map
|
||||
Parent keymap with general keys for ``list'' buffers.
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ See `insert-text-button' for the meaning of PROPERTIES."
|
|||
(defvar guix-info-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent
|
||||
map (make-composed-keymap button-buffer-map
|
||||
map (make-composed-keymap (list guix-root-map button-buffer-map)
|
||||
special-mode-map))
|
||||
map)
|
||||
"Parent keymap for info buffers.")
|
||||
|
|
|
@ -371,7 +371,9 @@ Same as `tabulated-list-sort', but also restore marks after sorting."
|
|||
|
||||
(defvar guix-list-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map tabulated-list-mode-map)
|
||||
(set-keymap-parent
|
||||
map (make-composed-keymap guix-root-map
|
||||
tabulated-list-mode-map))
|
||||
(define-key map (kbd "RET") 'guix-list-describe)
|
||||
(define-key map (kbd "m") 'guix-list-mark)
|
||||
(define-key map (kbd "*") 'guix-list-mark)
|
||||
|
|
Loading…
Reference in a new issue