summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-03-22 12:40:25 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-03-22 21:17:38 -0400
commitffaec30702f392a50cbd6d3ba229506b5a38e207 (patch)
tree1b26fb1541a05440f9a2445fcf02a7b5cc0282ce /gnu
parentd0a64567f1218bec0de98e685c1e610e4a32038c (diff)
downloadguix-ffaec30702f392a50cbd6d3ba229506b5a38e207.tar.gz
gnu: emacs: Byte compile the site-lisp directory, without coupling.
This re-instates what the previously reverted commit did, but without adding
a dependency on the (guix build emacs-utils) module.

* gnu/packages/emacs.scm (emacs)[phases]{install-site-start}: Define a
EMACS-BYTE-COMPILE-DIRECTORY procedure, and use it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/emacs.scm18
1 files changed, 15 insertions, 3 deletions
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 794cbca38d..ec5e6687fd 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2016 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2016 ng0 <ng0@n0.is>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2017, 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2017, 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
@@ -143,7 +143,18 @@
            ;; Elisp packages found in EMACSLOADPATH.
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out      (assoc-ref outputs "out"))
-                    (lisp-dir (string-append out "/share/emacs/site-lisp")))
+                    (lisp-dir (string-append out "/share/emacs/site-lisp"))
+                    (emacs (string-append out "/bin/emacs")))
+
+               ;; This is duplicated from emacs-utils to prevent coupling.
+               (define* (emacs-byte-compile-directory dir)
+                 (let ((expr `(progn
+                               (setq byte-compile-debug t)
+                               (byte-recompile-directory
+                                (file-name-as-directory ,dir) 0 1))))
+                   (invoke emacs "--quick" "--batch"
+                           (format "--eval=~s" expr))))
+
                (copy-file (assoc-ref inputs "guix-emacs.el")
                           (string-append lisp-dir "/guix-emacs.el"))
                (with-output-to-file (string-append lisp-dir "/site-start.el")
@@ -156,7 +167,8 @@
                ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
                ;; which leads to conflicts.
                (delete-file (string-append lisp-dir "/subdirs.el"))
-               #t))))))
+               ;; Byte compile the site-start files.
+               (emacs-byte-compile-directory lisp-dir)))))))
     (inputs
      `(("gnutls" ,gnutls)
        ("ncurses" ,ncurses)