[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/07: emacs-build-system: Byte compile the autoload files.
From: |
guix-commits |
Subject: |
02/07: emacs-build-system: Byte compile the autoload files. |
Date: |
Thu, 27 Feb 2020 17:01:44 -0500 (EST) |
apteryx pushed a commit to branch master
in repository guix.
commit 9659459f0640ebfd2f662c26e939f38b0a4abf2b
Author: Maxim Cournoyer <address@hidden>
AuthorDate: Fri Dec 6 15:12:32 2019 +0900
emacs-build-system: Byte compile the autoload files.
* guix/build/emacs-build-system.scm (enable-autoloads-compilation)
(validate-compiled-autoloads): Add procedures.
(%standard-phases): Register the new procedures.
* gnu/packages/aux-files/emacs/guix-emacs.el (guix-emacs-find-autoloads):
Remove duplicates in the list of autoload files found.
* guix/build/emacs-utils.scm (expr->string): Add procedure.
(emacs-batch-eval, emacs-batch-edit-file): Use it.
---
gnu/packages/aux-files/emacs/guix-emacs.el | 5 +++--
guix/build/emacs-build-system.scm | 22 ++++++++++++++++++++--
guix/build/emacs-utils.scm | 10 ++++++++--
3 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el
b/gnu/packages/aux-files/emacs/guix-emacs.el
index 05fc970..25a87ee 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -35,8 +35,9 @@
"Return a list of Emacs 'autoloads' files in DIRECTORY.
The files in the list do not have extensions (.el, .elc)."
;; `directory-files' doesn't honor group in regexp.
- (mapcar #'file-name-sans-extension
- (directory-files directory 'full-name guix-emacs-autoloads-regexp)))
+ (delete-dups (mapcar #'file-name-sans-extension
+ (directory-files directory 'full-name
+ guix-emacs-autoloads-regexp))))
;;;###autoload
(defun guix-emacs-autoload-packages ()
diff --git a/guix/build/emacs-build-system.scm
b/guix/build/emacs-build-system.scm
index 09de244..219310c 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -225,6 +225,21 @@ parallel. PARALLEL-TESTS? is ignored when using a non-make
TEST-COMMAND."
(parameterize ((%emacs emacs))
(emacs-generate-autoloads elpa-name site-lisp))))
+(define* (enable-autoloads-compilation #:key outputs #:allow-other-keys)
+ "Remove the NO-BYTE-COMPILATION local variable embedded in the generated
+autoload files."
+ (let* ((out (assoc-ref outputs "out"))
+ (autoloads (find-files out "-autoloads.el$")))
+ (substitute* autoloads
+ ((";; no-byte-compile.*") ""))
+ #t))
+
+(define* (validate-compiled-autoloads #:key outputs #:allow-other-keys)
+ "Verify whether the byte compiled autoloads load fine."
+ (let* ((out (assoc-ref outputs "out"))
+ (autoloads (find-files out "-autoloads.elc$")))
+ (emacs-batch-eval (format #f "(mapc #'load '~s)" autoloads))))
+
(define (emacs-package? name)
"Check if NAME correspond to the name of an Emacs package."
(string-prefix? "emacs-" name))
@@ -253,10 +268,13 @@ second hyphen. This corresponds to 'name-version' as
used in ELPA packages."
(replace 'check check)
(replace 'install install)
(add-after 'install 'make-autoloads make-autoloads)
- (add-after 'make-autoloads 'patch-el-files patch-el-files)
+ (add-after 'make-autoloads 'enable-autoloads-compilation
+ enable-autoloads-compilation)
+ (add-after 'enable-autoloads-compilation 'patch-el-files patch-el-files)
;; The .el files are byte compiled directly in the store.
(add-after 'patch-el-files 'build build)
- (add-after 'build 'move-doc move-doc)))
+ (add-after 'build 'validate-compiled-autoloads validate-compiled-autoloads)
+ (add-after 'validate-compiled-autoloads 'move-doc move-doc)))
(define* (emacs-build #:key inputs (phases %standard-phases)
#:allow-other-keys #:rest args)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 885fd0a..ab64e37 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -41,16 +41,22 @@
;; The `emacs' command.
(make-parameter "emacs"))
+(define (expr->string expr)
+ "Converts EXPR, an expression, into a string."
+ (if (string? expr)
+ expr
+ (format #f "~s" expr)))
+
(define (emacs-batch-eval expr)
"Run Emacs in batch mode, and execute the elisp code EXPR."
(invoke (%emacs) "--quick" "--batch"
- (format #f "--eval=~S" expr)))
+ (string-append "--eval=" (expr->string expr))))
(define (emacs-batch-edit-file file expr)
"Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
(invoke (%emacs) "--quick" "--batch"
(string-append "--visit=" file)
- (format #f "--eval=~S" expr)))
+ (string-append "--eval=" (expr->string expr))))
(define (emacs-batch-disable-compilation file)
(emacs-batch-edit-file file
- branch master updated (5792355 -> 10a6b85), guix-commits, 2020/02/27
- 01/07: gnu: emacs: Byte compile the site-lisp directory., guix-commits, 2020/02/27
- 02/07: emacs-build-system: Byte compile the autoload files.,
guix-commits <=
- 03/07: gnu: emacs: Fix comment., guix-commits, 2020/02/27
- 06/07: gnu: emacs-sly-quicklisp: Remove the enable-autoloads-compilation phase., guix-commits, 2020/02/27
- 07/07: gnu: emacs-sly-named-readtables: Disable byte compilation of its autoload file., guix-commits, 2020/02/27
- 04/07: gnu: emacs-cl-generic: Disable byte compilation of its autoload file., guix-commits, 2020/02/27
- 05/07: gnu: emacs-sly-macrostep: Remove the enable-autoloads-compilation phase., guix-commits, 2020/02/27