summary refs log tree commit diff
path: root/emacs/guix-build-log.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-29 21:27:56 +0300
committerAlex Kost <alezost@gmail.com>2015-10-31 23:22:40 +0300
commit20ce2fee3364aa508c7ed03a0d519c783782a8b8 (patch)
treefd06bc58444ed7f177e259ed0aec23b4224674e5 /emacs/guix-build-log.el
parentfbd213a83ffc80c432e0c62868e56c020729a49f (diff)
downloadguix-20ce2fee3364aa508c7ed03a0d519c783782a8b8.tar.gz
emacs: Add key bindings for 'guix-build-log-minor-mode'.
* emacs/guix-build-log.el (guix-build-log-mode-map): Move keys to ...
  (guix-build-log-common-map): ...here.  New variable.
  (guix-build-log-minor-mode-map): New variable.
  (guix-build-log-minor-mode): Use it.
* doc/emacs.texi (Emacs Build Log): Document it.
Diffstat (limited to 'emacs/guix-build-log.el')
-rw-r--r--emacs/guix-build-log.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/emacs/guix-build-log.el b/emacs/guix-build-log.el
index c0855b284c..e28dce4471 100644
--- a/emacs/guix-build-log.el
+++ b/emacs/guix-build-log.el
@@ -178,9 +178,8 @@ STATE is a symbol denoting how a build phase was ended.  It should be
      (3 'guix-build-log-phase-seconds prepend)))
   "A list of `font-lock-keywords' for `guix-build-log-mode'.")
 
-(defvar guix-build-log-mode-map
+(defvar guix-build-log-common-map
   (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map special-mode-map)
     (define-key map (kbd "M-n") 'guix-build-log-next-phase)
     (define-key map (kbd "M-p") 'guix-build-log-previous-phase)
     (define-key map (kbd "TAB") 'guix-build-log-phase-toggle)
@@ -188,8 +187,24 @@ STATE is a symbol denoting how a build phase was ended.  It should be
     (define-key map (kbd "<backtab>") 'guix-build-log-phase-toggle-all)
     (define-key map [(shift tab)] 'guix-build-log-phase-toggle-all)
     map)
+  "Parent keymap for 'build-log' buffers.
+For `guix-build-log-mode' this map is used as is.
+For `guix-build-log-minor-mode' this map is prefixed with 'C-c'.")
+
+(defvar guix-build-log-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent
+     map (make-composed-keymap (list guix-build-log-common-map)
+                               special-mode-map))
+    map)
   "Keymap for `guix-build-log-mode' buffers.")
 
+(defvar guix-build-log-minor-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c") guix-build-log-common-map)
+    map)
+  "Keymap for `guix-build-log-minor-mode' buffers.")
+
 (defun guix-build-log-phase-start (&optional with-header?)
   "Return the start point of the current build phase.
 If WITH-HEADER? is non-nil, do not skip 'starting phase ...' header.
@@ -319,9 +334,12 @@ When Guix Build Log minor mode is enabled, it highlights build
 log in the current buffer.  This mode can be enabled
 programmatically using hooks:
 
-  (add-hook 'shell-mode-hook 'guix-build-log-minor-mode)"
+  (add-hook 'shell-mode-hook 'guix-build-log-minor-mode)
+
+\\{guix-build-log-minor-mode-map}"
   :init-value nil
   :lighter " Guix-Build-Log"
+  :keymap guix-build-log-minor-mode-map
   :group 'guix-build-log
   (if guix-build-log-minor-mode
       (font-lock-add-keywords nil guix-build-log-font-lock-keywords)