From ffaec30702f392a50cbd6d3ba229506b5a38e207 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 22 Mar 2020 12:40:25 -0400 Subject: 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. --- gnu/packages/emacs.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gnu') 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 ;;; Copyright © 2016 ng0 ;;; Copyright © 2017 Marius Bakke -;;; Copyright © 2017, 2019 Maxim Cournoyer +;;; Copyright © 2017, 2019, 2020 Maxim Cournoyer ;;; Copyright © 2017 Alex Vong ;;; Copyright © 2017, 2018 Ricardo Wurmus ;;; Copyright © 2017 Jan Nieuwenhuizen @@ -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) -- cgit v1.2.3