From 96856613249ccef0bfce16edd945a841d1b661f7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 26 Oct 2015 18:44:18 +0100 Subject: doc: Add a REPL example. * doc/contributing.texi (Running Guix Before It Is Installed): Add REPL example. * doc/emacs.texi (Emacs General info): Add @cindex. --- doc/emacs.texi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/emacs.texi') diff --git a/doc/emacs.texi b/doc/emacs.texi index 0e901e1f90..b36e859b4a 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -227,6 +227,8 @@ prefix argument is used. This has the same meaning as @code{--manifest} option (@pxref{Invoking guix package}). @item C-c C-z +@cindex REPL +@cindex read-eval-print loop Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}). @item h -- cgit 1.4.1 From 20ce2fee3364aa508c7ed03a0d519c783782a8b8 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Thu, 29 Oct 2015 21:27:56 +0300 Subject: 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. --- doc/emacs.texi | 13 +++++++------ emacs/guix-build-log.el | 24 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'doc/emacs.texi') diff --git a/doc/emacs.texi b/doc/emacs.texi index b36e859b4a..03dc9519f8 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -646,12 +646,13 @@ Toggle (show/hide) the bodies of all build phases. @end table There is also @kbd{M-x guix-build-log-minor-mode} which also provides -the same highlighting (but not key bindings). And as it is a minor -mode, it can be enabled in any buffer. For example, if you are building -some package in a shell buffer (@pxref{Interactive Shell,,, emacs, The -GNU Emacs Manual}), you may enable @command{guix-build-log-minor-mode} -to make it more colorful. Guix build output is rather specific, so this -new highlighting shouldn't conflict with the existing one. +the same highlighting. And as it is a minor mode, it can be enabled in +any buffer. For example, if you are building some package in a shell +buffer (@pxref{Interactive Shell,,, emacs, The GNU Emacs Manual}), you +may enable @command{guix-build-log-minor-mode} to make it more colorful. +Guix build output is rather specific, so this new highlighting shouldn't +conflict with the existing one. This mode also provides the same key +bindings as the major mode, but prefixed with @kbd{C-c}. @node Emacs Completions 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 "") '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) -- cgit 1.4.1 From f4044b586d04c197325dec36eb35e77fe05028c7 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 31 Oct 2015 22:01:45 +0300 Subject: emacs: Enable 'guix-build-log-minor-mode' in shell buffers. * emacs/guix-build-log.el (guix-build-log-minor-mode-activate): New variable. (guix-build-log-minor-mode-activate-maybe): New function. * emacs/guix-init.el: Add it to 'shell-mode-hook'. * doc/emacs.texi (Emacs Build Log): Mention it. --- doc/emacs.texi | 12 +++++------- emacs/guix-build-log.el | 13 +++++++++++++ emacs/guix-init.el | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'doc/emacs.texi') diff --git a/doc/emacs.texi b/doc/emacs.texi index 03dc9519f8..e4608f09ef 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -646,13 +646,11 @@ Toggle (show/hide) the bodies of all build phases. @end table There is also @kbd{M-x guix-build-log-minor-mode} which also provides -the same highlighting. And as it is a minor mode, it can be enabled in -any buffer. For example, if you are building some package in a shell -buffer (@pxref{Interactive Shell,,, emacs, The GNU Emacs Manual}), you -may enable @command{guix-build-log-minor-mode} to make it more colorful. -Guix build output is rather specific, so this new highlighting shouldn't -conflict with the existing one. This mode also provides the same key -bindings as the major mode, but prefixed with @kbd{C-c}. +the same highlighting and the same key bindings as the major mode, but +prefixed with @kbd{C-c}. By default, this minor mode is enabled in +shell buffers (@pxref{Interactive Shell,,, emacs, The GNU Emacs +Manual}). If you don't like it, set +@code{guix-build-log-minor-mode-activate} to nil. @node Emacs Completions diff --git a/emacs/guix-build-log.el b/emacs/guix-build-log.el index c64946846e..3f78121a90 100644 --- a/emacs/guix-build-log.el +++ b/emacs/guix-build-log.el @@ -102,6 +102,12 @@ "Face for the number of seconds for a phase." :group 'guix-build-log-faces) +(defcustom guix-build-log-minor-mode-activate t + "If non-nil, then `guix-build-log-minor-mode' is automatically +activated in `shell-mode' buffers." + :type 'boolean + :group 'guix-build-log) + (defcustom guix-build-log-mode-hook '() "Hook run after `guix-build-log-mode' is entered." :type 'hook @@ -346,6 +352,13 @@ programmatically using hooks: (when font-lock-mode (font-lock-fontify-buffer))) +;;;###autoload +(defun guix-build-log-minor-mode-activate-maybe () + "Activate `guix-build-log-minor-mode' depending on +`guix-build-log-minor-mode-activate' variable." + (when guix-build-log-minor-mode-activate + (guix-build-log-minor-mode))) + ;;;###autoload (add-to-list 'auto-mode-alist ;; Regexp for log files (usually placed in /var/log/guix/...) diff --git a/emacs/guix-init.el b/emacs/guix-init.el index 4b3d9c281c..1612dee83f 100644 --- a/emacs/guix-init.el +++ b/emacs/guix-init.el @@ -15,5 +15,6 @@ avoid loading autoloads of Emacs packages installed in (guix-emacs-load-autoloads 'all)) (add-hook 'scheme-mode-hook 'guix-devel-activate-mode-maybe) +(add-hook 'shell-mode-hook 'guix-build-log-minor-mode-activate-maybe) (provide 'guix-init) -- cgit 1.4.1