unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#38619] Byte compilation of Emacs autoloads
@ 2019-12-15  4:30 Maxim Cournoyer
  2020-02-27 10:15 ` Pierre Neidhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2019-12-15  4:30 UTC (permalink / raw)
  To: 38619

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

Hello,

The following adds support for byte compiling the generated autoload
files as well as the site-lisp directory of Emacs (the one containing
the site-start.el and guix-emacs.el files).

The performance gain is roughly 30%, as expected for byte compiled
Elisp.  The following command was used for benchmarking:

--8<---------------cut here---------------start------------->8---
./pre-inst-env guix environment -v 10 -m ~/100-emacs-packages-manifest.scm -- emacs -Q --batch --eval "(progn (require 'guix-emacs) (message \"%s\" (benchmark-run-compiled 10 (guix-emacs-autoload-packages))))"
--8<---------------cut here---------------end--------------->8---

It loads the autoloads of ~100 Emacs packages 10 times (~1000 autoloads
files).  The manifest file 100-emacs-packages-manifest.scm is attached.

[-- Attachment #2: 100-emacs-packages-manifest.scm --]
[-- Type: application/octet-stream, Size: 2285 bytes --]

(specifications->manifest
 '("emacs"
   ;;"emacs-deadgrep"
   "emacs-datetime"
   "emacs-dashboard"
   "emacs-dash"
;;   "emacs-dash-docs"
   "emacs-darkroom"
   "emacs-dante"
   "emacs-danneskjold-theme"
   "emacs-daemons"
   "emacs-d-mode"
   "emacs-cyberpunk-theme"
   "emacs-ctable"
   "emacs-csv-mode"
   "emacs-crux"
   "emacs-counsel-tramp"
   "emacs-counsel-projectile"
   "emacs-counsel-etags"
   "emacs-counsel-dash"
   "emacs-constants"
;;   "emacs-compdef"
   "emacs-company"
   "emacs-company-restclient"
   "emacs-company-quickhelp"
   "emacs-company-math"
   "emacs-company-lua"
   "emacs-company-lsp"
   "emacs-company-jedi"
   "emacs-company-irony"
   "emacs-company-flow"
   "emacs-company-cabal"
   "emacs-company-auctex"
   "emacs-commander"
   "emacs-column-marker"
   "emacs-cnfonts"
;;   "emacs-cmake-font-lock"
   ;;"emacs-closql"
   "emacs-clojure-mode"
;;   "emacs-cl-print"
   "emacs-cl-generic"
   "emacs-circe"
   "emacs-cider"
   "emacs-cdlatex"
   "emacs-ccls"
   ;;"emacs-calfw"  ;broken
   "emacs-buttercup"
   "emacs-butler"
   "emacs-build-farm"
   "emacs-bui"
   "emacs-bug-hunter"
   "emacs-browse-at-remote"
   "emacs-bongo"
   "emacs-blimp"
   "emacs-biblio"
   "emacs-better-defaults"
   "emacs-benchmark-init"
   "emacs-beginend"
   "emacs-bbdb"
   "emacs-bash-completion"
   "emacs-base16-theme"
   "emacs-avy"
   "emacs-autothemer"
   "emacs-auto-yasnippet"
   "emacs-auto-complete"
   "emacs-auctex"
   "emacs-attrap"
   "emacs-atom-one-dark-theme"
   "emacs-async"
   "emacs-ascii-art-to-unicode"
   "emacs-arduino-mode"
;;   "emacs-apheleia"
   "emacs-anzu"
   "emacs-ansi"
;;   "emacs-annalist"
   "emacs-anaphora"
   "emacs-amx"
   "emacs-ample-regexps"
   "emacs-all-the-icons"
   "emacs-all-the-icons-dired"
   "emacs-alert"
   "emacs-alect-themes"
   "emacs-ahungry-theme"
   "emacs-aggressive-indent"
   "emacs-ag"
   "emacs-adoc-mode"
   "emacs-add-node-modules-path"
   "emacs-add-hooks"
   "emacs-adaptive-wrap"
   "emacs-ace-window"
   "emacs-ace-link"
   "emacs-ace-jump-mode"
   "emacs-academic-phrases"
   "emacs-a"
   "emacs-2048-game"
   "emacs-tuareg"
   "emacs-magit"
   "emacs-ws-butler"
   "emacs-string-inflection"
   "emacs-realgud"
   "emacs-recutils"
   "emacs-grep-a-lot"
   "emacs-diff-hl"
   "emacs-agda2-mode"))

[-- Attachment #3: Type: text/plain, Size: 1632 bytes --]


The above command for Guix before the changes (commit e19a539):

--8<---------------cut here---------------start------------->8---
[...]
Loading /gnu/store/lj09yx56hgsq9l4ajk5wlxsk4vbrympk-profile/share/emacs/site-lisp/undercover-autoloads.el (source)...
Loading /gnu/store/lj09yx56hgsq9l4ajk5wlxsk4vbrympk-profile/share/emacs/site-lisp/with-editor-autoloads.el (source)...
Loading /gnu/store/lj09yx56hgsq9l4ajk5wlxsk4vbrympk-profile/share/emacs/site-lisp/ws-butler-autoloads.el (source)...
Loading /gnu/store/lj09yx56hgsq9l4ajk5wlxsk4vbrympk-profile/share/emacs/site-lisp/yasnippet-autoloads.el (source)...
(9.971024566 159 2.763721703999999)
--8<---------------cut here---------------end--------------->8---

After the changes:

--8<---------------cut here---------------start------------->8---
Loading /gnu/store/fwji52vg31xmdkc2z5cbjrfza7fxndr5-profile/share/emacs/site-lisp/undercover-autoloads...
Loading /gnu/store/fwji52vg31xmdkc2z5cbjrfza7fxndr5-profile/share/emacs/site-lisp/with-editor-autoloads...
Loading /gnu/store/fwji52vg31xmdkc2z5cbjrfza7fxndr5-profile/share/emacs/site-lisp/ws-butler-autoloads...
Loading /gnu/store/fwji52vg31xmdkc2z5cbjrfza7fxndr5-profile/share/emacs/site-lisp/yasnippet-autoloads...
(7.435941036 143 2.406266451999999)
--8<---------------cut here---------------end--------------->8---

I think it's neat that all of our Elisp is byte compiled; it's something
that can be done without fear on Guix, given that when the Emacs package itself
changes, all the Emacs packages are rebuilt.  It could also find issues we'd not
know existed otherwise, as I found out for the emacs-cl-generic package.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-gnu-emacs-Byte-compile-the-site-lisp-directory.patch --]
[-- Type: text/x-patch, Size: 2195 bytes --]

From a54e9beb22d2d5102e48e26834b19bb2603f50b5 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 5 Dec 2019 13:40:32 +0900
Subject: [PATCH 1/3] gnu: emacs: Byte compile the site-lisp directory.

* gnu/packages/emacs.scm (emacs): Use the (gnu build emacs-utils) module.
Byte compile the site-lisp directory as part of the 'install-site-start'
phase.
---
 gnu/packages/emacs.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index eba7f88551..fcf966839b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -119,6 +119,10 @@
      `(#:tests? #f                      ; no check target
        #:configure-flags (list "--with-modules"
                                "--disable-build-details")
+       #:modules ((guix build emacs-utils)
+                  ,@%glib-or-gtk-build-system-modules)
+       #:imported-modules ((guix build emacs-utils)
+                           ,@%glib-or-gtk-build-system-modules)
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'fix-/bin/pwd
@@ -135,7 +139,8 @@
            ;; automatically found.
            (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")))
                (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")
@@ -148,6 +153,9 @@
                ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
                ;; which leads to conflicts.
                (delete-file (string-append lisp-dir "/subdirs.el"))
+               ;; Byte compile the site-start files.
+               (parameterize ((%emacs emacs))
+                 (emacs-byte-compile-directory lisp-dir))
                #t))))))
     (inputs
      `(("gnutls" ,gnutls)
-- 
2.23.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0002-emacs-build-system-Byte-compile-the-autoload-files.patch --]
[-- Type: text/x-patch, Size: 4781 bytes --]

From 8fa11e7d52798494e0ea4d19ae8898bf949a18b8 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 6 Dec 2019 15:12:32 +0900
Subject: [PATCH 2/3] 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 05fc9709b6..25a87ee52d 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 09de244993..219310cf08 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 fdacd30dd6..59467d632e 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -39,16 +39,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-generate-autoloads name directory)
   "Generate autoloads for Emacs package NAME placed in DIRECTORY."
-- 
2.23.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0003-gnu-emacs-cl-generic-Disable-byte-compilation-of-its.patch --]
[-- Type: text/x-patch, Size: 1161 bytes --]

From c3581a39268a24550fe6d0f2c3f1b630c2d6a5fd Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 7 Dec 2019 02:47:25 +0900
Subject: [PATCH 3/3] gnu: emacs-cl-generic: Disable byte compilation of its
 autoload file.

*gnu/packages/emacs-xyz.scm (emacs-cl-generic)[phases]
{enable-autoloads-compilation}: Delete.
---
 gnu/packages/emacs-xyz.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 2b8c143d4a..5fa78030b8 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -11862,6 +11862,10 @@ match and total match information in the mode-line in various search modes.")
         (base32
          "0vb338bhjpsnrf60qgxny4z5rjrnifahnrv9axd4shay89d894zq"))))
     (build-system emacs-build-system)
+    ;; Byte compilation of the autoload file fails.
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (delete 'enable-autoloads-compilation))))
     (home-page "https://elpa.gnu.org/packages/seq.html")
     (synopsis
      "Forward @code{cl-generic} compatibility for Emacs before version 25")
-- 
2.23.0


[-- Attachment #7: Type: text/plain, Size: 7 bytes --]


Maxim

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#38619] Byte compilation of Emacs autoloads
  2019-12-15  4:30 [bug#38619] Byte compilation of Emacs autoloads Maxim Cournoyer
@ 2020-02-27 10:15 ` Pierre Neidhardt
  2020-02-27 14:39   ` Maxim Cournoyer
  2020-02-27 21:53   ` Maxim Cournoyer
  0 siblings, 2 replies; 7+ messages in thread
From: Pierre Neidhardt @ 2020-02-27 10:15 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 38619

[-- Attachment #1: Type: text/plain, Size: 94 bytes --]

This is super cool!
Anything blocking this?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38619] Byte compilation of Emacs autoloads
  2020-02-27 10:15 ` Pierre Neidhardt
@ 2020-02-27 14:39   ` Maxim Cournoyer
  2020-02-27 21:53   ` Maxim Cournoyer
  1 sibling, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2020-02-27 14:39 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 38619

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> This is super cool!
> Anything blocking this?

Testing? :-)

Maxim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38619] Byte compilation of Emacs autoloads
  2020-02-27 10:15 ` Pierre Neidhardt
  2020-02-27 14:39   ` Maxim Cournoyer
@ 2020-02-27 21:53   ` Maxim Cournoyer
  2020-02-28  7:03     ` Pierre Neidhardt
  1 sibling, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2020-02-27 21:53 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 38619


[-- Attachment #1.1: Type: text/plain, Size: 2045 bytes --]

Hello Pierre,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

I've now tested this change with the extensive manifest (attached).

I've built two profiles, like this:

(before change)
./pre-inst-env guix package -m emacs-pkg.txt -p /tmp/emacs-ref

(after change)
./pre-inst-env guix package -m emacs-pkg.txt -p /tmp/emacs-byte-compiled

Then proceeded to benchmark them like:

--8<---------------cut here---------------start------------->8---
env -i sh -c "source /tmp/emacs-ref/etc/profile && time emacs --batch --eval '()'"
--8<---------------cut here---------------end--------------->8---

Which returned:

--8<---------------cut here---------------start------------->8---
Loading /gnu/store/ipfaivbqjxfnda970w558vpihd84lqwi-profile/share/emacs/site-lisp/treepy-autoloads.el (source)...
Loading /gnu/store/ipfaivbqjxfnda970w558vpihd84lqwi-profile/share/emacs/site-lisp/ts-autoloads.el (source)...
Loading /gnu/store/ipfaivbqjxfnda970w558vpihd84lqwi-profile/share/emacs/site-lisp/tuareg-autoloads.el (source)...
Eager macro-expansion failure: (file-missing "Searching for program" "No such file or directory" "git")
Searching for program: No such file or directory, git

real    0m0.406s
user    0m0.361s
sys     0m0.044s
--8<---------------cut here---------------end--------------->8---

Now with the patches here:
--8<---------------cut here---------------start------------->8---
Loading /gnu/store/l09fascj5xjhbgi3nzc1bhrprdy44y9g-profile/share/emacs/site-lisp/treepy-autoloads...
Loading /gnu/store/l09fascj5xjhbgi3nzc1bhrprdy44y9g-profile/share/emacs/site-lisp/ts-autoloads...
Loading /gnu/store/l09fascj5xjhbgi3nzc1bhrprdy44y9g-profile/share/emacs/site-lisp/tuareg-autoloads.el (source)...
Eager macro-expansion failure: (file-missing "Searching for program" "No such file or directory" "git")
Searching for program: No such file or directory, git

real    0m0.287s
user    0m0.251s
sys     0m0.036s
--8<---------------cut here---------------end--------------->8---

That's a decent speedup :-)

I'll push this to master shortly.

Maxim


[-- Attachment #1.2: emacs packages manifest --]
[-- Type: text/plain, Size: 16793 bytes --]

(specifications->manifest
 '("emacs"
   "emacs-wget"
   "emacs-w3m"
   "emacs-markup-faces"
   "emacs-guix"
   "emacs-doom-themes"
   "emacs-ztree"
   "emacs-zoutline"
   "emacs-zotxt"
   "emacs-zones"
   "emacs-znc"
   "emacs-zerodark-theme"
   "emacs-zenburn-theme"
   "emacs-youtube-dl"
   "emacs-yasnippet"
   "emacs-yasnippet-snippets"
   "emacs-yaml-mode"
   "emacs-xtest"
   "emacs-xterm-color"
   "emacs-xr"
   "emacs-xpm"
   "emacs-xmlgen"
   "emacs-xml-rpc"
   "emacs-xelb"
   "emacs-wttrin"
   "emacs-ws-butler"
   "emacs-writeroom"
   "emacs-writegood-mode"
   "emacs-wordnut"
   "emacs-wordgen"
   "emacs-with-editor"
   "emacs-windower"
   "emacs-window-layout"
   "emacs-whitespace-cleanup-mode"
   "emacs-which-key"
   "emacs-wgrep"
   "emacs-websocket"
   "emacs-webfeeder"
   "emacs-web-server"
   "emacs-web-mode"
   "emacs-web-beautify"
   "emacs-wc-mode"
   "emacs-vterm"
   "emacs-visual-regexp"
   "emacs-visual-fill-column"
   "emacs-vimrc-mode"
   "emacs-vdiff"
   "emacs-vdiff-magit"
   "emacs-validate"
   "emacs-use-package"
   "emacs-unpackaged-el"
   "emacs-unkillable-scratch"
   "emacs-unidecode"
   "emacs-unfill"
   "emacs-undohist-el"
   "emacs-undo-tree"
   "emacs-undo-propose-el"
   "emacs-undercover"
   "emacs-typo"
   "emacs-typescript-mode"
   "emacs-ts"
   "emacs-treepy"
   "emacs-treemacs"
   "emacs-treemacs-extra"
   "emacs-tree-mode"
   "emacs-transpose-frame"
   "emacs-transmission"
   "emacs-transient"
   "emacs-tramp-auto-auth"
   "emacs-tracking"
   "emacs-tldr"
   "emacs-tiny"
   "emacs-tide"
   "emacs-test-simple"
   "emacs-terraform-mode"
   "emacs-telega"
   "emacs-tco-el"
   "emacs-taskrunner"
   "emacs-tao-theme"
   "emacs-tagedit"
   "emacs-tablist"
   "emacs-systemd-mode"
   "emacs-synosaurus"
   "emacs-symon"
   "emacs-symbol-overlay"
   "emacs-sx"
   "emacs-switch-window"
   "emacs-switch-buffer-functions"
   "emacs-suggest"
   "emacs-sudo-edit"
   "emacs-stumpwm-mode"
   "emacs-stripe-buffer"
   "emacs-string-inflection"
   "emacs-stream"
   "emacs-strace-mode"
   "emacs-stickyfunc-enhance"
   "emacs-ssh-config-mode"
   "emacs-ssh-agency"
   "emacs-sr-speedbar"
   "emacs-spinner"
   "emacs-sparql-mode"
   "emacs-spark"
   "emacs-spaceline"
   "emacs-spacegray-theme"
   "emacs-sourcemap"
   "emacs-solarized-theme"
   "emacs-solaire-mode"
   "emacs-so-long"
   "emacs-sml-mode"
   "emacs-smex"
   "emacs-smartparens"
   "emacs-smart-mode-line"
   "emacs-sly"
   "emacs-sly-quicklisp"
   "emacs-sly-package-inferred"
   "emacs-sly-named-readtables"
   "emacs-sly-macrostep"
   "emacs-sly-asdf"
   "emacs-slime"
   "emacs-slime-repl-ansi-color"
   "emacs-slime-company"
   "emacs-slack"
   "emacs-skewer-mode"
   "emacs-skeletor"
   "emacs-simple-mpc"
   "emacs-simple-httpd"
   "emacs-shut-up"
   "emacs-shroud"
   "emacs-shrink-path"
   "emacs-shift-number"
   "emacs-shell-switcher"
   "emacs-shackle"
   "emacs-sesman"
   "emacs-seq"
   "emacs-semantic-refactor"
   "emacs-scroll-on-drag"
   "emacs-scribble-mode"
   "emacs-scratch-el"
   "emacs-scheme-complete"
   "emacs-scel"
   "emacs-s"
   "emacs-rust-mode"
   "emacs-rudel"
   "emacs-rsw-elisp"
   "emacs-rspec"
   "emacs-rpm-spec-mode"
   "emacs-rotate-text"
   "emacs-robot-mode"
   "emacs-robe"
   "emacs-rjsx-mode"
   "emacs-rich-minority"
   "emacs-rfcview"
   "emacs-restclient"
   "emacs-restart-emacs"
   "emacs-request"
   "emacs-repo"
   "emacs-repl-toggle"
   "emacs-relint"
   "emacs-reformatter"
   "emacs-refactor"
   "emacs-redshank"
   "emacs-recent-addresses"
   "emacs-realgud"
   "emacs-rainbow-mode"
   "emacs-rainbow-identifiers"
   "emacs-rainbow-delimiters"
   "emacs-rainbow-blocks"
   "emacs-racket-mode"
   "emacs-queue"
   "emacs-quasi-monochrome"
   "emacs-pyvenv"
   "emacs-python-environment"
   "emacs-pyim"
   "emacs-pyim-basedict"
   "emacs-puppet-mode"
   "emacs-punpun-theme"
   "emacs-pulseaudio-control"
   "emacs-pubmed"
   "emacs-psession"
   "emacs-prop-menu"
   "emacs-projectile"
   "emacs-prodigy-el"
   "emacs-pretty-mode"
   "emacs-prettier"
   "emacs-prescient"
   "emacs-powerline"
   "emacs-posframe"
   "emacs-pos-tip"
   "emacs-popup"
   "emacs-polymode"
   "emacs-polymode-org"
   "emacs-polymode-ansible"
   "emacs-poet-theme"
   "emacs-pkg-info"
   "emacs-pinentry"
   "emacs-picpocket"
   "emacs-php-mode"
   "emacs-phi-search"
   "emacs-phi-search-mc"
   "emacs-pg"
   "emacs-pfuture"
   "emacs-perspective"
   "emacs-peg"
   "emacs-peep-dired"
   "emacs-pdf-tools"
   "emacs-pcre2el"
   "emacs-password-store"
   "emacs-pass"
   "emacs-parseedn"
   "emacs-parseclj"
   "emacs-parsebib"
   "emacs-parinfer-mode"
   "emacs-parent-mode"
   "emacs-paren-face"
   "emacs-paredit"
   "emacs-pandoc-mode"
   "emacs-page-break-lines"
   "emacs-package-lint"
   "emacs-ox-twbs"
   "emacs-ox-pandoc"
   "emacs-ox-hugo"
   "emacs-ox-epub"
   "emacs-ov"
   "emacs-outshine"
   "emacs-outorg"
   "emacs-origami-el"
   "emacs-orgit"
   "emacs-orgalist"
   "emacs-org"
   "emacs-org2web"
   "emacs-org-web-tools"
   "emacs-org-trello"
   "emacs-org-tree-slide"
   "emacs-org-tanglesync"
   "emacs-org-super-agenda"
   "emacs-org-sidebar"
   "emacs-org-rich-yank"
   "emacs-org-reveal"
   "emacs-org-ref"
   "emacs-org-redmine"
   "emacs-org-recent-headings"
   "emacs-org-re-reveal"
   "emacs-org-ql"
   "emacs-org-present"
   "emacs-org-pomodoro"
   "emacs-org-now"
   "emacs-org-noter"
   "emacs-org-mind-map"
   "emacs-org-make-toc"
   "emacs-org-jira"
   "emacs-org-emms"
   "emacs-org-edit-latex"
   "emacs-org-download"
   "emacs-org-contrib"
   "emacs-org-caldav"
   "emacs-org-bullets"
   "emacs-org-brain"
   "emacs-org-auto-expand"
   "emacs-openwith"
   "emacs-on-screen"
   "emacs-olivetti"
   "emacs-ob-restclient"
   "emacs-ob-ipython"
   "emacs-oauth2"
   "emacs-nswbuff"
   "emacs-npm-mode"
   "emacs-nov-el"
   "emacs-noflet"
   "emacs-nodejs-repl"
   "emacs-no-littering"
   "emacs-nnreddit"
   "emacs-nix-mode"
   "emacs-nhexl-mode"
   "emacs-nginx-mode"
   "emacs-neotree"
   "emacs-navi-mode"
   "emacs-names"
   "emacs-mwim"
   "emacs-mustache"
   "emacs-multiple-cursors"
   "emacs-multi-term"
   "emacs-mu4e-patch"
   "emacs-mu4e-jump-to-list"
   "emacs-mu4e-conversation"
   "emacs-mu4e-alert"
   "emacs-mpdel"
   "emacs-move-text"
   "emacs-monroe"
   "emacs-monky"
   "emacs-moe-theme-el"
   "emacs-modus-themes"
   "emacs-mocker"
   "emacs-mmm-mode"
   "emacs-mkmcc-gnuplot-mode"
   "emacs-mixed-pitch"
   "emacs-mit-scheme-doc"
   "emacs-minitest"
   "emacs-minions"
   "emacs-miniedit"
   "emacs-minibuffer-line"
   "emacs-metal-mercury-mode"
   "emacs-message-x"
   "emacs-memoize"
   "emacs-md4rd"
   "emacs-mc-extras"
   "emacs-mbsync"
   "emacs-matrix-client"
   "emacs-math-symbol-lists"
   "emacs-matcha"
   "emacs-mastodon"
   "emacs-markdown-preview-mode"
   "emacs-markdown-mode"
   "emacs-makey"
   "emacs-make-it-so"
   "emacs-magit"
   "emacs-magit-todos"
   "emacs-magit-svn"
   "emacs-magit-popup"
   "emacs-magit-org-todos-el"
   "emacs-magit-gerrit"
   "emacs-macrostep"
   "emacs-m-buffer-el"
   "emacs-lua-mode"
   "emacs-lsp-ui"
   "emacs-lsp-mode"
   "emacs-lsp-lua-emmy"
   "emacs-lsp-java"
   "emacs-lsp-ivy"
   "emacs-lpy"
   "emacs-lorem-ipsum"
   "emacs-loop"
   "emacs-logview"
   "emacs-log4e"
   "emacs-loc-changes"
   "emacs-load-relative"
   "emacs-litable"
   "emacs-list-utils"
   "emacs-lispyville"
   "emacs-lispy"
   "emacs-lisp-extra-font-lock"
   "emacs-linum-relative"
   "emacs-link-hint"
   "emacs-lice-el"
   "emacs-libmpdel"
   "emacs-let-alist"
   "emacs-leetcode"
   "emacs-leaf"
   "emacs-lcr"
   "emacs-lacarte"
   "emacs-kv"
   "emacs-know-your-http-well"
   "emacs-keyfreq"
   "emacs-key-chord"
   "emacs-julia-mode"
   "emacs-json-snatcher"
   "emacs-json-reformat"
   "emacs-json-mode"
   "emacs-js2-refactor-el"
   "emacs-js2-mode"
   "emacs-jinja2-mode"
   "emacs-jedi"
   "emacs-janpath-evil-numbers"
   "emacs-ivy"
   "emacs-ivy-yasnippet"
   "emacs-ivy-xref"
   "emacs-ivy-taskrunner"
   "emacs-ivy-rich"
   "emacs-ivy-pass"
   "emacs-ivy-omni-org"
   "emacs-ivy-clipmenu"
   "emacs-itail"
   "emacs-isearch-prop"
   "emacs-isearch-dabbrev"
   "emacs-isearch+"
   "emacs-irony-mode"
   "emacs-irony-mode-server"
   "emacs-irony-eldoc"
   "emacs-irfc"
   "emacs-interactive-align"
   "emacs-info-plus"
   "emacs-inf-ruby"
   "emacs-image+"
   "emacs-iedit"
   "emacs-idris-mode"
   "emacs-ido-vertical-mode"
   "emacs-ido-ubiquitous"
   "emacs-ido-completing-read+"
   "emacs-idle-highlight"
   "emacs-ibuffer-projectile"
   "emacs-hydra"
   "emacs-hy-mode"
   "emacs-htmlize"
   "emacs-ht"
   "emacs-howm"
   "emacs-hl-todo"
   "emacs-highlight-symbol"
   "emacs-highlight-stages"
   "emacs-highlight-sexp"
   "emacs-highlight-numbers"
   "emacs-highlight-indentation"
   "emacs-highlight-escape-sequences"
   "emacs-highlight-defined"
   "emacs-hierarchy"
   "emacs-hide-mode-line"
   "emacs-hercules"
   "emacs-helpful"
   "emacs-helm"
   "emacs-helm-wikipedia"
   "emacs-helm-taskrunner"
   "emacs-helm-system-packages"
   "emacs-helm-swoop"
   "emacs-helm-sly"
   "emacs-helm-slime"
   "emacs-helm-shell-history"
   "emacs-helm-projectile"
   "emacs-helm-pass"
   "emacs-helm-org"
   "emacs-helm-org-rifle"
   "emacs-helm-org-contacts"
   "emacs-helm-notmuch"
   "emacs-helm-mu"
   "emacs-helm-mode-manager"
   "emacs-helm-make"
   "emacs-helm-lsp"
   "emacs-helm-ls-git"
   "emacs-helm-linux-disks"
   "emacs-helm-lacarte"
   "emacs-helm-gtags"
   "emacs-helm-flycheck"
   "emacs-helm-fish-completion"
   "emacs-helm-firefox"
   "emacs-helm-exwm"
   "emacs-helm-eww"
   "emacs-helm-emms"
   "emacs-helm-descbinds"
   "emacs-helm-dash"
   "emacs-helm-company"
   "emacs-helm-clojuredocs"
   "emacs-helm-cider"
   "emacs-helm-c-yasnippet"
   "emacs-helm-bibtex"
   "emacs-helm-ag"
   "emacs-hcl-mode"
   "emacs-haskell-mode"
   "emacs-handle"
   "emacs-hackernews"
   "emacs-gtk-look"
   "emacs-gruvbox-theme"
   "emacs-groovy-modes"
   "emacs-grep-context"
   "emacs-grep-a-lot"
   "emacs-graphviz-dot-mode"
   "emacs-graphql"
   "emacs-goto-chg"
   "emacs-google-translate"
   "emacs-google-maps"
   "emacs-google-c-style"
   "emacs-god-mode"
   "emacs-go-mode"
   "emacs-gnus-harvest"
   "emacs-gnus-alias"
   "emacs-gnuplot"
   "emacs-gnugo"
   "emacs-gntp"
   "emacs-gitpatch"
   "emacs-gitlab-ci-mode"
   "emacs-github-review"
   "emacs-git-timemachine"
   "emacs-git-modes"
   "emacs-git-messenger"
   "emacs-git-link"
   "emacs-git-gutter"
   "emacs-git-gutter-fringe"
   "emacs-git-auto-commit-mode"
   "emacs-git-annex"
   "emacs-gif-screencast"
   "emacs-ghub"
   "emacs-ggtags"
   "emacs-general"
   "emacs-geiser"
   "emacs-fullframe"
   "emacs-frog-menu"
   "emacs-frog-jump-buffer"
   "emacs-fringe-helper"
   "emacs-frecency"
   "emacs-frame-purpose"
   "emacs-forge"
   "emacs-fold-dwim"
   "emacs-focus"
   "emacs-flyspell-correct"
   "emacs-flycheck"
   "emacs-flycheck-irony"
   "emacs-flycheck-haskell"
   ;"emacs-flycheck-grammalecte" ;build fails
   "emacs-flycheck-flow"
   "emacs-flycheck-cpplint"
   "emacs-flx"
   "emacs-flow-minor-mode"
   "emacs-fish-mode"
   "emacs-fish-completion"
   "emacs-find-file-in-project"
   "emacs-finalize"
   "emacs-fill-column-indicator"
   "emacs-ffap-rfc-space"
   "emacs-fancy-narrow"
   "emacs-faceup"
   "emacs-f"
   "emacs-f3"
   "emacs-exwm"
   "emacs-exwm-x"
   "emacs-exwm-edit"
   "emacs-extend-smime"
   "emacs-extempore-mode"
   "emacs-expand-region"
   "emacs-exec-path-from-shell"
   "emacs-eww-lnum"
   "emacs-ewmctrl"
   "emacs-evil"
   "emacs-evil-visualstar"
   "emacs-evil-visual-replace"
   "emacs-evil-traces"
   "emacs-evil-textobj-syntax"
   "emacs-evil-text-object-python"
   "emacs-evil-surround"
   "emacs-evil-smartparens"
   "emacs-evil-replace-with-register"
   "emacs-evil-quickscope"
   "emacs-evil-owl"
   "emacs-evil-org"
   "emacs-evil-numbers"
   "emacs-evil-nerd-commenter"
   "emacs-evil-multiedit"
   "emacs-evil-mc"
   "emacs-evil-matchit"
   "emacs-evil-markdown"
   "emacs-evil-magit"
   "emacs-evil-lion"
   "emacs-evil-indent-plus"
   "emacs-evil-expat"
   "emacs-evil-exchange"
   "emacs-evil-commentary"
   "emacs-evil-collection"
   "emacs-evil-cleverparens"
   "emacs-evil-args"
   "emacs-evil-anzu"
   "emacs-eval-sexp-fu-el"
   "emacs-esxml"
   "emacs-esup"
   "emacs-espuds"
   "emacs-eshell-z"
   "emacs-eshell-up"
   "emacs-eshell-toggle"
   "emacs-eshell-prompt-extras"
   "emacs-eshell-did-you-mean"
   "emacs-eshell-bookmark"
   "emacs-esh-help"
   "emacs-esh-autosuggest"
   "emacs-es-mode"
   "emacs-ert-runner"
   "emacs-ert-expectations"
   "emacs-ert-async"
   "emacs-eros"
   "emacs-ergoemacs-mode"
   "emacs-erc-scrolltoplace"
   "emacs-erc-image"
   "emacs-erc-hl-nicks"
   "emacs-equake"
   "emacs-eprime"
   "emacs-epl"
   "emacs-epkg"
   "emacs-epc"
   "emacs-engine-mode"
   "emacs-emojify"
   "emacs-emms"
   "emacs-emms-mode-line-cycle"
   "emacs-emmet-mode"
   "emacs-emamux"
   "emacs-emacsql"
   "emacs-elpy"
   "emacs-elpher"
   "emacs-elmacro"
   "emacs-elixir-mode"
   "emacs-elisp-slime-nav"
   "emacs-elisp-refs"
   "emacs-elisp-docstring-mode"
   "emacs-elisp-demos"
   "emacs-elfeed"
   "emacs-elfeed-org"
   "emacs-el2org"
   "emacs-el-x"
   "emacs-el-search"
   "emacs-el-patch"
   "emacs-el-mock"
   "emacs-eimp"
   "emacs-edn"
   "emacs-editorconfig"
   "emacs-edit-server"
   "emacs-edit-indirect"
   "emacs-ediprolog"
  ; "emacs-edbi" ;build fails
  ; "emacs-edbi-sqlite" ;(depends on emacs-edbi)
   "emacs-ebuild-mode"
   "emacs-ebib"
   "emacs-ebdb"
   "emacs-easy-kill"
   "emacs-eacl"
   "emacs-e2wm"
   "emacs-dumb-jump"
   "emacs-dts-mode"
   "emacs-dtrt-indent"
   "emacs-dream-theme"
   "emacs-download-region"
   "emacs-dotenv-mode"
   "emacs-doom-modeline"
   "emacs-dockerfile-mode"
   "emacs-docker"
   "emacs-docker-tramp"
   "emacs-docker-compose-mode"
   "emacs-dmenu"
   "emacs-djvu"
   "emacs-disk-usage"
   "emacs-discover-my-major"
   "emacs-disable-mouse"
   "emacs-direnv"
   "emacs-dired-toggle-sudo"
   "emacs-dired-sidebar"
   "emacs-dired-rsync"
   "emacs-dired-hacks"
   "emacs-dired-du"
   "emacs-dimmer"
   "emacs-diminish"
   "emacs-diff-hl"
   "emacs-desktop-environment"
   "emacs-delight"
   "emacs-deft"
   "emacs-deferred"
   "emacs-default-text-scale"
   "emacs-default-encrypt"
   "emacs-dedicated"
   "emacs-debpaste"
   "emacs-debbugs"
   "emacs-deadgrep"
   "emacs-datetime"
   "emacs-dashboard"
   "emacs-dash"
   "emacs-dash-docs"
   "emacs-darkroom"
   "emacs-dante"
   "emacs-danneskjold-theme"
   "emacs-daemons"
   "emacs-d-mode"
   "emacs-cyberpunk-theme"
   "emacs-ctable"
   "emacs-csv-mode"
   "emacs-crux"
   "emacs-counsel-tramp"
   "emacs-counsel-projectile"
   "emacs-counsel-etags"
   "emacs-counsel-dash"
   "emacs-constants"
   "emacs-compdef"
   "emacs-company"
   "emacs-company-restclient"
   "emacs-company-quickhelp"
   "emacs-company-posframe"
   "emacs-company-math"
   "emacs-company-lua"
   "emacs-company-lsp"
   "emacs-company-jedi"
   "emacs-company-irony"
   "emacs-company-flow"
   "emacs-company-ebdb"
   "emacs-company-cabal"
   "emacs-company-auctex"
   "emacs-commander"
   "emacs-column-marker"
   "emacs-cnfonts"
   "emacs-cmake-font-lock"
   "emacs-closql"
   "emacs-clojure-mode"
   "emacs-cl-print"
   "emacs-cl-generic"
   "emacs-circe"
   "emacs-cider"
   "emacs-cdlatex"
   "emacs-ccls"
   "emacs-calfw"
   "emacs-buttercup"
   "emacs-butler"
   "emacs-build-farm"
   "emacs-bui"
   "emacs-bug-hunter"
   "emacs-browse-at-remote"
   "emacs-boxquote"
   "emacs-bongo"
   "emacs-blimp"
   "emacs-blackout"
   "emacs-biblio"
   "emacs-better-defaults"
   "emacs-benchmark-init"
   "emacs-beginend"
   "emacs-bbdb"
   "emacs-bash-completion"
   "emacs-base16-theme"
   "emacs-avy"
   "emacs-autothemer"
   "emacs-auto-yasnippet"
   "emacs-auto-complete"
   "emacs-auth-source-pass"
   "emacs-auctex"
   "emacs-attrap"
   "emacs-atom-one-dark-theme"
   "emacs-async"
   "emacs-ascii-art-to-unicode"
   "emacs-arduino-mode"
   "emacs-apheleia"
   "emacs-anzu"
   "emacs-ansi"
   "emacs-annalist"
   "emacs-anaphora"
   "emacs-amx"
   "emacs-ample-theme"
   "emacs-ample-regexps"
   "emacs-almost-mono-themes"
   "emacs-all-the-icons"
   "emacs-all-the-icons-dired"
   "emacs-alert"
   "emacs-alect-themes"
   "emacs-ahungry-theme"
   "emacs-aggressive-indent"
   "emacs-ag"
   "emacs-adoc-mode"
   "emacs-add-node-modules-path"
   "emacs-add-hooks"
   "emacs-adaptive-wrap"
   "emacs-ace-window"
   "emacs-ace-link"
   "emacs-ace-jump-mode"
   "emacs-academic-phrases"
   "emacs-a"
   "emacs-2048-game"
   "emacs-tuareg"
   "emacs-recutils"
   "emacs-protobuf-mode"
   "emacs-mew"
   "emacs-ledger-mode"
   "emacs-flycheck-dedukti"
   "emacs-ess"
   "emacs-erlang"
   "emacs-dedukti-mode"
   "emacs-cmake-mode"
   "emacs-clang-rename"
   "emacs-clang-format"
   "emacs-ansible-doc"
   "emacs-agda2-mode"))

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0001-gnu-emacs-Byte-compile-the-site-lisp-directory.patch --]
[-- Type: text/x-patch, Size: 4846 bytes --]

From 7ee79cdaa04a2531adf64cdac38c565774e24da5 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 5 Dec 2019 13:40:32 +0900
Subject: [PATCH 1/7] gnu: emacs: Byte compile the site-lisp directory.

* gnu/packages/emacs.scm (emacs): Use the (gnu build emacs-utils) module.
Byte compile the site-lisp directory as part of the 'install-site-start'
phase.
(emacs-minimal, emacs-xwidgets, emacs-no-x, emacs-no-x-toolkit): Reset modules
to those of the gnu-build-system.
---
 gnu/packages/emacs.scm | 43 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index b26c928e87..18c8549cb9 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -129,6 +129,11 @@
      `(#:tests? #f                      ; no check target
        #:configure-flags (list "--with-modules"
                                "--disable-build-details")
+       #:modules ((guix build emacs-utils)
+                  (guix build glib-or-gtk-build-system)
+                  (guix build utils))
+       #:imported-modules ((guix build emacs-utils)
+                           ,@%glib-or-gtk-build-system-modules)
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'fix-/bin/pwd
@@ -145,7 +150,8 @@
            ;; automatically found.
            (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")))
                (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")
@@ -158,6 +164,9 @@
                ;; share/emacs/site-lisp union when added to EMACSLOADPATH,
                ;; which leads to conflicts.
                (delete-file (string-append lisp-dir "/subdirs.el"))
+               ;; Byte compile the site-start files.
+               (parameterize ((%emacs emacs))
+                 (emacs-byte-compile-directory lisp-dir))
                #t))))))
     (inputs
      `(("gnutls" ,gnutls)
@@ -326,6 +335,12 @@ languages.")
     (build-system gnu-build-system)
     (arguments
      (substitute-keyword-arguments (package-arguments emacs)
+       ((#:modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
+       ((#:imported-modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'install-site-start)))
@@ -345,6 +360,12 @@ editor (with xwidgets support)")
     (build-system gnu-build-system)
     (arguments
      (substitute-keyword-arguments (package-arguments emacs)
+       ((#:modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
+       ((#:imported-modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
        ((#:configure-flags flags ''())
         `(cons "--with-xwidgets" ,flags))))
     (inputs
@@ -358,6 +379,14 @@ editor (with xwidgets support)")
     (synopsis "The extensible, customizable, self-documenting text
 editor (console only)")
     (build-system gnu-build-system)
+    (arguments
+     (substitute-keyword-arguments (package-arguments emacs)
+       ((#:modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
+       ((#:imported-modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))))
     (inputs (fold alist-delete
                   (package-inputs emacs)
                   '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
@@ -376,9 +405,15 @@ editor (without an X toolkit)" )
     (inputs (append `(("inotify-tools" ,inotify-tools))
                     (alist-delete "gtk+" (package-inputs emacs))))
     (arguments
-     `(,@(substitute-keyword-arguments (package-arguments emacs)
-           ((#:configure-flags cf)
-            `(cons "--with-x-toolkit=no" ,cf)))))))
+     (substitute-keyword-arguments (package-arguments emacs)
+       ((#:modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
+       ((#:imported-modules _)
+        `((guix build emacs-utils)
+          ,@%gnu-build-system-modules))
+       ((#:configure-flags cf)
+        `(cons "--with-x-toolkit=no" ,cf))))))
 
 (define-public guile-emacs
   (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
-- 
2.25.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: 0002-emacs-build-system-Byte-compile-the-autoload-files.patch --]
[-- Type: text/x-patch, Size: 4849 bytes --]

From 17c0eb0499196600ceb516ad67b010c281e1b188 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 6 Dec 2019 15:12:32 +0900
Subject: [PATCH 2/7] 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 05fc9709b6..25a87ee52d 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 09de244993..219310cf08 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 885fd0a217..ab64e3714c 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
-- 
2.25.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.5: 0003-gnu-emacs-Fix-comment.patch --]
[-- Type: text/x-patch, Size: 1228 bytes --]

From 8f4044b385252b914feff6584ac683e16935006e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 27 Feb 2020 14:20:58 -0500
Subject: [PATCH 3/7] gnu: emacs: Fix comment.

* gnu/packages/emacs.scm (emacs): Fix comment.
---
 gnu/packages/emacs.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 18c8549cb9..fd9c7fa875 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -144,10 +144,8 @@
                 "pwd"))
              #t))
          (add-after 'install 'install-site-start
-           ;; Use 'guix-emacs' in "site-start.el".  This way, Emacs packages
-           ;; provided by Guix and installed in
-           ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
-           ;; automatically found.
+           ;; Use 'guix-emacs' in "site-start.el", which is used autoload the
+           ;; 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"))
-- 
2.25.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.6: 0004-gnu-emacs-cl-generic-Disable-byte-compilation-of-its.patch --]
[-- Type: text/x-patch, Size: 1191 bytes --]

From 9a91d7018ea0d2749f88014c7dd0d1a4bfb99fba Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 7 Dec 2019 02:47:25 +0900
Subject: [PATCH 4/7] gnu: emacs-cl-generic: Disable byte compilation of its
 autoload file.

*gnu/packages/emacs-xyz.scm (emacs-cl-generic)[phases]
{enable-autoloads-compilation}: Delete.
---
 gnu/packages/emacs-xyz.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 76b9746f69..7235ef611a 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -12066,6 +12066,10 @@ match and total match information in the mode-line in various search modes.")
         (base32
          "0vb338bhjpsnrf60qgxny4z5rjrnifahnrv9axd4shay89d894zq"))))
     (build-system emacs-build-system)
+    ;; Byte compilation of the autoload file fails.
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (delete 'enable-autoloads-compilation))))
     (home-page "https://elpa.gnu.org/packages/seq.html")
     (synopsis
      "Forward @code{cl-generic} compatibility for Emacs before version 25")
-- 
2.25.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.7: 0005-gnu-emacs-sly-macrostep-Remove-the-enable-autoloads-.patch --]
[-- Type: text/x-patch, Size: 1097 bytes --]

From 070c392b7af00b054ee4fe86548d621fbba8d1bb Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 27 Feb 2020 16:00:58 -0500
Subject: [PATCH 5/7] gnu: emacs-sly-macrostep: Remove the
 enable-autoloads-compilation phase.

* gnu/packages/emacs-xyz.scm (emacs-sly-macrostep)[phases]
{enable-autoloads-compilation}: Remove.
---
 gnu/packages/emacs-xyz.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 7235ef611a..9bb636f75e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -7567,7 +7567,8 @@ file.")
          #:phases
          ;; The package provides autoloads.
          (modify-phases %standard-phases
-           (delete 'make-autoloads))))
+           (delete 'make-autoloads)
+           (delete 'enable-autoloads-compilation))))
       (synopsis "Expand Common Lisp macros inside source files with SLY")
       (description
        "@command{sly-macrostep} is a SLY contrib for expanding CL macros right
-- 
2.25.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.8: 0006-gnu-emacs-sly-quicklisp-Remove-the-enable-autoloads-.patch --]
[-- Type: text/x-patch, Size: 1126 bytes --]

From 2e6c80424943ce8a14fe901dfc5db4afeda64006 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 27 Feb 2020 16:03:33 -0500
Subject: [PATCH 6/7] gnu: emacs-sly-quicklisp: Remove the
 enable-autoloads-compilation phase.

* gnu/packages/emacs-xyz.scm (emacs-sly-quicklisp)[phases]
{enable-autoloads-compilation}: Remove.
---
 gnu/packages/emacs-xyz.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 9bb636f75e..faf3a55ba1 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -7476,7 +7476,8 @@ xref, etc...) are still available, but with better integration.")
          #:phases
          ;; The package provides autoloads.
          (modify-phases %standard-phases
-           (delete 'make-autoloads))))
+           (delete 'make-autoloads)
+           (delete 'enable-autoloads-compilation))))
       (synopsis "Quicklisp support for SLY")
       (description
        "@command{sly-quicklisp} is an external contrib for SLY that provides a
-- 
2.25.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.9: 0007-gnu-emacs-sly-named-readtables-Disable-byte-compilat.patch --]
[-- Type: text/x-patch, Size: 1295 bytes --]

From 8e6dfcf318d3f88ae131b737483c1b3bd0139f2e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 27 Feb 2020 16:07:06 -0500
Subject: [PATCH 7/7] gnu: emacs-sly-named-readtables: Disable byte compilation
 of its autoload file.

*gnu/packages/emacs-xyz.scm (emacs-sly-named-readtables)[phases]
{enable-autoloads-compilation}: Delete.
---
 gnu/packages/emacs-xyz.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index faf3a55ba1..ca8392c896 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -7534,7 +7534,10 @@ additional support for working with ASDF projects.")
       (propagated-inputs
        `(("emacs-sly" ,emacs-sly)))
       (arguments
-       '(#:include (cons* "\\.lisp$" "\\.asd$" %default-include)))
+       '(#:include (cons* "\\.lisp$" "\\.asd$" %default-include)
+         #:phases (modify-phases %standard-phases
+                    ;; Byte compilation of the autoload file fails.
+                    (delete 'enable-autoloads-compilation))))
       (synopsis "Named-readtables support for SLY")
       (description
        "@command{sly-named-readtables} is an external contrib for SLY that
-- 
2.25.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#38619] Byte compilation of Emacs autoloads
  2020-02-27 21:53   ` Maxim Cournoyer
@ 2020-02-28  7:03     ` Pierre Neidhardt
  2020-02-28 13:25       ` bug#38619: " Maxim Cournoyer
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Neidhardt @ 2020-02-28  7:03 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 38619

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

Hi Maxim,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Eager macro-expansion failure: (file-missing "Searching for program" "No such file or directory" "git")
> Searching for program: No such file or directory, git

What's up with that?  Is this an problem in one of our packages?

>   ; "emacs-edbi" ;build fails
>   ; "emacs-edbi-sqlite" ;(depends on emacs-edbi)

I might have packaged these some time back.
I'll see if I can fix them.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#38619: Byte compilation of Emacs autoloads
  2020-02-28  7:03     ` Pierre Neidhardt
@ 2020-02-28 13:25       ` Maxim Cournoyer
  2020-02-28 13:38         ` [bug#38619] " Pierre Neidhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2020-02-28 13:25 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 38619-done

Hi Pierre!

On February 28, 2020 7:03:42 AM UTC, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>Hi Maxim,
>
>Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> Eager macro-expansion failure: (file-missing "Searching for program"
>"No such file or directory" "git")
>> Searching for program: No such file or directory, git
>
>What's up with that?  Is this an problem in one of our packages?

It looks like evaluating the emacs-tuareg autoload file causes the message to be emitted. I'd look this way.

>>   ; "emacs-edbi" ;build fails
>>   ; "emacs-edbi-sqlite" ;(depends on emacs-edbi)

If I'm not mistaken, Efraim promptly fixed those already, after I reported it.

I'm closing this bug, since the changes have been merged to master.

Enjoy!

Maxim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#38619] Byte compilation of Emacs autoloads
  2020-02-28 13:25       ` bug#38619: " Maxim Cournoyer
@ 2020-02-28 13:38         ` Pierre Neidhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Pierre Neidhardt @ 2020-02-28 13:38 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 38619-done

[-- Attachment #1: Type: text/plain, Size: 63 bytes --]

Thanks a lot!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-28 13:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15  4:30 [bug#38619] Byte compilation of Emacs autoloads Maxim Cournoyer
2020-02-27 10:15 ` Pierre Neidhardt
2020-02-27 14:39   ` Maxim Cournoyer
2020-02-27 21:53   ` Maxim Cournoyer
2020-02-28  7:03     ` Pierre Neidhardt
2020-02-28 13:25       ` bug#38619: " Maxim Cournoyer
2020-02-28 13:38         ` [bug#38619] " Pierre Neidhardt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).