As suggested by Ludovic on IRC, after this patch, build log files (from
/var/log/guix/drvs) will be displayed in a 'guix-build-log-mode'.

I'm not sure about regexp though: are these files always "bz2" and
".../XX/XXXXX-30-more-characters-XXXXX/..."?

I didn't put "/var/log" in the beginning of the regexp to match, for example, 
/mnt/guix-from-sdc/var/log/guix/... files or alike.

>From 5a2beec8d91334ea755b709e51492c44fd2d0773 Mon Sep 17 00:00:00 2001
From: Alex Kost <alez...@gmail.com>
Date: Thu, 29 Oct 2015 20:48:53 +0300
Subject: [PATCH 1/3] emacs: Enable 'guix-build-log-mode' for build log files.

* emacs/guix-build-log.el (auto-mode-alist): Add 'guix-build-log-mode'
  to 'auto-mode-alist'.
---
 emacs/guix-build-log.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/emacs/guix-build-log.el b/emacs/guix-build-log.el
index c0855b2..0e13213 100644
--- a/emacs/guix-build-log.el
+++ b/emacs/guix-build-log.el
@@ -329,6 +329,13 @@ programmatically using hooks:
   (when font-lock-mode
     (font-lock-fontify-buffer)))
 
+;;;###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)
+                       "-" (+ (any alnum "-.")) ".drv.bz2" string-end)
+                   'guix-build-log-mode))
+
 (provide 'guix-build-log)
 
 ;;; guix-build-log.el ends here
-- 
2.5.0

Reply via email to