[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/04: emacs: Enable 'guix-build-log-minor-mode' in shell buffers.
From: |
Alex Kost |
Subject: |
03/04: emacs: Enable 'guix-build-log-minor-mode' in shell buffers. |
Date: |
Mon, 02 Nov 2015 13:00:58 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit f4044b586d04c197325dec36eb35e77fe05028c7
Author: Alex Kost <address@hidden>
Date: Sat Oct 31 22:01:45 2015 +0300
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(-)
diff --git a/doc/emacs.texi b/doc/emacs.texi
index 03dc951..e4608f0 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
address@hidden to nil.
@node Emacs Completions
diff --git a/emacs/guix-build-log.el b/emacs/guix-build-log.el
index c649468..3f78121 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
@@ -347,6 +353,13 @@ programmatically using hooks:
(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/...)
(cons (rx "/guix/drvs/" (= 2 alnum) "/" (= 30 alnum)
diff --git a/emacs/guix-init.el b/emacs/guix-init.el
index 4b3d9c2..1612dee 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)