unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31018] [PATCH] Improvements for our Emacs build system and fixes.
@ 2018-04-01 15:57 Maxim Cournoyer
  2018-04-13 20:41 ` Arun Isaac
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Maxim Cournoyer @ 2018-04-01 15:57 UTC (permalink / raw)
  To: 31018

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

Hello Guix!

This patch set strengthens our Emacs build system by enforcing strict
byte compilation of every Guix package using the `emacs-build-system'.

Before, errors during byte compilation would not signal a failure of the
build.

It also adds a custom check phase to make it easy to run any kind of
program or script that might be used as a test runner (commonly
ert-runner, sometimes make, etc.).

I've validated that our Emacs packages (at least those whose name start by
'emacs-') can be successfully built with those changes (240 were built
locally). Most of the patches below were necessary fixes to our Emacs
packages so that they could be successfully byte compiled.

Happy April Fools' Day ;)

Maxim


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-build-system-Consider-all-inputs-for-Elisp-dep.patch --]
[-- Type: text/x-patch, Size: 3870 bytes --]

From 103834761802992380d45e31c5e8c833772aed90 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 29 Mar 2018 20:52:41 -0400
Subject: [PATCH 01/27] emacs-build-system: Consider all inputs for Elisp
 dependencies.

* guix/build/emacs-build-system.scm (emacs-inputs): Remove.
(emacs-inputs-directories): Rename to...
(inputs->directories): this, and adapt for any input.
(emacs-input->el-directory): Rename to...
(inputs->el-directories): this, and adapt for any input.
(set-emacs-load-path): Now use inputs->el-directories and
inputs->el-directories.
---
 guix/build/emacs-build-system.scm | 44 +++++++++++++--------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index b77984742..ba9ec88e4 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -76,8 +76,8 @@ archive, a directory, or an Emacs Lisp file."
 
 (define* (set-emacs-load-path #:key inputs #:allow-other-keys)
   "Set the EMACSLOADPATH environment variable so that dependencies are found."
-  (let* ((input-elisp-dirs (emacs-inputs-el-directories
-                            (emacs-inputs-directories inputs)))
+  (let* ((input-elisp-dirs (inputs->el-directories
+                            (inputs->directories inputs)))
          (emacs-load-path-value (string-join
                                  input-elisp-dirs ":" 'suffix)))
     (setenv "EMACSLOADPATH" emacs-load-path-value)
@@ -210,39 +210,25 @@ store in '.el' files."
   "Check if NAME correspond to the name of an Emacs package."
   (string-prefix? "emacs-" name))
 
-(define (emacs-inputs inputs)
-  "Retrieve the list of Emacs packages from INPUTS."
-  (filter (match-lambda
-            ((label . directory)
-             (emacs-package? ((compose package-name->name+version
-                                       strip-store-file-name)
-                              directory)))
-            (_ #f))
-          inputs))
+(define (inputs->directories inputs)
+  "Extract the directory part from INPUTS."
+  (match inputs
+    (((names . directories) ...) directories)))
 
-(define (emacs-inputs-directories inputs)
-  "Extract the list of Emacs package directories from INPUTS."
-  (let ((inputs (emacs-inputs inputs)))
-    (match inputs
-      (((names . directories) ...) directories))))
-
-(define (emacs-input->el-directory emacs-input)
-  "Return the correct Elisp directory location of EMACS-INPUT or #f if none."
-  (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix))
+(define (input->el-directory input-dir)
+  "Return the correct Elisp directory location of INPUT-DIR-DIR or #f."
+  (let ((legacy-elisp-dir (string-append input-dir %legacy-install-suffix))
         (guix-elisp-dir (string-append
-                         emacs-input %install-suffix "/"
-                         (store-directory->elpa-name-version emacs-input))))
+                         input-dir %install-suffix "/"
+                         (store-directory->elpa-name-version input-dir))))
     (cond
      ((file-exists? guix-elisp-dir) guix-elisp-dir)
      ((file-exists? legacy-elisp-dir) legacy-elisp-dir)
-     (else (format #t "warning: could not locate elisp directory under `~a'\n"
-                   emacs-input)
-           #f))))
+     (else #f))))
 
-(define (emacs-inputs-el-directories dirs)
-  "Build the list of Emacs Lisp directories from the Emacs package directory
-DIRS."
-  (filter-map emacs-input->el-directory dirs))
+(define (inputs->el-directories input-dirs)
+  "Build the list of Emacs Lisp directories from the INPUT-DIRS."
+  (filter-map input->el-directory input-dirs))
 
 (define (package-name-version->elpa-name-version name-ver)
   "Convert the Guix package NAME-VER to the corresponding ELPA name-version
-- 
2.16.1


[-- Attachment #3: 0002-emacs-build-system-Add-improved-check-phase-fixes.patch --]
[-- Type: text/x-patch, Size: 7807 bytes --]

From a394694d131212f844b8adee8916aff24f5cb9aa Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 11 Feb 2018 00:51:26 -0500
Subject: [PATCH 02/27] emacs-build-system: Add improved check phase, fixes.

* guix/build-system/emacs.scm (emacs-build): Remove `test-target' and
'configure-flags' arguments. Add `test-command' argument.
* guix/build/emacs-build-system.scm (unpack): Add the unpacked directory to
the EMACSLOADPATH.
(check): New procedure.
(make-autoloads): No need to return #t explicitly since the function now uses
`invoke'.
(%standard-phases)[set-emacs-load-path]: Move after `unpack'.
[check]: Register after the `build' phase.
* guix/build/emacs-utils.scm (guix): Use (guix build utils) for `invoke'.
(emacs-batch-eval): Replace `system*' usage with `invoke'.
(emacs-batch-edit-file): Likewise.
(emacs-byte-compile-directory): Make it fail when there are compilation
errors.
---
 guix/build-system/emacs.scm       |  6 ++----
 guix/build/emacs-build-system.scm | 36 ++++++++++++++++++++++++++++--------
 guix/build/emacs-utils.scm        | 18 ++++++++++--------
 3 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index d9f1a8d28..ef6d1b339 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -84,8 +84,7 @@
                       #:key source
                       (tests? #f)
                       (parallel-tests? #t)
-                      (test-target "test")
-                      (configure-flags ''())
+                      (test-command ''("make" "check"))
                       (phases '(@ (guix build emacs-build-system)
                                   %standard-phases))
                       (outputs '("out"))
@@ -110,9 +109,8 @@
                                  source)
                                 (source
                                  source))
-                    #:configure-flags ,configure-flags
                     #:system ,system
-                    #:test-target ,test-target
+                    #:test-command ,test-command
                     #:tests? ,tests?
                     #:phases ,phases
                     #:outputs %outputs
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index ba9ec88e4..44d63b146 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -74,12 +74,14 @@ archive, a directory, or an Emacs Lisp file."
         #t)
       (gnu:unpack #:source source)))
 
-(define* (set-emacs-load-path #:key inputs #:allow-other-keys)
+(define* (set-emacs-load-path #:key source inputs #:allow-other-keys)
   "Set the EMACSLOADPATH environment variable so that dependencies are found."
-  (let* ((input-elisp-dirs (inputs->el-directories
+  (let* ((source-dir (getcwd))
+         (input-elisp-dirs (inputs->el-directories
                             (inputs->directories inputs)))
          (emacs-load-path-value (string-join
-                                 input-elisp-dirs ":" 'suffix)))
+                                 `(,@input-elisp-dirs
+                                   ,source-dir) ":" 'suffix)))
     (setenv "EMACSLOADPATH" emacs-load-path-value)
     (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
             emacs-load-path-value)))
@@ -133,6 +135,24 @@ store in '.el' files."
           (substitute-program-names))))
     #t))
 
+(define* (check #:key target (tests? (not target))
+                (test-command '("make" "check")) (parallel-tests? #t)
+                #:allow-other-keys)
+  "Like the gnu-build-system check phase, but with a way to pass a custom test
+program command line, using TEST-COMMAND."
+  (let* ((test-program (car test-command))
+         (test-args (cdr test-command))
+         (using-make? (string=? test-program "make")))
+    (if tests?
+        (apply invoke test-program
+               `(,@test-args
+                 ,@(if (and using-make? parallel-tests?)
+                       `("-j" ,(number->string (parallel-job-count)))
+                       '())))
+        (begin
+          (format #t "test suite not run~%")
+          #t))))
+
 (define* (install #:key outputs
                   (include %default-include)
                   (exclude %default-exclude)
@@ -203,8 +223,7 @@ store in '.el' files."
          (elpa-name (package-name->name+version elpa-name-ver))
          (el-dir (string-append out %install-suffix "/" elpa-name-ver)))
     (parameterize ((%emacs emacs))
-      (emacs-generate-autoloads elpa-name el-dir))
-    #t))
+      (emacs-generate-autoloads elpa-name el-dir))))
 
 (define (emacs-package? name)
   "Check if NAME correspond to the name of an Emacs package."
@@ -246,12 +265,13 @@ second hyphen.  This corresponds to 'name-version' as used in ELPA packages."
 
 (define %standard-phases
   (modify-phases gnu:%standard-phases
-    (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path)
     (replace 'unpack unpack)
+    (add-after 'unpack 'set-emacs-load-path set-emacs-load-path)
     (delete 'configure)
-    ;; Move the build phase after install: the .el files are byte compiled
-    ;; directly in the store.
+    ;; Move the build phase after install: the .el files are byte
+    ;; compiled directly in the store.
     (delete 'build)
+    (replace 'check check)
     (replace 'install install)
     (add-after 'install 'build build)
     (add-after 'install 'make-autoloads make-autoloads)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8389ca582..eed17667b 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -18,6 +19,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix build emacs-utils)
+  #:use-module (guix build utils)
   #:export (%emacs
             emacs-batch-eval
             emacs-batch-edit-file
@@ -39,16 +41,14 @@
 
 (define (emacs-batch-eval expr)
   "Run Emacs in batch mode, and execute the elisp code EXPR."
-  (unless (zero? (system* (%emacs) "--quick" "--batch"
-                          (format #f "--eval=~S" expr)))
-    (error "emacs-batch-eval failed!" expr)))
+  (invoke (%emacs) "--quick" "--batch"
+          (format #f "--eval=~S" expr)))
 
 (define (emacs-batch-edit-file file expr)
   "Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
-  (unless (zero? (system* (%emacs) "--quick" "--batch"
-                          (string-append "--visit=" file)
-                          (format #f "--eval=~S" expr)))
-    (error "emacs-batch-edit-file failed!" file expr)))
+  (invoke (%emacs) "--quick" "--batch"
+          (string-append "--visit=" file)
+          (format #f "--eval=~S" expr)))
 
 (define (emacs-generate-autoloads name directory)
   "Generate autoloads for Emacs package NAME placed in DIRECTORY."
@@ -60,7 +60,9 @@
 
 (define* (emacs-byte-compile-directory dir)
   "Byte compile all files in DIR and its sub-directories."
-  (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0)))
+  (let ((expr `(progn
+                (setq byte-compile-debug t) ;for proper exit status
+                (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
     (emacs-batch-eval expr)))
 
 (define-syntax emacs-substitute-sexps
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-Adjust-ert-runner-wrapper-to-honor-EMACSLOADPATH.patch --]
[-- Type: text/x-patch, Size: 1079 bytes --]

From 407a80cef16ec9f8afadc78b3f59a0c5e930a0e6 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 12 Feb 2018 22:11:38 -0500
Subject: [PATCH 03/27] gnu: Adjust ert-runner wrapper to honor EMACSLOADPATH.

* gnu/packages/emacs.scm (ert-runner): Use 'prefix instead of '= for setting
the EMACSLOADPATH environment variable.
---
 gnu/packages/emacs.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index ce9b1a66a..e9f79ae68 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6123,7 +6123,7 @@ Emacs.")
                                    ,name "-" ,version)))
                  (install-file "bin/ert-runner" (string-append out "/bin"))
                  (wrap-program (string-append out "/bin/ert-runner")
-                   (list "EMACSLOADPATH" ":" '=
+                   (list "EMACSLOADPATH" ":" 'prefix
                          (append
                           ,(match dependencies
                              (((labels packages) ...)
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-Adapt-Emacs-packages-to-use-the-new-check-phase.patch --]
[-- Type: text/x-patch, Size: 15988 bytes --]

From 8c4d5790f8087784832d27edc9a151dac79bda06 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 12 Feb 2018 23:02:11 -0500
Subject: [PATCH 04/27] gnu: Adapt Emacs packages to use the new check phase.

* gnu/packages/emacs.scm (emacs-dash, emacs-s, emacs-string-inflection,
emacs-company, emacs-clojure-mode, emacs-julia-mode, emacs-elfeed,
emacs-memoize, emacs-use-package, emacs-xmlgen, emacs-json-reformat,
emacs-which-key, emacs-ws-butler, emacs-git-messenger, emacs-browse-at-remote,
emacs-evil-quickscope): Adapt to use new check phase.
(emacs-json-reformat)[inputs]: Move to...
[native-inputs]: here. Add ert-runner.
(emacs-company): Refactor fix-bin-dir phase.
(emacs-git-messenger)[native-inputs]: Add ert-runner.
---
 gnu/packages/emacs.scm | 218 +++++++++++++++++--------------------------------
 1 file changed, 77 insertions(+), 141 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e9f79ae68..05ef61f08 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1509,11 +1509,8 @@ and stored in memory.")
                 "1pjlkrzr8n45bnp3xs3dybvy0nz3gwamrfc7vsi1nhpkkw99ihhb"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-                     (lambda _
-                       (zero? (system* "./run-tests.sh")))))))
+     `(#:tests? #t
+       #:test-command '("sh" "run-tests.sh")))
     (home-page "https://github.com/magnars/dash.el")
     (synopsis "Modern list library for Emacs")
     (description "This package provides a modern list API library for Emacs.")
@@ -1706,11 +1703,8 @@ allows easily move between them.")
                 "0xbl75863pcm806zg0x1lw7qznzjq2c8320k8js7apyag8q4srvh"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-                     (lambda _
-                       (zero? (system* "./run-tests.sh")))))))
+     `(#:tests? #t
+       #:test-command '("sh" "run-tests.sh")))
     (home-page "https://github.com/magnars/s.el")
     (synopsis "Emacs string manipulation library")
     (description "This package provides an Emacs library for manipulating
@@ -2195,11 +2189,8 @@ in Lisp modes.")
     (native-inputs
      `(("ert-runner" ,ert-runner)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "ert-runner")))))))
+     `(#:tests? #t
+       #:test-command '("ert-runner")))
     (home-page "https://github.com/akicho8/string-inflection")
     (synopsis "Convert symbol names between different naming conventions")
     (description
@@ -2497,15 +2488,16 @@ build jobs.")
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (add-before 'install 'check
+         (add-before 'check 'fix-bin-dir
            (lambda _
              ;; The company-files-candidates-normal-root test looks
              ;; for the /bin directory, but the build environment has
              ;; no /bin directory. Modify the test to look for the
              ;; /tmp directory.
              (substitute* "test/files-tests.el"
-               (("/bin/") "/tmp/"))
-             (zero? (system* "make" "test-batch")))))))
+               (("/bin/") "/tmp/")))))
+       #:tests? #t
+       #:test-command '("make" "test-batch")))
     (home-page "http://company-mode.github.io/")
     (synopsis "Modular text completion framework")
     (description
@@ -3533,11 +3525,8 @@ S-expression.")
        ("emacs-s" ,emacs-s)
        ("ert-runner" ,ert-runner)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'check
-           (lambda _
-             (zero? (system* "ert-runner")))))))
+     `(#:tests? #t
+       #:test-command '("ert-runner")))
     (home-page "https://github.com/clojure-emacs/clojure-mode")
     (synopsis "Major mode for Clojure code")
     (description
@@ -3716,14 +3705,11 @@ E-Prime forbids the use of the \"to be\" form to strengthen your writing.")
            "1is4dcv6blslpzbjcg8l2jpxi8xj96q4cm0nxjxsyswpm8bw8ki0"))))
       (build-system emacs-build-system)
       (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-before 'install 'check
-             (lambda _
-               (zero? (system* "emacs" "-batch"
-                               "-l" "julia-mode.el"
-                               "-l" "julia-mode-tests.el"
-                               "-f" "ert-run-tests-batch-and-exit")))))))
+       `(#:tests? #t
+         #:test-command '("emacs" "-batch"
+                          "-l" "julia-mode.el"
+                          "-l" "julia-mode-tests.el"
+                          "-f" "ert-run-tests-batch-and-exit")))
       (home-page "https://github.com/JuliaEditorSupport/julia-emacs")
       (synopsis "Major mode for Julia")
       (description "This Emacs package provides a mode for the Julia
@@ -3914,11 +3900,8 @@ If you want to mark a folder manually as a project just create an empty
                 "0d7i93l3b0ck3iad9ddqp7sqa8w16hnamrby8bwvl316rqk4lzlf"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "make" "test")))))))
+     `(#:tests? #t
+       #:test-command '("make" "test")))
     (home-page "https://github.com/skeeto/elfeed")
     (synopsis "Atom/RSS feed reader for Emacs")
     (description
@@ -5076,32 +5059,30 @@ Yasnippet.")
 
 (define-public emacs-memoize
   (package
-   (name "emacs-memoize")
-   (version "20130421.b55eab0")
-   (source
-    (origin
-     (method git-fetch)
-     (uri (git-reference
-           (url "https://github.com/skeeto/emacs-memoize")
-           (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
-     (file-name (string-append name "-" version ".tar.gz"))
-     (sha256
-      (base32
-       "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
-   (build-system emacs-build-system)
-   (arguments
-    `(#:phases
-      (modify-phases %standard-phases
-        (add-before 'install 'check
-                    (lambda _
-                      (zero? (system* "emacs" "-batch" "-l" "memoize.el"
-                                      "-l" "memoize-test.el"
-                                      "-f" "ert-run-tests-batch-and-exit")))))))
-   (home-page "https://github.com/skeeto/emacs-memoize")
-   (synopsis "Emacs lisp memoization library")
-   (description "@code{emacs-memoize} is an Emacs library for
+    (name "emacs-memoize")
+    (version "20130421.b55eab0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/skeeto/emacs-memoize")
+             (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
+    (build-system emacs-build-system)
+    (arguments
+     `(#:tests? #t
+       #:test-command '("emacs" "-batch"
+                        "-l" "memoize.el"
+                        "-l" "memoize-test.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
+    (home-page "https://github.com/skeeto/emacs-memoize")
+    (synopsis "Emacs lisp memoization library")
+    (description "@code{emacs-memoize} is an Emacs library for
 memoizing functions.")
-   (license license:unlicense)))
+    (license license:unlicense)))
 
 (define-public emacs-linum-relative
   (package
@@ -5379,16 +5360,12 @@ abbreviation of the mode line displays (lighters) of minor modes.")
     (propagated-inputs
      `(("emacs-diminish" ,emacs-diminish)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-l" "use-package-tests.el"
-                             "-f" "ert-run-tests-batch-and-exit"))
-             ;; Tests fail in this release, but have been fixed in
-             ;; upstream commit 7956d40eed57d6c06bef36ebc174cf57d934e30d
-             #t)))))
+     ;; Tests fail in this release, but have been fixed in
+     ;; upstream commit 7956d40eed57d6c06bef36ebc174cf57d934e30d
+     `(#:tests? #f
+       #:test-command '("emacs" "--batch"
+                        "-l" "use-package-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/jwiegley/use-package")
     (synopsis "Declaration for simplifying your .emacs")
     (description "The use-package macro allows you to isolate package
@@ -5483,13 +5460,10 @@ fonts is supported.")
          "0zay490vjby3f7455r0vydmjg7q1gwc78hilpfb0rg4gwz224z8r"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-l" "xmlgen-test.el"
-                             "-f" "ert-run-tests-batch-and-exit")))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch" "-L" "."
+                        "-l" "xmlgen-test.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/philjackson/xmlgen")
     (synopsis "S-expression to XML domain specific language (DSL) in
 Emacs Lisp")
@@ -6186,32 +6160,15 @@ running a customisable handler command (@code{ignore} by default). ")
          "11fbq4scrgr7m0iwnzcrn2g7xvqwm2gf82sa7zy1l0nil7265p28"))
        (patches (search-patches "emacs-json-reformat-fix-tests.patch"))))
     (build-system emacs-build-system)
-    (propagated-inputs `(("emacs-undercover" ,emacs-undercover)))
-    (inputs
-     `(("emacs-dash" ,emacs-dash)         ; for tests
-       ("emacs-shut-up" ,emacs-shut-up))) ; for tests
+    (propagated-inputs
+     `(("emacs-undercover" ,emacs-undercover)))
+    (native-inputs
+     `(("ert-runner" ,ert-runner)
+       ("emacs-dash" ,emacs-dash)
+       ("emacs-shut-up" ,emacs-shut-up)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-undercover")
-                                   "/share/emacs/site-lisp/guix.d/undercover-"
-                                   ,(package-version emacs-undercover))
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-dash")
-                                   "/share/emacs/site-lisp/guix.d/dash-"
-                                   ,(package-version emacs-dash))
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-shut-up")
-                                   "/share/emacs/site-lisp/guix.d/shut-up-"
-                                   ,(package-version emacs-shut-up))
-                             "-l" "test/test-helper.el"
-                             "-l" "test/json-reformat-test.el"
-                             "-f" "ert-run-tests-batch-and-exit"))
-             #t)))))
+     `(#:tests? #t
+       #:test-command '("ert-runner")))
     (home-page "https://github.com/gongo/json-reformat")
     (synopsis "Reformatting tool for JSON")
     (description "@code{json-reformat} provides a reformatting tool for
@@ -6347,13 +6304,10 @@ displays results pretty-printed in XML or JSON with @code{restclient-mode}")
        (file-name (string-append name "-" version ".tar.gz"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-l" "which-key-tests.el"
-                             "-f" "ert-run-tests-batch-and-exit")))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch"
+                        "-l" "which-key-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/justbur/emacs-which-key")
     (synopsis "Display available key bindings in popup")
     (description
@@ -6382,11 +6336,8 @@ settings).")
     (native-inputs
      `(("ert-runner" ,ert-runner)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "ert-runner" "tests")))))))
+     `(#:tests? #t
+       #:test-command '("ert-runner" "tests")))
     (home-page "https://github.com/lewang/ws-butler")
     (synopsis "Trim spaces from end of lines")
     (description
@@ -6480,20 +6431,14 @@ editing RPM spec files.")
         (base32
          "17mqki6g0wx46fn7dcbcc2pjxik7vvrcb1j9jzxim8b9psbsbnp9"))))
     (build-system emacs-build-system)
+    (native-inputs
+     `(("ert-runner" ,ert-runner)))
     (propagated-inputs
      `(("emacs-popup" ,emacs-popup)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-popup")
-                                   "/share/emacs/site-lisp/guix.d/popup-"
-                                   ,(package-version emacs-popup))
-                             "-l" "test/test.el"
-                             "-f" "ert-run-tests-batch-and-exit")))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch" "-l" "test/test.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/syohex/emacs-git-messenger")
     (synopsis "Popup commit message at current line")
     (description "@code{emacs-git-messenger} provides
@@ -6653,11 +6598,8 @@ Idris.")
       (native-inputs
        `(("ert-runner" ,ert-runner)))
       (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-before 'install 'check
-             (lambda _
-               (zero? (system* "ert-runner")))))))
+       `(#:tests? #t
+         #:test-command '("ert-runner")))
       (home-page "https://github.com/rmuslimov/browse-at-remote")
       (synopsis "Open github/gitlab/bitbucket/stash page from Emacs")
       (description
@@ -7075,16 +7017,10 @@ emulates Vim features and provides Vim-like key bindings.")
     (propagated-inputs
      `(("emacs-evil" ,emacs-evil)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (invoke "emacs" "--batch" "-L"
-                     (string-append (assoc-ref inputs "emacs-evil")
-                                    "/share/emacs/site-lisp/guix.d/evil-"
-                                    ,(package-version emacs-evil))
-                     "-l" "evil-quickscope-tests.el"
-                     "-f" "ert-run-tests-batch-and-exit"))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch"
+                        "-l" "evil-quickscope-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/blorbx/evil-quickscope")
     (synopsis "Target highlighting for emacs evil-mode f,F,t and T commands")
     (description "@code{emacs-evil-quickscope} highlights targets for Evil
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-emacs-pdf-tools-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1219 bytes --]

From ebef14d5e028b19cf1d0827207491542b5616975 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 14:08:15 -0400
Subject: [PATCH 05/27] gnu: emacs-pdf-tools: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-pdf-tools)[phases]: Add set-emacs-load-path.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 05ef61f08..aa4d35a5b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1469,7 +1469,9 @@ filters, new key bindings and faces.  It can be enabled by
              ;; upgrading" that pdf-tools tries to perform.
              (emacs-substitute-variables "pdf-tools.el"
                ("pdf-tools-handle-upgrades" '()))))
-         (add-after 'emacs-patch-variables 'emacs-install
+         (add-after 'emacs-patch-variables 'set-emacs-load-path
+           (assoc-ref emacs:%standard-phases 'set-emacs-load-path))
+         (add-after 'add-cwd-to-load-path 'emacs-install
            (assoc-ref emacs:%standard-phases 'install))
          (add-after 'emacs-install 'emacs-build
            (assoc-ref emacs:%standard-phases 'build))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-Add-emacs-ert-expectations.patch --]
[-- Type: text/x-patch, Size: 1441 bytes --]

From 1b04b1d85ad55dcca4852a02fa1e83802e6d555a Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 14:15:45 -0400
Subject: [PATCH 06/27] gnu: Add emacs-ert-expectations.

* gnu/packages/emacs.scm (emacs-ert-expectations): New variable.
---
 gnu/packages/emacs.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index aa4d35a5b..cfbdcc9f3 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2423,6 +2423,23 @@ A minor mode @code{debbugs-browse-mode} let you browse URLs to the GNU Bug
 Tracker as well as bug identifiers prepared for @code{bug-reference-mode}.")
     (license license:gpl3+)))
 
+(define-public emacs-ert-expectations
+  (package
+    (name "emacs-ert-expectations")
+    (version "0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri "https://www.emacswiki.org/emacs/download/ert-expectations.el")
+       (sha256
+        (base32
+         "0cwy3ilsid90abzzjb7ha2blq9kmv3gfp3icwwfcz6qczgirq6g7"))))
+    (build-system emacs-build-system)
+    (home-page "https://www.emacswiki.org/emacs/download/ert-expectations.el")
+    (synopsis "Simple unit test framework for Emacs")
+    (description "A very simple unit test framework to use with @code{ERT}.")
+    (license license:gpl3+)))
+
 (define-public emacs-deferred
   (package
     (name "emacs-deferred")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-gnu-emacs-deferred-Enable-tests.patch --]
[-- Type: text/x-patch, Size: 1950 bytes --]

From 9177d71b30c33903ed194a8281f6a1090f3e82c6 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:01:05 -0400
Subject: [PATCH 07/27] gnu: emacs-deferred: Enable tests.

* gnu/packages/emacs.scm (emacs-deferred)[phases]: Add fix-makefile.
[tests?]: Set to #t
[test-command]: Add.
[native-inputs]: Add ert-runner, emacs-ert-expectations and emacs-undercover.
---
 gnu/packages/emacs.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index cfbdcc9f3..648dbfb24 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2455,7 +2455,24 @@ Tracker as well as bug identifiers prepared for @code{bug-reference-mode}.")
                 "0xy9zb6wwkgwhcxdnslqk52bq3z24chgk6prqi4ks0qcf2bwyh5h"))
               (file-name (string-append name "-" version))))
     (build-system emacs-build-system)
-    ;; FIXME: Would need 'el-expectations' to actually run tests.
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'fix-makefile
+           (lambda _
+             (substitute* "Makefile"
+               (("\\$\\(CASK\\) exec ") ""))
+             #t)))
+       #:tests? #t
+       ;; FIXME: Normally we'd run the "test" target but for some reason the
+       ;; test-deferred target fails when run in the Guix build environment
+       ;; with the error: (file-error "Searching for program" "No such file or
+       ;; directory" "/bin/sh").
+       #:test-command '("make" "test-concurrent" "test-concurrent-compiled")))
+    (native-inputs
+     `(("ert-runner" ,ert-runner)
+       ("emacs-ert-expectations" ,emacs-ert-expectations)
+       ("emacs-undercover" ,emacs-undercover)))
     (synopsis "Simple asynchronous functions for Emacs Lisp")
     (description
      "The @code{deferred.el} library provides support for asynchronous tasks.
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-gnu-emacs-org-trello-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1073 bytes --]

From 6c66fcb691b8e247db791dd16ee079543fa244b0 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:03:35 -0400
Subject: [PATCH 08/27] gnu: emacs-org-trello: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-org-trello)[native-inputs]: Add emacs-f and
emacs-helm.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 648dbfb24..e52b00393 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2973,7 +2973,9 @@ started with 20 minutes.  All values are customizable.")
      `(("emacs-deferred" ,emacs-deferred)
        ("emacs-request" ,emacs-request)
        ("emacs-dash" ,emacs-dash)
-       ("emacs-s" ,emacs-s)))
+       ("emacs-s" ,emacs-s)
+       ("emacs-f" ,emacs-f)
+       ("emacs-helm" ,emacs-helm)))
     (home-page "https://org-trello.github.io")
     (synopsis "Emacs minor mode for interacting with Trello")
     (description "This package provides an Emacs minor mode to extend
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-gnu-emacs-smartparens-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1117 bytes --]

From 4f56723c3a94a67bbf3d70b50372d54f4aedce8f Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:05:28 -0400
Subject: [PATCH 09/27] gnu: emacs-smartparens: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-smartparens)[propagated-inputs]: Add
emacs-markdown-mode.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e52b00393..5fd95a636 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3102,7 +3102,9 @@ single theme but a set of guidelines with numerous implementations.")
                (base32
                 "0q5as813xs8y29i3v2rm97phd6m7xsmmw6hwbvx57gwmi8i1c409"))))
     (build-system emacs-build-system)
-    (propagated-inputs `(("emacs-dash" ,emacs-dash)))
+    (propagated-inputs
+     `(("emacs-dash" ,emacs-dash)
+       ("emacs-markdown-mode" ,emacs-markdown-mode)))
     (home-page "https://github.com/Fuco1/smartparens")
     (synopsis "Paredit-like insertion, wrapping and navigation with user
 defined pairs")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-gnu-emacs-realgud-Adapt-phase-for-the-reworked-emacs.patch --]
[-- Type: text/x-patch, Size: 964 bytes --]

From 22ac5d931c1e1d377c614e86b78aa512e25f9982 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:09:38 -0400
Subject: [PATCH 10/27] gnu: emacs-realgud: Adapt phase for the reworked
 emacs-build-system.

* gnu/packages/emacs.scm (emacs-realgud)[phases]: Move the fix-autogen-script
after the set-emacs-load-path phase.
---
 gnu/packages/emacs.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5fd95a636..4c7bba5b2 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3283,7 +3283,7 @@ after buffer changes.")
      `(#:tests? #t
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'fix-autogen-script
+         (add-after 'set-emacs-load-path 'fix-autogen-script
            (lambda _
              (substitute* "autogen.sh"
                (("./configure") "sh configure"))))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: 0011-gnu-emacs-request-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 974 bytes --]

From 2e683c9706f283703de7c7b437a48b093e836616 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:11:53 -0400
Subject: [PATCH 11/27] gnu: emacs-request: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-request)[propagated-inputs]: Add emacs-deferred.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4c7bba5b2..377a04153 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3337,6 +3337,8 @@ parallel.")
                (base32
                 "0wyxqbb35yqf6ci47531lk32d6fppamx9d8826kdz983vm87him7"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-deferred" ,emacs-deferred)))
     (home-page "https://github.com/tkf/emacs-request")
     (synopsis "Package for speaking HTTP in Emacs Lisp")
     (description "This package provides a HTTP request library with multiple
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #13: 0012-gnu-emacs-idris-mode-Fix-hash.patch --]
[-- Type: text/x-patch, Size: 910 bytes --]

From ca084b686b198a8ba13176a66ffb8e6e0c6bd365 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 19 Mar 2018 21:13:33 -0400
Subject: [PATCH 12/27] gnu: emacs-idris-mode: Fix hash.

* gnu/packages/emacs.scm (emacs-idris-mode): Fix hash.
---
 gnu/packages/emacs.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 377a04153..5c97a0f0c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6602,7 +6602,7 @@ key.  Optionally, a mouse pop-up can be added by binding
              version ".tar"))
        (sha256
         (base32
-         "0ld4kfwnyyhlsnj5f6cbn4is4mpxdqalk2aifkw02r00mbr9n294"))))
+         "0qm4gngl6lqvra7kmivz99y3ymrg36nvqh5y9gy6gq0aa0v8az46"))))
     (build-system emacs-build-system)
     (propagated-inputs
      `(("emacs-prop-menu" ,emacs-prop-menu)))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #14: 0013-gnu-emacs-sx-Fix-build-issue.patch --]
[-- Type: text/x-patch, Size: 2631 bytes --]

From b55edc3c6d17ad45062a551fdc9d26e927b0cf75 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 19 Mar 2018 21:28:42 -0400
Subject: [PATCH 13/27] gnu: emacs-sx: Fix build issue.

The package would fail building when attempting to create a cache
directory.  This has been fixed upstream but not in a tagged release.

* gnu/packages/emacs.scm (emacs-sx): Update to latest git version.
---
 gnu/packages/emacs.scm | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5c97a0f0c..4f6b0f9cd 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1734,26 +1734,30 @@ strings.")
     (license license:gpl2+)))
 
 (define-public emacs-sx
-  (package
-    (name "emacs-sx")
-    (version "0.4")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/vermiculus/sx.el/"
-                                  "archive/v" version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "1w0xghfljqg31axcnv8gzlrd8pw25nji6idnrhflq0af9qh1dw03"))))
-    (build-system emacs-build-system)
-    (propagated-inputs
-     `(("emacs-markdown-mode" ,emacs-markdown-mode)))
-    (home-page "https://github.com/vermiculus/sx.el/")
-    (synopsis "Emacs StackExchange client")
-    (description
-     "Emacs StackExchange client.  Ask and answer questions on
+  (let ((version "20180212")
+        (revision "1")
+        (commit "833435fbf90d1c9e927d165b155f3b1ef39271de"))
+    (package
+      (name "emacs-sx")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/vermiculus/sx.el")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1369xaxq1vy3d9yh862ddnhddikdpg2d0wv1ly00pnvdp9v4cqgd"))))
+      (build-system emacs-build-system)
+      (propagated-inputs
+       `(("emacs-markdown-mode" ,emacs-markdown-mode)))
+      (home-page "https://github.com/vermiculus/sx.el")
+      (synopsis "Emacs StackExchange client")
+      (description
+       "Emacs StackExchange client.  Ask and answer questions on
 Stack Overflow, Super User, and other StackExchange sites.")
-    (license license:gpl3+)))
+      (license license:gpl3+))))
 
 (define-public emacs-f
   (package
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #15: 0014-gnu-emacs-polymode-Fix-compilation-error.patch --]
[-- Type: text/x-patch, Size: 1363 bytes --]

From fbc0f30c2df7857f3f853c5051ef6848dac32919 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 19 Mar 2018 21:55:27 -0400
Subject: [PATCH 14/27] gnu: emacs-polymode: Fix compilation error.

* gnu/packages/emacs.scm (emacs-polymode)
[add-modes-subdir-to-loadpath]: New phase.
---
 gnu/packages/emacs.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4f6b0f9cd..cdd4904f7 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6932,6 +6932,15 @@ contexts.
                  (base32
                   "057cybkq3cy07n5s332k071sjiky3mziy003lza4rh75mgqkwhmh"))))
       (build-system emacs-build-system)
+      (arguments
+       `(#:include (cons* "^modes/.*\\.el$" %default-include)
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'set-emacs-load-path 'add-modes-subdir-to-load-path
+             (lambda _
+               (setenv "EMACSLOADPATH"
+                       (string-append (getenv "EMACSLOADPATH")
+                                      ":" (getcwd) "/modes" ":")))))))
       (home-page "https://github.com/vspinu/polymode")
       (synopsis "Framework for multiple Emacs modes based on indirect buffers")
       (description "Polymode is an Emacs package that offers generic support
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #16: 0015-gnu-Add-emacs-scel.patch --]
[-- Type: text/x-patch, Size: 3153 bytes --]

From 172e42ae07cb5585d83403d3afc7c83c10d8c53f Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 18 Mar 2018 16:37:30 -0400
Subject: [PATCH 15/27] gnu: Add emacs-scel.

* gnu/packages/emacs.scm (emacs-scel): New variable.
---
 gnu/packages/emacs.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index cdd4904f7..420c0526b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2643,6 +2643,59 @@ implementation in Emacs.  To use it just load this file and bind that function
 to a key in your preferred mode.")
       (license license:public-domain))))
 
+(define-public emacs-scel
+  (let ((version "20170629")
+        (revision "1")
+        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
+    (package
+      (name "emacs-scel")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/supercollider/scel.git")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'move-el-files
+             (lambda _
+               (for-each
+                (lambda (f)
+                  (rename-file f (basename f)))
+                (find-files "el" "^.*\\.el(\\.in)?$"))
+               #t))
+           (add-after 'move-el-files 'configure-sclang-vars
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((supercollider (assoc-ref inputs "supercollider")))
+                 (substitute* "sclang-vars.el.in"
+                   (("@PKG_DATA_DIR@")
+                    (string-append supercollider "/share/SuperCollider"))
+                   ;; See: https://github.com/widp/el-supercollider/issues/1
+                   (("Help") "HelpSource")))
+               (rename-file "sclang-vars.el.in" "sclang-vars.el")
+               #t))
+           (add-after 'configure-sclang-vars 'install-extensions
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (ext-dir (string-append
+                                out "/share/SuperCollider/Extensions"
+                                "/scide_scel")))
+                 (delete-file "sc/CMakeLists.txt")
+                 (copy-recursively "sc" ext-dir))
+               #t)))))
+      (inputs
+       `(("supercollider" ,supercollider)))
+      (home-page "https://github.com/supercollider/scel")
+      (synopsis "SuperCollider Emacs interface")
+      (description "scel is an Emacs based interface to SuperCollider.")
+      (license license:gpl2+))))
+
 (define-public emacs-mit-scheme-doc
   (package
     (name "emacs-mit-scheme-doc")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #17: 0016-gnu-Add-emacs-kv.patch --]
[-- Type: text/x-patch, Size: 1721 bytes --]

From 086aa7bcec4cea5c5942f6b86772fa9ac71848c0 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 24 Mar 2018 21:37:41 -0400
Subject: [PATCH 16/27] gnu: Add emacs-kv.

* gnu/packages/emacs.scm (emacs-kv): New variable.
---
 gnu/packages/emacs.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 420c0526b..f8696d301 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7245,6 +7245,31 @@ scratch buffer, and, by virtue of this extension, do so using the Emacs
 formatting rules for that language.")
       (license license:bsd-2))))
 
+(define-public emacs-kv
+  (package
+    (name "emacs-kv")
+    (version "0.0.19")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nicferrier/emacs-kv.git")
+                    (commit "721148475bce38a70e0b678ba8aa923652e8900e")))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0r0lz2s6gvy04fwnafai668jsf4546h4k6zd6isx5wpk0n33pj5m"))))
+    (build-system emacs-build-system)
+    (arguments
+     `(#:tests? #t
+       #:test-command '("ert-runner" "kv-tests.el")))
+    (native-inputs
+     `(("ert-runner" ,ert-runner)))
+    (home-page "https://github.com/nicferrier/emacs-kv")
+    (synopsis "Key/value data structures library")
+    (description "A collection of tools for dealing with key/value data
+structures such as plists, alists and hash-tables.")
+    (license license:gpl3+)))
+
 (define-public emacs-esxml
   (package
     (name "emacs-esxml")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #18: 0017-gnu-emacs-esxml-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1987 bytes --]

From 6f270606bf6505a845437db5a11cd6e2d636010a Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 24 Mar 2018 23:07:18 -0400
Subject: [PATCH 17/27] gnu: emacs-esxml: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-esxml): Add phases to patch sources.
---
 gnu/packages/emacs.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index f8696d301..999831c6a 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7284,6 +7284,32 @@ structures such as plists, alists and hash-tables.")
                (base32
                 "00vv8a75wdklygdyr4km9mc2ismxak69c45jmcny41xl44rp9x8m"))))
     (build-system emacs-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; See: https://github.com/tali713/esxml/pull/28.
+         (add-after 'unpack 'fix-css-lite.el
+           (lambda _
+             (substitute* "css-lite.el"
+               ((";;; main interface")
+                (string-append ";;; main interface\n"
+                               "(require 'cl-lib)"))
+               (("mapcan")
+                "cl-mapcan")
+               (("',\\(cl-mapcan #'process-css-rule rules\\)")
+                "(cl-mapcan #'process-css-rule ',rules)"))
+             #t))
+         (add-after 'fix-css-lite.el 'fix-esxml-form.el
+           (lambda _
+             (substitute* "esxml-form.el"
+               ((",esxml-form-field-defn")
+                "#'esxml-form-field-defn"))))
+         ;; See: https://github.com/tali713/esxml/issues/25
+         (add-after 'fix-esxml-form.el 'rm-broken-test-file.el
+           (lambda _
+             (delete-file "esxpath.el"))))))
+    (propagated-inputs
+     `(("emacs-kv" ,emacs-kv)))
     (home-page "https://github.com/tali713/esxml/")
     (synopsis "SXML for EmacsLisp")
     (description "This is XML/XHTML done with S-Expressions in EmacsLisp.
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #19: 0018-gnu-emacs-mu4e-alert-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1274 bytes --]

From b0d12ab881d3827862727f8dd3c5501bc93f3038 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 28 Mar 2018 20:56:18 -0400
Subject: [PATCH 18/27] gnu: emacs-mu4e-alert: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-mu4e-alert)[propagated-inputs]: Add mu.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 999831c6a..3eb64e4ae 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -89,6 +89,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages acl)
+  #:use-module (gnu packages mail)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pdf)
@@ -5023,7 +5024,8 @@ customizable by the user.")
          "07qc834qnxn8xi4bw5nawj8g91bmkzw0r0vahkgysp7r9xrf57gj"))))
     (build-system emacs-build-system)
     (propagated-inputs
-     `(("emacs-alert" ,emacs-alert)
+     `(("mu" ,mu)                       ;for byte compilation
+       ("emacs-alert" ,emacs-alert)
        ("emacs-s" ,emacs-s)
        ("emacs-ht" ,emacs-ht)))
     (home-page "https://github.com/iqbalansari/mu4e-alert")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #20: 0019-gnu-emacs-org-contrib-Fix-hash-and-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 943 bytes --]

From 9a3a449121246a2d26a92ee5c19d905768789a10 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 28 Mar 2018 21:50:15 -0400
Subject: [PATCH 19/27] gnu: emacs-org-contrib: Fix hash and byte compilation.

* gnu/packages/emacs.scm (emacs-org-contrib)[native-inputs]: Add emacs-scel.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 3eb64e4ae..a79d15d33 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -4638,6 +4638,8 @@ reproducible research.")
                     out "/share/emacs/site-lisp/guix.d/org-contrib-" ,version)
                  (for-each delete-file duplicates))
                #t))))))
+    (native-inputs
+     `(("emacs-scel" ,emacs-scel))) ;for byte compilation
     (propagated-inputs
      `(("emacs-org" ,emacs-org)))
     (synopsis "Contributed packages to Org mode")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #21: 0020-gnu-emacs-evil-matchit-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 888 bytes --]

From 9b5c7216ecb00e433a22687d6a54eba2f20ac0eb Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 20:41:48 -0400
Subject: [PATCH 20/27] gnu: emacs-evil-matchit: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-evil-matchit)[propagated-inputs]: Add
emacs-evil.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index a79d15d33..afa57e65c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7080,6 +7080,8 @@ Feautures:
         (base32
          "1hm0k53m7d8zv2pk4p93k5mmilsv1mz7y2z6dqf7r6f0zmncs31a"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("evil" ,emacs-evil)))
     (home-page "https://github.com/redguardtoo/evil-matchit")
     (synopsis "Vim matchit ported into Emacs")
     (description
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #22: 0021-gnu-Add-emacs-spark.patch --]
[-- Type: text/x-patch, Size: 1718 bytes --]

From f6642cee6419a1e720070673767b7a30e3d132bb Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 21:18:16 -0400
Subject: [PATCH 21/27] gnu: Add emacs-spark.

* gnu/packages/emacs.scm (emacs-spark): New variable.
---
 gnu/packages/emacs.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index afa57e65c..b8601f868 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1907,6 +1907,29 @@ Expectations, but it can be used in other contexts.")
 definitions for testing with the Ecukes framework.")
     (license license:gpl3+)))
 
+(define-public emacs-spark
+  (let ((version "20160503")            ;no proper tag, use date of commit
+        (commit "0bf148c3ede3b31d56fd75f347cdd0b0eae60025")
+        (revision "1"))
+    (package
+      (name "emacs-spark")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/alvinfrancis/spark.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1ykqr86j17mi95s08d9fp02d7ych1331b04dcqxzxnmpkhwngyj1"))))
+      (build-system emacs-build-system)
+      (home-page "https://github.com/alvinfrancis/spark")
+      (synopsis "Port of cl-spark to Emacs Lisp")
+      (description "This library is a straightforward port of @code{cl-spark}
+to Emacs Lisp.")
+      (license license:expat))))
+
 (define-public emacs-es-mode
   (package
     (name "emacs-es-mode")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #23: 0022-gnu-emacs-es-mode-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1078 bytes --]

From 09b506e8ac6a948a7e788f7e621ea3805e497a3e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 21:18:36 -0400
Subject: [PATCH 22/27] gnu: emacs-es-mode: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-es-mode)[propagated-inputs]: Add emacs-dash
and emacs-spark.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index b8601f868..1362aed31 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1947,7 +1947,9 @@ to Emacs Lisp.")
     (propagated-inputs
      ;; The version of org in Emacs 24.5 is not sufficient, and causes tables
      ;; to be rendered incorrectly
-     `(("emacs-org" ,emacs-org)))
+     `(("emacs-org" ,emacs-org)
+       ("emacs-dash" ,emacs-dash)
+       ("emacs-spark" ,emacs-spark)))
     (home-page "https://github.com/dakrone/es-mode")
     (synopsis "Major mode for editing Elasticsearch queries")
     (description "@code{es-mode} includes highlighting, completion and
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #24: 0023-gnu-Add-emacs-eimp.patch --]
[-- Type: text/x-patch, Size: 2506 bytes --]

From af77425293a4fba3cc5c5742c69d531507a8becb Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 21:46:35 -0400
Subject: [PATCH 23/27] gnu: Add emacs-eimp.

* gnu/packages/emacs.scm (emacs-eimp): New variable.
---
 gnu/packages/emacs.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1362aed31..6bffd10ed 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6374,6 +6374,44 @@ from within Emacs.  Restclient runs queries from a plan-text query sheet,
 displays results pretty-printed in XML or JSON with @code{restclient-mode}")
       (license license:public-domain))))
 
+(define-public emacs-eimp
+  (let ((version "1.4.0")
+        (commit "2e7536fe6d8f7faf1bad7a8ae37faba0162c3b4f")
+        (revision "1"))
+    (package
+      (name "emacs-eimp")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/nicferrier/eimp.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "154d57yafxbcf39r89n5j43c86rp2fki3lw3gwy7ww2g6qkclcra"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-mogrify-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((imagemagick (assoc-ref inputs "imagemagick")))
+                 ;; eimp.el is read-only in git.
+                 (invoke "chmod" "+w" "eimp.el")
+                 (emacs-substitute-variables "eimp.el"
+                   ("eimp-mogrify-program"
+                    (string-append imagemagick "/bin/mogrify"))))
+               #t)))))
+    (inputs
+     `(("imagemagick" ,imagemagick)))   ;provides the mogrify binary.
+    (home-page "https://github.com/nicferrier/eimp")
+    (synopsis "Interactive image manipulation from within Emacs")
+    (description "This package allows interactive image manipulation from
+within Emacs.  It uses the code@{mogrify} utility from ImageMagick to do the
+actual transformations.")
+    (license license:gpl2+))))
+
 (define-public emacs-dired-hacks
   (let ((commit "eda68006ce73bbf6b9b995bfd70d08bec8cade36")
         (revision "1"))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #25: 0024-gnu-emacs-dired-hacks-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 853 bytes --]

From 95cf21463f6ec9141df70aec5403851afdda0e82 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 22:56:29 -0400
Subject: [PATCH 24/27] gnu: emacs-dired-hacks: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-dired-hacks)[propagated-inputs]: Add emacs-eimp.
---
 gnu/packages/emacs.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 6bffd10ed..0332e7e9e 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6431,6 +6431,7 @@ actual transformations.")
       (build-system emacs-build-system)
       (propagated-inputs
        `(("emacs-dash" ,emacs-dash)
+         ("emacs-eimp" ,emacs-eimp)
          ("emacs-f" ,emacs-f)
          ("emacs-s" ,emacs-s)))
       (home-page "https://github.com/Fuco1/dired-hacks")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #26: 0025-gnu-emacs-cdlatex-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 910 bytes --]

From 0b3fb16665fe7b2ca4818496857af1426eb766e9 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 23:16:10 -0400
Subject: [PATCH 25/27] gnu: emacs-cdlatex: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-cdlatex)[propagated-inputs]: Add emacs-auctex.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0332e7e9e..c7e53333a 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -5614,6 +5614,8 @@ conversion for Emacs Lisp.")
         (base32
          "0pivapphmykc6vhvpx7hdyl55ls37vc4jcrxpvs4yk7jzcmwa9xp"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-auctex" ,emacs-auctex)))
     (home-page "https://github.com/cdominik/cdlatex")
     (synopsis "Fast Emacs input methods for LaTeX environments and
 math")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #27: 0026-gnu-Add-emacs-howm.patch --]
[-- Type: text/x-patch, Size: 1493 bytes --]

From c303e1b7a0b0e96bc49521973c4d2187c25f8af1 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 00:22:24 -0400
Subject: [PATCH 26/27] gnu: Add emacs-howm.

* gnu/packages/emacs.scm (emacs-howm): New variable.
---
 gnu/packages/emacs.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index c7e53333a..803994308 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1182,6 +1182,25 @@ or XEmacs.")
 a set of simplified face specifications and a user-supplied color palette")
     (license license:gpl3+)))
 
+(define-public emacs-howm
+  (package
+    (name "emacs-howm")
+    (version "1.4.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://howm.sourceforge.jp/a/howm-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0ddm91l6z58j7x59fa966j6q1rg4cinyza4r8ibg80hprn5h31qk"))))
+    (build-system emacs-build-system)
+    (home-page "http://howm.osdn.jp/")
+    (synopsis "Note-taking tool for Emacs")
+    (description "Howm is a note-taking tool for Emacs.  Like with
+code@{emacs-wiki.el}, it facilitates using hyperlinks and doing full-text
+searches.  Unlike code@{emacs-wiki.el}, it can be combined with any format.")
+    (license license:gpl1+)))
+
 (define-public emacs-calfw
   (package
     (name "emacs-calfw")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #28: 0027-gnu-emacs-calfw-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 943 bytes --]

From 915b8088ecd2d1367b0844ed0eacd249e87aec76 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 00:25:23 -0400
Subject: [PATCH 27/27] gnu: emacs-calfw: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-calfw)[propagated-inputs]: Add emacs-howm.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 803994308..ccd997d91 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1216,6 +1216,8 @@ searches.  Unlike code@{emacs-wiki.el}, it can be combined with any format.")
         (base32
          "17ssg8gx66yp63nhygjq2r6kgl4h45cacmrxsxs9f0lrfcx37k0l"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-howm" ,emacs-howm)))
     (home-page "https://github.com/kiwanami/emacs-calfw/")
     (synopsis "Calendar framework for Emacs")
     (description
-- 
2.16.1


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

* [bug#31018] [PATCH] Improvements for our Emacs build system and fixes.
  2018-04-01 15:57 [bug#31018] [PATCH] Improvements for our Emacs build system and fixes Maxim Cournoyer
@ 2018-04-13 20:41 ` Arun Isaac
       [not found] ` <faec7bc3.AM8AAAStCIYAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0RYW@mailjet.com>
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Arun Isaac @ 2018-04-13 20:41 UTC (permalink / raw)
  To: Maxim Cournoyer, 31018


This is a very long patchset, and it's getting a little unwieldy to
review. I'll start by pushing some of the simpler patches to
master. Then, we can come back and discuss the rest.

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

* [bug#31018] [PATCH] Improvements for our Emacs build system and fixes.
       [not found] ` <faec7bc3.AM8AAAStCIYAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0RYW@mailjet.com>
@ 2018-04-14  1:28   ` Maxim Cournoyer
  0 siblings, 0 replies; 11+ messages in thread
From: Maxim Cournoyer @ 2018-04-14  1:28 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 31018

Arun Isaac <arunisaac@systemreboot.net> writes:

> This is a very long patchset, and it's getting a little unwieldy to
> review. I'll start by pushing some of the simpler patches to
> master. Then, we can come back and discuss the rest.

Sounds reasonable, as long as you understand that some packages will
break (well, they are silently broken right now already) if the build
system patches and the package fixes are not merged at the same time.

Thank you for helping with this review :)

Maxim

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

* [bug#31018] [PATCH] Improvements for our Emacs build system and fixes.
  2018-04-01 15:57 [bug#31018] [PATCH] Improvements for our Emacs build system and fixes Maxim Cournoyer
  2018-04-13 20:41 ` Arun Isaac
       [not found] ` <faec7bc3.AM8AAAStCIYAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0RYW@mailjet.com>
@ 2018-04-14 16:51 ` Arun Isaac
       [not found] ` <9925e912.AM4AAAS8QCUAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0jGH@mailjet.com>
       [not found] ` <handler.31018.D31018.152536517825664.notifdone@debbugs.gnu.org>
  4 siblings, 0 replies; 11+ messages in thread
From: Arun Isaac @ 2018-04-14 16:51 UTC (permalink / raw)
  To: Maxim Cournoyer, 31018


I've pushed the patches concerning ert-expectations, org-trello,
smartparens, request, polymode, mu4e-alert, evil-matchit, spark,
es-mode, eimp, dired-hacks and cdlatex to master with some minor
modifications here and there. I was careful not to break any packages on
master.

For the remaining patches, some comments follow.

> Subject: [PATCH 01/27] emacs-build-system: Consider all inputs for
> Elisp dependencies.

>  (define* (set-emacs-load-path #:key inputs #:allow-other-keys)
>    "Set the EMACSLOADPATH environment variable so that dependencies are found."
> -  (let* ((input-elisp-dirs (emacs-inputs-el-directories
> -                            (emacs-inputs-directories inputs)))
> +  (let* ((input-elisp-dirs (inputs->el-directories
> +                            (inputs->directories inputs)))
>           (emacs-load-path-value (string-join
>                                   input-elisp-dirs ":" 'suffix)))
>      (setenv "EMACSLOADPATH" emacs-load-path-value)

> @@ -210,39 +210,25 @@ store in '.el' files."
>    "Check if NAME correspond to the name of an Emacs package."
>    (string-prefix? "emacs-" name))
>  
> -(define (emacs-inputs inputs)
> -  "Retrieve the list of Emacs packages from INPUTS."
> -  (filter (match-lambda
> -            ((label . directory)
> -             (emacs-package? ((compose package-name->name+version
> -                                       strip-store-file-name)
> -                              directory)))
> -            (_ #f))
> -          inputs))
> +(define (inputs->directories inputs)
> +  "Extract the directory part from INPUTS."
> +  (match inputs
> +    (((names . directories) ...) directories)))
>  
> -(define (emacs-inputs-directories inputs)
> -  "Extract the list of Emacs package directories from INPUTS."
> -  (let ((inputs (emacs-inputs inputs)))
> -    (match inputs
> -      (((names . directories) ...) directories))))
> -
> -(define (emacs-input->el-directory emacs-input)
> -  "Return the correct Elisp directory location of EMACS-INPUT or #f if none."
> -  (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix))
> +(define (input->el-directory input-dir)
> +  "Return the correct Elisp directory location of INPUT-DIR-DIR or #f."

We can just call the "input-dir" argument as "input". Also, there is a
typo in the docstring where it is called INPUT-DIR-DIR.

> -(define (emacs-inputs-el-directories dirs)
> -  "Build the list of Emacs Lisp directories from the Emacs package directory
> -DIRS."
> -  (filter-map emacs-input->el-directory dirs))
> +(define (inputs->el-directories input-dirs)
> +  "Build the list of Emacs Lisp directories from the INPUT-DIRS."
> +  (filter-map input->el-directory input-dirs))

emacs-inputs-el-directories is a very short and simple function, and is
called only once. Why not insert its body directly into the caller
function?

> Subject: [PATCH 02/27] emacs-build-system: Add improved check phase, fixes.

> -(define* (set-emacs-load-path #:key inputs #:allow-other-keys)
> +(define* (set-emacs-load-path #:key source inputs #:allow-other-keys)
>    "Set the EMACSLOADPATH environment variable so that dependencies are found."
> -  (let* ((input-elisp-dirs (inputs->el-directories
> +  (let* ((source-dir (getcwd))
> +         (input-elisp-dirs (inputs->el-directories
>                              (inputs->directories inputs)))
>           (emacs-load-path-value (string-join
> -                                 input-elisp-dirs ":" 'suffix)))
> +                                 `(,@input-elisp-dirs
> +                                   ,source-dir) ":" 'suffix)))
>      (setenv "EMACSLOADPATH" emacs-load-path-value)

set-path-environment-variable could be used here instead of setenv. It
will make the code shorter. Also, modifications to the
set-emacs-load-path phase should be part of the first commit (Consider all
inputs for elisp dep). They don't belong in this commit along with the
check phase.

>      (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
>              emacs-load-path-value)))
> @@ -133,6 +135,24 @@ store in '.el' files."
>            (substitute-program-names))))
>      #t))
>  
> +(define* (check #:key target (tests? (not target))
> +                (test-command '("make" "check")) (parallel-tests? #t)
> +                #:allow-other-keys)
> +  "Like the gnu-build-system check phase, but with a way to pass a custom test
> +program command line, using TEST-COMMAND."

I think this docstring should explicitly say what the check phase does,
instead of making a comparison to the gnu-build-system. WDYT?

> +  (let* ((test-program (car test-command))
> +         (test-args (cdr test-command))

Use match-let here instead of car and cdr.

>      (parameterize ((%emacs emacs))
> -      (emacs-generate-autoloads elpa-name el-dir))
> -    #t))
> +      (emacs-generate-autoloads elpa-name el-dir))))

These invoke related changes should be a separate commit.

>  (define-module (guix build emacs-utils)
> +  #:use-module (guix build utils)
>    #:export (%emacs
>              emacs-batch-eval
>              emacs-batch-edit-file
> @@ -39,16 +41,14 @@
>  
>  (define (emacs-batch-eval expr)
>    "Run Emacs in batch mode, and execute the elisp code EXPR."
> -  (unless (zero? (system* (%emacs) "--quick" "--batch"
> -                          (format #f "--eval=~S" expr)))
> -    (error "emacs-batch-eval failed!" expr)))
> +  (invoke (%emacs) "--quick" "--batch"
> +          (format #f "--eval=~S" expr)))

Likewise.

>  (define (emacs-batch-edit-file file expr)
>    "Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
> -  (unless (zero? (system* (%emacs) "--quick" "--batch"
> -                          (string-append "--visit=" file)
> -                          (format #f "--eval=~S" expr)))
> -    (error "emacs-batch-edit-file failed!" file expr)))
> +  (invoke (%emacs) "--quick" "--batch"
> +          (string-append "--visit=" file)
> +          (format #f "--eval=~S" expr)))

Likewise.

>  (define (emacs-generate-autoloads name directory)
>    "Generate autoloads for Emacs package NAME placed in DIRECTORY."
> @@ -60,7 +60,9 @@
>  
>  (define* (emacs-byte-compile-directory dir)
>    "Byte compile all files in DIR and its sub-directories."
> -  (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0)))
> +  (let ((expr `(progn
> +                (setq byte-compile-debug t) ;for proper exit status
> +                (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
>      (emacs-batch-eval expr)))

Strict byte compilation should be a separate commit.

> Subject: [PATCH 03/27] gnu: Adjust ert-runner wrapper to honor EMACSLOADPATH.
>
>                   (wrap-program (string-append out "/bin/ert-runner")
> -                   (list "EMACSLOADPATH" ":" '=
> +                   (list "EMACSLOADPATH" ":" 'prefix
>                           (append
>                            ,(match dependencies
>                               (((labels packages) ...)

Couldn't we just use the EMACSLOADPATH environment variable as already
set by the set-emacs-load-path phase, instead of recomputing it?

> Subject: [PATCH 04/27] gnu: Adapt Emacs packages to use the new check phase.
>
> -     `(#:phases
> -       (modify-phases %standard-phases
> -         (add-before 'install 'check
> -                     (lambda _
> -                       (zero? (system* "./run-tests.sh")))))))
> +     `(#:tests? #t
> +       #:test-command '("sh" "run-tests.sh")))

Why '("sh" "run-tests.sh") and not just '("./run-tests.sh")?

> +     `(#:tests? #t
> +       #:test-command '("sh" "run-tests.sh")))

Likewise.

>         (modify-phases %standard-phases
> -         (add-before 'install 'check
> +         (add-before 'check 'fix-bin-dir
>             (lambda _
>               ;; The company-files-candidates-normal-root test looks
>               ;; for the /bin directory, but the build environment has
>               ;; no /bin directory. Modify the test to look for the
>               ;; /tmp directory.
>               (substitute* "test/files-tests.el"
> -               (("/bin/") "/tmp/"))
> -             (zero? (system* "make" "test-batch")))))))
> +               (("/bin/") "/tmp/")))))

The fix-bin-dir phase must return a #t.

> +       `(#:tests? #t
> +         #:test-command '("emacs" "-batch"

Nitpick: Use "--batch" here instead of "-batch".

> +                          "-l" "julia-mode.el"
> +                          "-l" "julia-mode-tests.el"
> +                          "-f" "ert-run-tests-batch-and-exit")))

julia-mode.el need not be loaded explicitly. The EMACSLOADPATH
environment variable knows where to find it.

>  (define-public emacs-memoize
>    (package
> -   (name "emacs-memoize")
> -   (version "20130421.b55eab0")
> -   (source
> -    (origin
> -     (method git-fetch)
> -     (uri (git-reference
> -           (url "https://github.com/skeeto/emacs-memoize")
> -           (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
> -     (file-name (string-append name "-" version ".tar.gz"))
> -     (sha256
> -      (base32
> -       "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
> -   (build-system emacs-build-system)
> -   (arguments
> -    `(#:phases
> -      (modify-phases %standard-phases
> -        (add-before 'install 'check
> -                    (lambda _
> -                      (zero? (system* "emacs" "-batch" "-l" "memoize.el"
> -                                      "-l" "memoize-test.el"
> -                                      "-f" "ert-run-tests-batch-and-exit")))))))
> -   (home-page "https://github.com/skeeto/emacs-memoize")
> -   (synopsis "Emacs lisp memoization library")
> -   (description "@code{emacs-memoize} is an Emacs library for
> +    (name "emacs-memoize")
> +    (version "20130421.b55eab0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/skeeto/emacs-memoize")
> +             (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
> +       (file-name (string-append name "-" version ".tar.gz"))
> +       (sha256
> +        (base32
> +         "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
> +    (build-system emacs-build-system)
> +    (arguments
> +     `(#:tests? #t
> +       #:test-command '("emacs" "-batch"

Nitpick: Use "--batch" here instead of "-batch".

> +                        "-l" "memoize.el"
> +                        "-l" "memoize-test.el"
> +                        "-f" "ert-run-tests-batch-and-exit")))

memoize.el need not be loaded explicitly. The EMACSLOADPATH environment
variable knows where to find it.

> +    (home-page "https://github.com/skeeto/emacs-memoize")
> +    (synopsis "Emacs lisp memoization library")
> +    (description "@code{emacs-memoize} is an Emacs library for
>  memoizing functions.")
> -   (license license:unlicense)))
> +    (license license:unlicense)))

Re-indent emacs-memoize as a separate commit. Else, it's very hard to
make sense of the diff.

>      (arguments
> -     `(#:phases
> -       (modify-phases %standard-phases
> -         (add-before 'install 'check
> -           (lambda _
> -             (zero? (system* "emacs" "--batch" "-L" "."
> -                             "-l" "xmlgen-test.el"
> -                             "-f" "ert-run-tests-batch-and-exit")))))))
> +     `(#:tests? #t
> +       #:test-command '("emacs" "--batch" "-L" "."
> +                        "-l" "xmlgen-test.el"
> +                        "-f" "ert-run-tests-batch-and-exit")))

"-L" "." is not required. The EMACSLOADPATH environment variable already
includes the current directory.

> +     `(#:tests? #t
> +       #:test-command '("emacs" "--batch"
> +                        "-l" "which-key-tests.el"
> +                        "-f" "ert-run-tests-batch-and-exit")))

>      (home-page "https://github.com/lewang/ws-butler")
>      (synopsis "Trim spaces from end of lines")
>      (description
> @@ -6480,20 +6431,14 @@ editing RPM spec files.")
>          (base32
>           "17mqki6g0wx46fn7dcbcc2pjxik7vvrcb1j9jzxim8b9psbsbnp9"))))
>      (build-system emacs-build-system)
> +    (native-inputs
> +     `(("ert-runner" ,ert-runner)))

Why add ert-runner as native-input?

> Subject: [PATCH 05/27] gnu: emacs-pdf-tools: Fix byte compilation.
>
> -         (add-after 'emacs-patch-variables 'emacs-install
> +         (add-after 'emacs-patch-variables 'set-emacs-load-path
> +           (assoc-ref emacs:%standard-phases 'set-emacs-load-path))
> +         (add-after 'add-cwd-to-load-path 'emacs-install

What is the add-cwd-to-load-path phase, and where is it defined?

> Subject: [PATCH 12/27] gnu: emacs-idris-mode: Fix hash.
>
>         (sha256
>          (base32
> -         "0ld4kfwnyyhlsnj5f6cbn4is4mpxdqalk2aifkw02r00mbr9n294"))))
> +         "0qm4gngl6lqvra7kmivz99y3ymrg36nvqh5y9gy6gq0aa0v8az46"))))

The hash seems to have changed again upstream. Please verify.

> Subject: [PATCH 13/27] gnu: emacs-sx: Fix build issue.
>
> The package would fail building when attempting to create a cache
> directory.  This has been fixed upstream but not in a tagged release.

Is it possible to cherry pick relevant commits alone and include them as
patches? If possible, this would be preferable to switching to a git
checkout.

> Subject: [PATCH 15/27] gnu: Add emacs-scel.
>
> +(define-public emacs-scel
> +  (let ((version "20170629")
> +        (revision "1")
> +        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
> +    (package
> +      (name "emacs-scel")
> +      (version (git-version version revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/supercollider/scel.git")
> +                      (commit commit)))
> +                (file-name (string-append name "-" version "-checkout"))
> +                (sha256
> +                 (base32
> +                  "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
> +      (build-system emacs-build-system)

This package seems to use a cmake-build-system. Did you try that?

> From 9a3a449121246a2d26a92ee5c19d905768789a10 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Date: Wed, 28 Mar 2018 21:50:15 -0400
> Subject: [PATCH 19/27] gnu: emacs-org-contrib: Fix hash and byte compilation.

There is no hash change in the commit. Please fix the commit message.

> Subject: [PATCH 26/27] gnu: Add emacs-howm.
>
> +(define-public emacs-howm
> +  (package
> +    (name "emacs-howm")
> +    (version "1.4.4")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "http://howm.sourceforge.jp/a/howm-"
> +                                  version ".tar.gz"))
> +              (sha256
> +               (base32
> +                "0ddm91l6z58j7x59fa966j6q1rg4cinyza4r8ibg80hprn5h31qk"))))
> +    (build-system emacs-build-system)

This package seems to use the gnu-build-system. Did you try that?

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

* [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.
       [not found] ` <9925e912.AM4AAAS8QCUAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0jGH@mailjet.com>
@ 2018-04-17  2:59   ` Maxim Cournoyer
  2018-04-20 17:46     ` Arun Isaac
       [not found]     ` <5b6467d3.AMMAAAVkQu8AAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa2idv@mailjet.com>
  0 siblings, 2 replies; 11+ messages in thread
From: Maxim Cournoyer @ 2018-04-17  2:59 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 31018

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

Hello Arun,

Arun Isaac <arunisaac@systemreboot.net> writes:

> I've pushed the patches concerning ert-expectations, org-trello,
> smartparens, request, polymode, mu4e-alert, evil-matchit, spark,
> es-mode, eimp, dired-hacks and cdlatex to master with some minor
> modifications here and there. I was careful not to break any packages on
> master.
>
> For the remaining patches, some comments follow.
>
>> Subject: [PATCH 01/27] emacs-build-system: Consider all inputs for
>> Elisp dependencies.

[...]

>> -(define (emacs-input->el-directory emacs-input)
>> -  "Return the correct Elisp directory location of EMACS-INPUT or #f if none."
>> -  (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix))
>> +(define (input->el-directory input-dir)
>> +  "Return the correct Elisp directory location of INPUT-DIR-DIR or #f."
>
> We can just call the "input-dir" argument as "input". Also, there is a
> typo in the docstring where it is called INPUT-DIR-DIR.

I wanted to stress that we pass the input directory rather than a Guix
input (which is tuple of a package's name and its path in the store),
since both are used in this module. I've now made this more consistent.

>> -(define (emacs-inputs-el-directories dirs)
>> -  "Build the list of Emacs Lisp directories from the Emacs package directory
>> -DIRS."
>> -  (filter-map emacs-input->el-directory dirs))
>> +(define (inputs->el-directories input-dirs)
>> +  "Build the list of Emacs Lisp directories from the INPUT-DIRS."
>> +  (filter-map input->el-directory input-dirs))
>
> emacs-inputs-el-directories is a very short and simple function, and is
> called only once. Why not insert its body directly into the caller
> function?

I like it as a function better, if only for the expressiveness of its
name :).

>> Subject: [PATCH 02/27] emacs-build-system: Add improved check phase, fixes.
>
>> -(define* (set-emacs-load-path #:key inputs #:allow-other-keys)
>> +(define* (set-emacs-load-path #:key source inputs #:allow-other-keys)
>>    "Set the EMACSLOADPATH environment variable so that dependencies are found."
>> -  (let* ((input-elisp-dirs (inputs->el-directories
>> +  (let* ((source-dir (getcwd))
>> +         (input-elisp-dirs (inputs->el-directories
>>                              (inputs->directories inputs)))
>>           (emacs-load-path-value (string-join
>> -                                 input-elisp-dirs ":" 'suffix)))
>> +                                 `(,@input-elisp-dirs
>> +                                   ,source-dir) ":" 'suffix)))
>>      (setenv "EMACSLOADPATH" emacs-load-path-value)
>
> set-path-environment-variable could be used here instead of setenv. It
> will make the code shorter.

I tried this before; there are two issues with that method:
1. Cluttering EMACSLOADPATH: Since we must support both
"/share/emacs/site-lisp" and "/share/emacs/site-lisp/guix.d", the first
would always be added when the later exists, which we don't want. This
is because we can only pass a PATTERN to `set-path-environment-variable'
that is tested against every file which is of the specified TYPE (we
cannot pass it some extra logic).
2. It is important for EMACSLOADPATH to contain the trailing colon (:),
otherwise Emacs wouldn't find its own Elisp modules. We could hack it at
this level by adding nil to the end of the INPUT-DIRS, but this isn't
general. In the past I played with attempting to define a
search-path-specification for our Emacs package, which would generalize
even more the way our Emacs packages are discovered in Guix. That ended
up looking like the following:

--8<---------------cut here---------------start------------->8---
+    (native-search-paths
+     (list (search-path-specification
+            (variable "EMACSLOADPATH")
+            (files '("share/emacs/site-lisp"))
+            (file-pattern ".*")
+            (append-separator? #t))))))
--8<---------------cut here---------------end--------------->8---

Where the new "append-separator?" argument was added by myself (this is
a world rebuilding change and also changes the manifest file). I didn't
pursue that for now given that it still suffers from 1. explained above.

The nice properties of this however was that it was now possible to have
the Emacs dependencies found in `guix environment' as well as in the
build system (anywhere), by using the native mechanism that Guix comes
with. If you have interest in going that way I could revive those two
old patches.

> Also, modifications to the set-emacs-load-path phase should be part of
> the first commit (Consider all inputs for elisp dep). They don't
> belong in this commit along with the check phase.

Done.

>
>>      (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
>>              emacs-load-path-value)))
>> @@ -133,6 +135,24 @@ store in '.el' files."
>>            (substitute-program-names))))
>>      #t))
>>  
>> +(define* (check #:key target (tests? (not target))
>> +                (test-command '("make" "check")) (parallel-tests? #t)
>> +                #:allow-other-keys)
>> +  "Like the gnu-build-system check phase, but with a way to pass a custom test
>> +program command line, using TEST-COMMAND."
>
> I think this docstring should explicitly say what the check phase does,
> instead of making a comparison to the gnu-build-system. WDYT?

Done (although I find it a bit verbose now :).

>> +  (let* ((test-program (car test-command))
>> +         (test-args (cdr test-command))
>
> Use match-let here instead of car and cdr.

Done, although match-let appears to be undocumented :/.

>
>>      (parameterize ((%emacs emacs))
>> -      (emacs-generate-autoloads elpa-name el-dir))
>> -    #t))
>> +      (emacs-generate-autoloads elpa-name el-dir))))
>
> These invoke related changes should be a separate commit.

Done.

[...]

>>  (define (emacs-generate-autoloads name directory)
>>    "Generate autoloads for Emacs package NAME placed in DIRECTORY."
>> @@ -60,7 +60,9 @@
>>  
>>  (define* (emacs-byte-compile-directory dir)
>>    "Byte compile all files in DIR and its sub-directories."
>> -  (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0)))
>> +  (let ((expr `(progn
>> +                (setq byte-compile-debug t) ;for proper exit status
>> +                (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
>>      (emacs-batch-eval expr)))
>
> Strict byte compilation should be a separate commit.

Done.

>
>> Subject: [PATCH 03/27] gnu: Adjust ert-runner wrapper to honor EMACSLOADPATH.
>>
>>                   (wrap-program (string-append out "/bin/ert-runner")
>> -                   (list "EMACSLOADPATH" ":" '=
>> +                   (list "EMACSLOADPATH" ":" 'prefix
>>                           (append
>>                            ,(match dependencies
>>                               (((labels packages) ...)
>
> Couldn't we just use the EMACSLOADPATH environment variable as already
> set by the set-emacs-load-path phase, instead of recomputing it?

Done.

>> Subject: [PATCH 04/27] gnu: Adapt Emacs packages to use the new check phase.
>>
>> -     `(#:phases
>> -       (modify-phases %standard-phases
>> -         (add-before 'install 'check
>> -                     (lambda _
>> -                       (zero? (system* "./run-tests.sh")))))))
>> +     `(#:tests? #t
>> +       #:test-command '("sh" "run-tests.sh")))
>
> Why '("sh" "run-tests.sh") and not just '("./run-tests.sh")?

Done.

>> +     `(#:tests? #t
>> +       #:test-command '("sh" "run-tests.sh")))
>
> Likewise.

Done.

>>         (modify-phases %standard-phases
>> -         (add-before 'install 'check
>> +         (add-before 'check 'fix-bin-dir
>>             (lambda _
>>               ;; The company-files-candidates-normal-root test looks
>>               ;; for the /bin directory, but the build environment has
>>               ;; no /bin directory. Modify the test to look for the
>>               ;; /tmp directory.
>>               (substitute* "test/files-tests.el"
>> -               (("/bin/") "/tmp/"))
>> -             (zero? (system* "make" "test-batch")))))))
>> +               (("/bin/") "/tmp/")))))
>
> The fix-bin-dir phase must return a #t.

I believe it already does, looking at the definition of substitute*
(which in turn calls substitute).

>> +       `(#:tests? #t
>> +         #:test-command '("emacs" "-batch"
>
> Nitpick: Use "--batch" here instead of "-batch".

Done.

>> +                          "-l" "julia-mode.el"
>> +                          "-l" "julia-mode-tests.el"
>> +                          "-f" "ert-run-tests-batch-and-exit")))
>
> julia-mode.el need not be loaded explicitly. The EMACSLOADPATH
> environment variable knows where to find it.

Done.

>>  (define-public emacs-memoize
>>    (package
>> -   (name "emacs-memoize")
>> -   (version "20130421.b55eab0")
>> -   (source
>> -    (origin
>> -     (method git-fetch)
>> -     (uri (git-reference
>> -           (url "https://github.com/skeeto/emacs-memoize")
>> -           (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
>> -     (file-name (string-append name "-" version ".tar.gz"))
>> -     (sha256
>> -      (base32
>> -       "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
>> -   (build-system emacs-build-system)
>> -   (arguments
>> -    `(#:phases
>> -      (modify-phases %standard-phases
>> -        (add-before 'install 'check
>> -                    (lambda _
>> -                      (zero? (system* "emacs" "-batch" "-l" "memoize.el"
>> -                                      "-l" "memoize-test.el"
>> -                                      "-f" "ert-run-tests-batch-and-exit")))))))
>> -   (home-page "https://github.com/skeeto/emacs-memoize")
>> -   (synopsis "Emacs lisp memoization library")
>> -   (description "@code{emacs-memoize} is an Emacs library for
>> +    (name "emacs-memoize")
>> +    (version "20130421.b55eab0")
>> +    (source
>> +     (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/skeeto/emacs-memoize")
>> +             (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
>> +       (file-name (string-append name "-" version ".tar.gz"))
>> +       (sha256
>> +        (base32
>> +         "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
>> +    (build-system emacs-build-system)
>> +    (arguments
>> +     `(#:tests? #t
>> +       #:test-command '("emacs" "-batch"
>
> Nitpick: Use "--batch" here instead of "-batch".

Done.

>> +                        "-l" "memoize.el"
>> +                        "-l" "memoize-test.el"
>> +                        "-f" "ert-run-tests-batch-and-exit")))
>
> memoize.el need not be loaded explicitly. The EMACSLOADPATH environment
> variable knows where to find it.

Good point, but memoize-test.el does not have the necessary (require
'memoize) statement required for it to work.

>
>> +    (home-page "https://github.com/skeeto/emacs-memoize")
>> +    (synopsis "Emacs lisp memoization library")
>> +    (description "@code{emacs-memoize} is an Emacs library for
>>  memoizing functions.")
>> -   (license license:unlicense)))
>> +    (license license:unlicense)))
>
> Re-indent emacs-memoize as a separate commit. Else, it's very hard to
> make sense of the diff.

Done.

>
>>      (arguments
>> -     `(#:phases
>> -       (modify-phases %standard-phases
>> -         (add-before 'install 'check
>> -           (lambda _
>> -             (zero? (system* "emacs" "--batch" "-L" "."
>> -                             "-l" "xmlgen-test.el"
>> -                             "-f" "ert-run-tests-batch-and-exit")))))))
>> +     `(#:tests? #t
>> +       #:test-command '("emacs" "--batch" "-L" "."
>> +                        "-l" "xmlgen-test.el"
>> +                        "-f" "ert-run-tests-batch-and-exit")))
>
> "-L" "." is not required. The EMACSLOADPATH environment variable already
> includes the current directory.

Good point. Done.

>> +     `(#:tests? #t
>> +       #:test-command '("emacs" "--batch"
>> +                        "-l" "which-key-tests.el"
>> +                        "-f" "ert-run-tests-batch-and-exit")))
>
>>      (home-page "https://github.com/lewang/ws-butler")
>>      (synopsis "Trim spaces from end of lines")
>>      (description
>> @@ -6480,20 +6431,14 @@ editing RPM spec files.")
>>          (base32
>>           "17mqki6g0wx46fn7dcbcc2pjxik7vvrcb1j9jzxim8b9psbsbnp9"))))
>>      (build-system emacs-build-system)
>> +    (native-inputs
>> +     `(("ert-runner" ,ert-runner)))
>
> Why add ert-runner as native-input?

Removed.

>> Subject: [PATCH 05/27] gnu: emacs-pdf-tools: Fix byte compilation.
>>
>> -         (add-after 'emacs-patch-variables 'emacs-install
>> +         (add-after 'emacs-patch-variables 'set-emacs-load-path
>> +           (assoc-ref emacs:%standard-phases 'set-emacs-load-path))
>> +         (add-after 'add-cwd-to-load-path 'emacs-install
>
> What is the add-cwd-to-load-path phase, and where is it defined?

I'm not sure :). Corrected to set-emacs-load-path.

>> Subject: [PATCH 12/27] gnu: emacs-idris-mode: Fix hash.
>>
>>         (sha256
>>          (base32
>> -         "0ld4kfwnyyhlsnj5f6cbn4is4mpxdqalk2aifkw02r00mbr9n294"))))
>> +         "0qm4gngl6lqvra7kmivz99y3ymrg36nvqh5y9gy6gq0aa0v8az46"))))
>
> The hash seems to have changed again upstream. Please verify.

Indeed, it is now
02r1qqsxi6qk7q4cj6a6pygbj856dcw9vcmhfh0ib92j41v77q6y. Fixed.

>> Subject: [PATCH 13/27] gnu: emacs-sx: Fix build issue.
>>
>> The package would fail building when attempting to create a cache
>> directory.  This has been fixed upstream but not in a tagged release.
>
> Is it possible to cherry pick relevant commits alone and include them as
> patches? If possible, this would be preferable to switching to a git
> checkout.

I might be possible, but given that the latest v0.4 release dates back
from Jul 18 2015, I think we're better off using a recent git commit
anyway.

>> Subject: [PATCH 15/27] gnu: Add emacs-scel.
>>
>> +(define-public emacs-scel
>> +  (let ((version "20170629")
>> +        (revision "1")
>> +        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
>> +    (package
>> +      (name "emacs-scel")
>> +      (version (git-version version revision commit))
>> +      (source (origin
>> +                (method git-fetch)
>> +                (uri (git-reference
>> +                      (url "https://github.com/supercollider/scel.git")
>> +                      (commit commit)))
>> +                (file-name (string-append name "-" version "-checkout"))
>> +                (sha256
>> +                 (base32
>> +                  "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
>> +      (build-system emacs-build-system)
>
> This package seems to use a cmake-build-system. Did you try that?

I didn't, on purpose. I wanted the Elisp files to be processed the same
as most of our other Emacs packages (with the patch-el-files phase
patching binaries, for example) that we would miss otherwise).

>> From 9a3a449121246a2d26a92ee5c19d905768789a10 Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>> Date: Wed, 28 Mar 2018 21:50:15 -0400
>> Subject: [PATCH 19/27] gnu: emacs-org-contrib: Fix hash and byte compilation.
>
> There is no hash change in the commit. Please fix the commit message.

Done.

>> Subject: [PATCH 26/27] gnu: Add emacs-howm.
>>
>> +(define-public emacs-howm
>> +  (package
>> +    (name "emacs-howm")
>> +    (version "1.4.4")
>> +    (source (origin
>> +              (method url-fetch)
>> +              (uri (string-append "http://howm.sourceforge.jp/a/howm-"
>> +                                  version ".tar.gz"))
>> +              (sha256
>> +               (base32
>> +                "0ddm91l6z58j7x59fa966j6q1rg4cinyza4r8ibg80hprn5h31qk"))))
>> +    (build-system emacs-build-system)
>
> This package seems to use the gnu-build-system. Did you try that?

No, for the same reasons explained above for the emacs-scel package.

A big thank you for reviewing this lengthy set of patches :)

You'll find the edited patches attached.

Maxim


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-build-system-Consider-all-inputs-for-Elisp-dep.patch --]
[-- Type: text/x-patch, Size: 5032 bytes --]

From 7f92b0f29b03190f18bcab297364da64638823b0 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 29 Mar 2018 20:52:41 -0400
Subject: [PATCH 01/30] emacs-build-system: Consider all inputs for Elisp
 dependencies.

* guix/build/emacs-build-system.scm (emacs-inputs): Remove.
(emacs-inputs-directories): Rename to...
(inputs->directories): this, and adapt for any input.
(emacs-input->el-directory): Rename to...
(inputs->el-directories): this, and adapt for any input.
(set-emacs-load-path): Now use inputs->el-directories and
inputs->el-directories; add the unpacked directory to EMACSLOADPATH.
(%standard-phases)[set-emacs-load-path]: Move after `unpack'.
---
 guix/build/emacs-build-system.scm | 56 +++++++++++++++------------------------
 1 file changed, 22 insertions(+), 34 deletions(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index b77984742..3ab3f91f7 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -74,12 +74,14 @@ archive, a directory, or an Emacs Lisp file."
         #t)
       (gnu:unpack #:source source)))
 
-(define* (set-emacs-load-path #:key inputs #:allow-other-keys)
+(define* (set-emacs-load-path #:key source inputs #:allow-other-keys)
   "Set the EMACSLOADPATH environment variable so that dependencies are found."
-  (let* ((input-elisp-dirs (emacs-inputs-el-directories
-                            (emacs-inputs-directories inputs)))
+  (let* ((source-dir (getcwd))
+         (input-elisp-dirs (input-dirs->el-directories
+                            (inputs->directories inputs)))
          (emacs-load-path-value (string-join
-                                 input-elisp-dirs ":" 'suffix)))
+                                 `(,@input-elisp-dirs
+                                   ,source-dir) ":" 'suffix)))
     (setenv "EMACSLOADPATH" emacs-load-path-value)
     (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
             emacs-load-path-value)))
@@ -210,39 +212,25 @@ store in '.el' files."
   "Check if NAME correspond to the name of an Emacs package."
   (string-prefix? "emacs-" name))
 
-(define (emacs-inputs inputs)
-  "Retrieve the list of Emacs packages from INPUTS."
-  (filter (match-lambda
-            ((label . directory)
-             (emacs-package? ((compose package-name->name+version
-                                       strip-store-file-name)
-                              directory)))
-            (_ #f))
-          inputs))
+(define (inputs->directories inputs)
+  "Extract the directory part from INPUTS."
+  (match inputs
+    (((names . directories) ...) directories)))
 
-(define (emacs-inputs-directories inputs)
-  "Extract the list of Emacs package directories from INPUTS."
-  (let ((inputs (emacs-inputs inputs)))
-    (match inputs
-      (((names . directories) ...) directories))))
-
-(define (emacs-input->el-directory emacs-input)
-  "Return the correct Elisp directory location of EMACS-INPUT or #f if none."
-  (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix))
+(define (input-dir->el-directory input-dir)
+  "Return the correct Elisp directory location of INPUT-DIR or #f."
+  (let ((legacy-elisp-dir (string-append input-dir %legacy-install-suffix))
         (guix-elisp-dir (string-append
-                         emacs-input %install-suffix "/"
-                         (store-directory->elpa-name-version emacs-input))))
+                         input-dir %install-suffix "/"
+                         (store-directory->elpa-name-version input-dir))))
     (cond
      ((file-exists? guix-elisp-dir) guix-elisp-dir)
      ((file-exists? legacy-elisp-dir) legacy-elisp-dir)
-     (else (format #t "warning: could not locate elisp directory under `~a'\n"
-                   emacs-input)
-           #f))))
+     (else #f))))
 
-(define (emacs-inputs-el-directories dirs)
-  "Build the list of Emacs Lisp directories from the Emacs package directory
-DIRS."
-  (filter-map emacs-input->el-directory dirs))
+(define (input-dirs->el-directories input-dirs)
+  "Build the list of Emacs Lisp directories from the INPUT-DIRS."
+  (filter-map input-dir->el-directory input-dirs))
 
 (define (package-name-version->elpa-name-version name-ver)
   "Convert the Guix package NAME-VER to the corresponding ELPA name-version
@@ -260,11 +248,11 @@ second hyphen.  This corresponds to 'name-version' as used in ELPA packages."
 
 (define %standard-phases
   (modify-phases gnu:%standard-phases
-    (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path)
     (replace 'unpack unpack)
+    (add-after 'unpack 'set-emacs-load-path set-emacs-load-path)
     (delete 'configure)
-    ;; Move the build phase after install: the .el files are byte compiled
-    ;; directly in the store.
+    ;; Move the build phase after install: the .el files are byte
+    ;; compiled directly in the store.
     (delete 'build)
     (replace 'install install)
     (add-after 'install 'build build)
-- 
2.16.1


[-- Attachment #3: 0002-emacs-utils-Use-invoke-instead-of-system.patch --]
[-- Type: text/x-patch, Size: 3057 bytes --]

From 19af88158eeb10d01a230c2f5bc49d4e933d35b7 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 15 Apr 2018 22:46:26 -0400
Subject: [PATCH 02/30] emacs-utils: Use invoke instead of system*.

* guix/build/emacs-utils.scm (guix): Use (guix build utils) for `invoke'.
(emacs-batch-eval): Replace `system*' usage with `invoke'.
(emacs-batch-edit-file): Likewise.
* guix/build/emacs-build-system.scm: (make-autoloads): No need to return #t
explicitly since the function now uses `invoke'.
---
 guix/build/emacs-build-system.scm |  3 +--
 guix/build/emacs-utils.scm        | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 3ab3f91f7..dc404f04f 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -205,8 +205,7 @@ store in '.el' files."
          (elpa-name (package-name->name+version elpa-name-ver))
          (el-dir (string-append out %install-suffix "/" elpa-name-ver)))
     (parameterize ((%emacs emacs))
-      (emacs-generate-autoloads elpa-name el-dir))
-    #t))
+      (emacs-generate-autoloads elpa-name el-dir))))
 
 (define (emacs-package? name)
   "Check if NAME correspond to the name of an Emacs package."
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8389ca582..2bd4e3985 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -18,6 +19,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix build emacs-utils)
+  #:use-module (guix build utils)
   #:export (%emacs
             emacs-batch-eval
             emacs-batch-edit-file
@@ -39,16 +41,14 @@
 
 (define (emacs-batch-eval expr)
   "Run Emacs in batch mode, and execute the elisp code EXPR."
-  (unless (zero? (system* (%emacs) "--quick" "--batch"
-                          (format #f "--eval=~S" expr)))
-    (error "emacs-batch-eval failed!" expr)))
+  (invoke (%emacs) "--quick" "--batch"
+          (format #f "--eval=~S" expr)))
 
 (define (emacs-batch-edit-file file expr)
   "Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
-  (unless (zero? (system* (%emacs) "--quick" "--batch"
-                          (string-append "--visit=" file)
-                          (format #f "--eval=~S" expr)))
-    (error "emacs-batch-edit-file failed!" file expr)))
+  (invoke (%emacs) "--quick" "--batch"
+          (string-append "--visit=" file)
+          (format #f "--eval=~S" expr)))
 
 (define (emacs-generate-autoloads name directory)
   "Generate autoloads for Emacs package NAME placed in DIRECTORY."
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-emacs-utils-Fail-when-byte-compilation-fails.patch --]
[-- Type: text/x-patch, Size: 1119 bytes --]

From c6fbd8d0c0a2f7663d9ff882497f40cb378ce7bd Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 15 Apr 2018 22:48:53 -0400
Subject: [PATCH 03/30] emacs-utils: Fail when byte compilation fails.

Byte compilation failures were ignored prior to this change.

* guix/build/emacs-utils.scm (emacs-byte-compile-directory): Make it fail when
there are compilation errors.
---
 guix/build/emacs-utils.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 2bd4e3985..eed17667b 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -60,7 +60,9 @@
 
 (define* (emacs-byte-compile-directory dir)
   "Byte compile all files in DIR and its sub-directories."
-  (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0)))
+  (let ((expr `(progn
+                (setq byte-compile-debug t) ;for proper exit status
+                (byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
     (emacs-batch-eval expr)))
 
 (define-syntax emacs-substitute-sexps
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-emacs-build-system-Add-improved-check-phase.patch --]
[-- Type: text/x-patch, Size: 3471 bytes --]

From 8528dc2f91d5a890694565b0daea290a96747d76 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 11 Feb 2018 00:51:26 -0500
Subject: [PATCH 04/30] emacs-build-system: Add improved check phase.

* guix/build-system/emacs.scm (emacs-build): Remove `test-target' and
'configure-flags' arguments.  Add `test-command' argument.
(check): New procedure.
(%standard-phases)[check]: Register after the `build' phase.
---
 guix/build-system/emacs.scm       |  6 ++----
 guix/build/emacs-build-system.scm | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index d9f1a8d28..ef6d1b339 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -84,8 +84,7 @@
                       #:key source
                       (tests? #f)
                       (parallel-tests? #t)
-                      (test-target "test")
-                      (configure-flags ''())
+                      (test-command ''("make" "check"))
                       (phases '(@ (guix build emacs-build-system)
                                   %standard-phases))
                       (outputs '("out"))
@@ -110,9 +109,8 @@
                                  source)
                                 (source
                                  source))
-                    #:configure-flags ,configure-flags
                     #:system ,system
-                    #:test-target ,test-target
+                    #:test-command ,test-command
                     #:tests? ,tests?
                     #:phases ,phases
                     #:outputs %outputs
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index dc404f04f..5662b8af4 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -135,6 +135,28 @@ store in '.el' files."
           (substitute-program-names))))
     #t))
 
+(define* (check #:key target (tests? (not target))
+                (test-command '("make" "check")) (parallel-tests? #t)
+                #:allow-other-keys)
+  "Run the tests.
+
+By default, it runs \"make check\", but the target can be changed using the
+TARGET argument.  When \"make\" is used, the tests are run in parallel unless
+PARALLEL-TESTS?.  To run a custom test program or script, TEST-COMMAND can be
+specified, as a list of arguments.  PARALLEL-TESTS? and TARGET don't have an
+effect when using a TEST-COMMAND."
+  (match-let (((test-program . args) test-command))
+    (let ((using-make? (string=? test-program "make")))
+      (if tests?
+          (apply invoke test-program
+                 `(,@args
+                   ,@(if (and using-make? parallel-tests?)
+                         `("-j" ,(number->string (parallel-job-count)))
+                         '())))
+          (begin
+            (format #t "test suite not run~%")
+            #t)))))
+
 (define* (install #:key outputs
                   (include %default-include)
                   (exclude %default-exclude)
@@ -253,6 +275,7 @@ second hyphen.  This corresponds to 'name-version' as used in ELPA packages."
     ;; Move the build phase after install: the .el files are byte
     ;; compiled directly in the store.
     (delete 'build)
+    (replace 'check check)
     (replace 'install install)
     (add-after 'install 'build build)
     (add-after 'install 'make-autoloads make-autoloads)
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-Adjust-ert-runner-wrapper-to-honor-EMACSLOADPATH.patch --]
[-- Type: text/x-patch, Size: 5641 bytes --]

From 75aa869272248633edf98281e482ad646ca538f3 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 12 Feb 2018 22:11:38 -0500
Subject: [PATCH 05/30] gnu: Adjust ert-runner wrapper to honor EMACSLOADPATH.

* gnu/packages/emacs.scm (ert-runner): Use 'prefix instead of '= for setting
the EMACSLOADPATH environment variable.  Reuse the already computed
EMACSLOADPATH for `wrap-program'.  Specify the dependencies directly in the
inputs field.
---
 gnu/packages/emacs.scm | 97 +++++++++++++++++++++-----------------------------
 1 file changed, 41 insertions(+), 56 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index ac69cfa39..99fa665a1 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6091,64 +6091,49 @@ Emacs.")
 ;; Tests for ert-runner have a circular dependency with ecukes, and therefore
 ;; cannot be run
 (define-public ert-runner
-  (let ((dependencies
-         `(("emacs-ansi" ,emacs-ansi)
-           ("emacs-commander" ,emacs-commander)
-           ("emacs-dash" ,emacs-dash)
-           ("emacs-f" ,emacs-f)
-           ("emacs-s" ,emacs-s)
-           ("emacs-shut-up" ,emacs-shut-up))))
-    (package
-      (name "ert-runner")
-      (version "0.7.0")
-      (source
-       (origin
-         (method url-fetch)
-         (uri (string-append "https://github.com/rejeep/ert-runner.el/archive/v"
-                             version ".tar.gz"))
-         (file-name (string-append name "-" version ".tar.gz"))
-         (sha256
-          (base32
-           "1657nck9i96a4xgl8crfqq0s8gflzp21pkkzwg6m3z5npjxklgwp"))))
-      (build-system emacs-build-system)
-      (inputs dependencies)
-      (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-after 'install 'install-executable
-             (lambda* (#:key inputs outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (substitute* "bin/ert-runner"
-                   (("ERT_RUNNER=\"\\$\\(dirname \\$\\(dirname \\$0\\)\\)")
-                    (string-append "ERT_RUNNER=\"" out
-                                   "/share/emacs/site-lisp/guix.d/"
-                                   ,name "-" ,version)))
-                 (install-file "bin/ert-runner" (string-append out "/bin"))
-                 (wrap-program (string-append out "/bin/ert-runner")
-                   (list "EMACSLOADPATH" ":" '=
-                         (append
-                          ,(match dependencies
-                             (((labels packages) ...)
-                              `(map (lambda (label package version)
-                                      (string-append (assoc-ref inputs label)
-                                                     "/share/emacs/site-lisp/guix.d/"
-                                                     (string-drop package 6)
-                                                     "-" version))
-                                    ',labels
-                                    ',(map package-name packages)
-                                    ',(map package-version packages))))
-                          ;; empty element to include the default load path as
-                          ;; determined by emacs' standard initialization
-                          ;; procedure
-                          (list ""))))
-                 #t))))
-         #:include (cons* "^reporters/.*\\.el$" %default-include)))
-      (home-page "https://github.com/rejeep/ert-runner.el")
-      (synopsis "Opinionated Ert testing workflow")
-      (description "@code{ert-runner} is a tool for Emacs projects tested
+  (package
+    (name "ert-runner")
+    (version "0.7.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/rejeep/ert-runner.el/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1657nck9i96a4xgl8crfqq0s8gflzp21pkkzwg6m3z5npjxklgwp"))))
+    (build-system emacs-build-system)
+    (inputs
+     `(("emacs-ansi" ,emacs-ansi)
+       ("emacs-commander" ,emacs-commander)
+       ("emacs-dash" ,emacs-dash)
+       ("emacs-f" ,emacs-f)
+       ("emacs-s" ,emacs-s)
+       ("emacs-shut-up" ,emacs-shut-up)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-executable
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "bin/ert-runner"
+                 (("ERT_RUNNER=\"\\$\\(dirname \\$\\(dirname \\$0\\)\\)")
+                  (string-append "ERT_RUNNER=\"" out
+                                 "/share/emacs/site-lisp/guix.d/"
+                                 ,name "-" ,version)))
+               (install-file "bin/ert-runner" (string-append out "/bin"))
+               (wrap-program (string-append out "/bin/ert-runner")
+                 (list "EMACSLOADPATH" ":" 'prefix
+                       (string-split (getenv "EMACSLOADPATH") ":")))
+               #t))))
+       #:include (cons* "^reporters/.*\\.el$" %default-include)))
+    (home-page "https://github.com/rejeep/ert-runner.el")
+    (synopsis "Opinionated Ert testing workflow")
+    (description "@code{ert-runner} is a tool for Emacs projects tested
 using ERT.  It assumes a certain test structure setup and can therefore make
 running tests easier.")
-      (license license:gpl3+))))
+    (license license:gpl3+)))
 
 (define-public emacs-disable-mouse
   (package
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-Adapt-Emacs-packages-to-use-the-new-check-phase.patch --]
[-- Type: text/x-patch, Size: 14478 bytes --]

From 22a42bb822d9e75a5b0c92aa3cf8c74b01487a89 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 12 Feb 2018 23:02:11 -0500
Subject: [PATCH 06/30] gnu: Adapt Emacs packages to use the new check phase.

* gnu/packages/emacs.scm (emacs-dash, emacs-s, emacs-string-inflection,
emacs-company, emacs-clojure-mode, emacs-julia-mode, emacs-elfeed,
emacs-memoize, emacs-use-package, emacs-xmlgen, emacs-json-reformat,
emacs-which-key, emacs-ws-butler, emacs-git-messenger, emacs-browse-at-remote,
emacs-evil-quickscope): Adapt to use new check phase.
(emacs-json-reformat)[inputs]: Move to...
[native-inputs]: here. Add ert-runner.
(emacs-company): Refactor fix-bin-dir phase.
(emacs-git-messenger)[native-inputs]: Add ert-runner.
---
 gnu/packages/emacs.scm | 178 ++++++++++++++++---------------------------------
 1 file changed, 56 insertions(+), 122 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 99fa665a1..7f6c1a4a0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1511,11 +1511,8 @@ and stored in memory.")
                 "1pjlkrzr8n45bnp3xs3dybvy0nz3gwamrfc7vsi1nhpkkw99ihhb"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-                     (lambda _
-                       (zero? (system* "./run-tests.sh")))))))
+     `(#:tests? #t
+       #:test-command '("./run-tests.sh")))
     (home-page "https://github.com/magnars/dash.el")
     (synopsis "Modern list library for Emacs")
     (description "This package provides a modern list API library for Emacs.")
@@ -1708,11 +1705,8 @@ allows easily move between them.")
                 "0xbl75863pcm806zg0x1lw7qznzjq2c8320k8js7apyag8q4srvh"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-                     (lambda _
-                       (zero? (system* "./run-tests.sh")))))))
+     `(#:tests? #t
+       #:test-command '("./run-tests.sh")))
     (home-page "https://github.com/magnars/s.el")
     (synopsis "Emacs string manipulation library")
     (description "This package provides an Emacs library for manipulating
@@ -2197,11 +2191,8 @@ in Lisp modes.")
     (native-inputs
      `(("ert-runner" ,ert-runner)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "ert-runner")))))))
+     `(#:tests? #t
+       #:test-command '("ert-runner")))
     (home-page "https://github.com/akicho8/string-inflection")
     (synopsis "Convert symbol names between different naming conventions")
     (description
@@ -2499,7 +2490,7 @@ build jobs.")
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (add-before 'install 'check
+         (add-before 'check 'fix-bin-dir
            (lambda _
              ;; The company-files-candidates-normal-root test looks
              ;; for the /bin directory, but the build environment has
@@ -2507,7 +2498,9 @@ build jobs.")
              ;; /tmp directory.
              (substitute* "test/files-tests.el"
                (("/bin/") "/tmp/"))
-             (zero? (system* "make" "test-batch")))))))
+             #t)))
+       #:tests? #t
+       #:test-command '("make" "test-batch")))
     (home-page "http://company-mode.github.io/")
     (synopsis "Modular text completion framework")
     (description
@@ -3535,11 +3528,8 @@ S-expression.")
        ("emacs-s" ,emacs-s)
        ("ert-runner" ,ert-runner)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'install 'check
-           (lambda _
-             (zero? (system* "ert-runner")))))))
+     `(#:tests? #t
+       #:test-command '("ert-runner")))
     (home-page "https://github.com/clojure-emacs/clojure-mode")
     (synopsis "Major mode for Clojure code")
     (description
@@ -3718,14 +3708,10 @@ E-Prime forbids the use of the \"to be\" form to strengthen your writing.")
            "1is4dcv6blslpzbjcg8l2jpxi8xj96q4cm0nxjxsyswpm8bw8ki0"))))
       (build-system emacs-build-system)
       (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-before 'install 'check
-             (lambda _
-               (zero? (system* "emacs" "-batch"
-                               "-l" "julia-mode.el"
-                               "-l" "julia-mode-tests.el"
-                               "-f" "ert-run-tests-batch-and-exit")))))))
+       `(#:tests? #t
+         #:test-command '("emacs" "--batch"
+                          "-l" "julia-mode-tests.el"
+                          "-f" "ert-run-tests-batch-and-exit")))
       (home-page "https://github.com/JuliaEditorSupport/julia-emacs")
       (synopsis "Major mode for Julia")
       (description "This Emacs package provides a mode for the Julia
@@ -3916,11 +3902,8 @@ If you want to mark a folder manually as a project just create an empty
                 "1fd1mx0q1qb9vgdzls5ppxfriyid48blg8smgjspiazp7kxakzxv"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "make" "test")))))))
+     `(#:tests? #t
+       #:test-command '("make" "test")))
     (home-page "https://github.com/skeeto/elfeed")
     (synopsis "Atom/RSS feed reader for Emacs")
     (description
@@ -5092,13 +5075,11 @@ Yasnippet.")
        "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
    (build-system emacs-build-system)
    (arguments
-    `(#:phases
-      (modify-phases %standard-phases
-        (add-before 'install 'check
-                    (lambda _
-                      (zero? (system* "emacs" "-batch" "-l" "memoize.el"
-                                      "-l" "memoize-test.el"
-                                      "-f" "ert-run-tests-batch-and-exit")))))))
+    `(#:tests? #t
+      #:test-command '("emacs" "-batch"
+                       "-l" "memoize.el"
+                       "-l" "memoize-test.el"
+                       "-f" "ert-run-tests-batch-and-exit")))
    (home-page "https://github.com/skeeto/emacs-memoize")
    (synopsis "Emacs lisp memoization library")
    (description "@code{emacs-memoize} is an Emacs library for
@@ -5381,16 +5362,12 @@ abbreviation of the mode line displays (lighters) of minor modes.")
     (propagated-inputs
      `(("emacs-diminish" ,emacs-diminish)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-l" "use-package-tests.el"
-                             "-f" "ert-run-tests-batch-and-exit"))
-             ;; Tests fail in this release, but have been fixed in
-             ;; upstream commit 7956d40eed57d6c06bef36ebc174cf57d934e30d
-             #t)))))
+     ;; Tests fail in this release, but have been fixed in
+     ;; upstream commit 7956d40eed57d6c06bef36ebc174cf57d934e30d
+     `(#:tests? #f
+       #:test-command '("emacs" "--batch"
+                        "-l" "use-package-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/jwiegley/use-package")
     (synopsis "Declaration for simplifying your .emacs")
     (description "The use-package macro allows you to isolate package
@@ -5485,13 +5462,10 @@ fonts is supported.")
          "0zay490vjby3f7455r0vydmjg7q1gwc78hilpfb0rg4gwz224z8r"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-l" "xmlgen-test.el"
-                             "-f" "ert-run-tests-batch-and-exit")))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch"
+                        "-l" "xmlgen-test.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/philjackson/xmlgen")
     (synopsis "S-expression to XML domain specific language (DSL) in
 Emacs Lisp")
@@ -6173,32 +6147,15 @@ running a customisable handler command (@code{ignore} by default). ")
          "11fbq4scrgr7m0iwnzcrn2g7xvqwm2gf82sa7zy1l0nil7265p28"))
        (patches (search-patches "emacs-json-reformat-fix-tests.patch"))))
     (build-system emacs-build-system)
-    (propagated-inputs `(("emacs-undercover" ,emacs-undercover)))
-    (inputs
-     `(("emacs-dash" ,emacs-dash)         ; for tests
-       ("emacs-shut-up" ,emacs-shut-up))) ; for tests
+    (propagated-inputs
+     `(("emacs-undercover" ,emacs-undercover)))
+    (native-inputs
+     `(("ert-runner" ,ert-runner)
+       ("emacs-dash" ,emacs-dash)
+       ("emacs-shut-up" ,emacs-shut-up)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-undercover")
-                                   "/share/emacs/site-lisp/guix.d/undercover-"
-                                   ,(package-version emacs-undercover))
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-dash")
-                                   "/share/emacs/site-lisp/guix.d/dash-"
-                                   ,(package-version emacs-dash))
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-shut-up")
-                                   "/share/emacs/site-lisp/guix.d/shut-up-"
-                                   ,(package-version emacs-shut-up))
-                             "-l" "test/test-helper.el"
-                             "-l" "test/json-reformat-test.el"
-                             "-f" "ert-run-tests-batch-and-exit"))
-             #t)))))
+     `(#:tests? #t
+       #:test-command '("ert-runner")))
     (home-page "https://github.com/gongo/json-reformat")
     (synopsis "Reformatting tool for JSON")
     (description "@code{json-reformat} provides a reformatting tool for
@@ -6334,13 +6291,10 @@ displays results pretty-printed in XML or JSON with @code{restclient-mode}")
        (file-name (string-append name "-" version ".tar.gz"))))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-l" "which-key-tests.el"
-                             "-f" "ert-run-tests-batch-and-exit")))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch"
+                        "-l" "which-key-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/justbur/emacs-which-key")
     (synopsis "Display available key bindings in popup")
     (description
@@ -6369,11 +6323,8 @@ settings).")
     (native-inputs
      `(("ert-runner" ,ert-runner)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda _
-             (zero? (system* "ert-runner" "tests")))))))
+     `(#:tests? #t
+       #:test-command '("ert-runner" "tests")))
     (home-page "https://github.com/lewang/ws-butler")
     (synopsis "Trim spaces from end of lines")
     (description
@@ -6470,17 +6421,9 @@ editing RPM spec files.")
     (propagated-inputs
      `(("emacs-popup" ,emacs-popup)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (zero? (system* "emacs" "--batch" "-L" "."
-                             "-L" (string-append
-                                   (assoc-ref inputs "emacs-popup")
-                                   "/share/emacs/site-lisp/guix.d/popup-"
-                                   ,(package-version emacs-popup))
-                             "-l" "test/test.el"
-                             "-f" "ert-run-tests-batch-and-exit")))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch" "-l" "test/test.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/syohex/emacs-git-messenger")
     (synopsis "Popup commit message at current line")
     (description "@code{emacs-git-messenger} provides
@@ -6640,11 +6583,8 @@ Idris.")
       (native-inputs
        `(("ert-runner" ,ert-runner)))
       (arguments
-       `(#:phases
-         (modify-phases %standard-phases
-           (add-before 'install 'check
-             (lambda _
-               (zero? (system* "ert-runner")))))))
+       `(#:tests? #t
+         #:test-command '("ert-runner")))
       (home-page "https://github.com/rmuslimov/browse-at-remote")
       (synopsis "Open github/gitlab/bitbucket/stash page from Emacs")
       (description
@@ -7062,16 +7002,10 @@ emulates Vim features and provides Vim-like key bindings.")
     (propagated-inputs
      `(("emacs-evil" ,emacs-evil)))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'install 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (invoke "emacs" "--batch" "-L"
-                     (string-append (assoc-ref inputs "emacs-evil")
-                                    "/share/emacs/site-lisp/guix.d/evil-"
-                                    ,(package-version emacs-evil))
-                     "-l" "evil-quickscope-tests.el"
-                     "-f" "ert-run-tests-batch-and-exit"))))))
+     `(#:tests? #t
+       #:test-command '("emacs" "--batch"
+                        "-l" "evil-quickscope-tests.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
     (home-page "https://github.com/blorbx/evil-quickscope")
     (synopsis "Target highlighting for emacs evil-mode f,F,t and T commands")
     (description "@code{emacs-evil-quickscope} highlights targets for Evil
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-gnu-emacs-Fix-emacs-memoize-indentation.patch --]
[-- Type: text/x-patch, Size: 2536 bytes --]

From 6c25dcf3335285834c20752e2187b1430d956d19 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 16 Apr 2018 22:20:21 -0400
Subject: [PATCH 07/30] gnu: emacs: Fix emacs-memoize indentation.

* gnu/packages/emacs.scm (emacs-memoize): Reindent.
---
 gnu/packages/emacs.scm | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7f6c1a4a0..9269826e2 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -5061,30 +5061,30 @@ Yasnippet.")
 
 (define-public emacs-memoize
   (package
-   (name "emacs-memoize")
-   (version "20130421.b55eab0")
-   (source
-    (origin
-     (method git-fetch)
-     (uri (git-reference
-           (url "https://github.com/skeeto/emacs-memoize")
-           (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
-     (file-name (string-append name "-" version ".tar.gz"))
-     (sha256
-      (base32
-       "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
-   (build-system emacs-build-system)
-   (arguments
-    `(#:tests? #t
-      #:test-command '("emacs" "-batch"
-                       "-l" "memoize.el"
-                       "-l" "memoize-test.el"
-                       "-f" "ert-run-tests-batch-and-exit")))
-   (home-page "https://github.com/skeeto/emacs-memoize")
-   (synopsis "Emacs lisp memoization library")
-   (description "@code{emacs-memoize} is an Emacs library for
+    (name "emacs-memoize")
+    (version "20130421.b55eab0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/skeeto/emacs-memoize")
+             (commit "b55eab0cb6ab05d941e07b8c01f1655c0cf1dd75")))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0fjwlrdm270qcrqffvarw5yhijk656q4lam79ybhaznzj0dq3xpw"))))
+    (build-system emacs-build-system)
+    (arguments
+     `(#:tests? #t
+       #:test-command '("emacs" "-batch"
+                        "-l" "memoize.el"
+                        "-l" "memoize-test.el"
+                        "-f" "ert-run-tests-batch-and-exit")))
+    (home-page "https://github.com/skeeto/emacs-memoize")
+    (synopsis "Emacs lisp memoization library")
+    (description "@code{emacs-memoize} is an Emacs library for
 memoizing functions.")
-   (license license:unlicense)))
+    (license license:unlicense)))
 
 (define-public emacs-linum-relative
   (package
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-gnu-emacs-pdf-tools-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1218 bytes --]

From 7a10a87d43a5b1c4b6878ca4a8e910977c94498d Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 14:08:15 -0400
Subject: [PATCH 08/30] gnu: emacs-pdf-tools: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-pdf-tools)[phases]: Add set-emacs-load-path.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 9269826e2..7583d35fb 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1471,7 +1471,9 @@ filters, new key bindings and faces.  It can be enabled by
              ;; upgrading" that pdf-tools tries to perform.
              (emacs-substitute-variables "pdf-tools.el"
                ("pdf-tools-handle-upgrades" '()))))
-         (add-after 'emacs-patch-variables 'emacs-install
+         (add-after 'emacs-patch-variables 'set-emacs-load-path
+           (assoc-ref emacs:%standard-phases 'set-emacs-load-path))
+         (add-after 'set-emacs-load-path 'emacs-install
            (assoc-ref emacs:%standard-phases 'install))
          (add-after 'emacs-install 'emacs-build
            (assoc-ref emacs:%standard-phases 'build))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-gnu-Add-emacs-ert-expectations.patch --]
[-- Type: text/x-patch, Size: 1441 bytes --]

From b0ace67abb89c97f62a4a53d6de3ca0f93556f42 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 14:15:45 -0400
Subject: [PATCH 09/30] gnu: Add emacs-ert-expectations.

* gnu/packages/emacs.scm (emacs-ert-expectations): New variable.
---
 gnu/packages/emacs.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7583d35fb..2c72b885d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2425,6 +2425,23 @@ A minor mode @code{debbugs-browse-mode} let you browse URLs to the GNU Bug
 Tracker as well as bug identifiers prepared for @code{bug-reference-mode}.")
     (license license:gpl3+)))
 
+(define-public emacs-ert-expectations
+  (package
+    (name "emacs-ert-expectations")
+    (version "0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri "https://www.emacswiki.org/emacs/download/ert-expectations.el")
+       (sha256
+        (base32
+         "0cwy3ilsid90abzzjb7ha2blq9kmv3gfp3icwwfcz6qczgirq6g7"))))
+    (build-system emacs-build-system)
+    (home-page "https://www.emacswiki.org/emacs/download/ert-expectations.el")
+    (synopsis "Simple unit test framework for Emacs")
+    (description "A very simple unit test framework to use with @code{ERT}.")
+    (license license:gpl3+)))
+
 (define-public emacs-deferred
   (package
     (name "emacs-deferred")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-gnu-emacs-deferred-Enable-tests.patch --]
[-- Type: text/x-patch, Size: 1950 bytes --]

From 1f51733ba45b0a7a5a61896a9f1e54f94b925b2e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:01:05 -0400
Subject: [PATCH 10/30] gnu: emacs-deferred: Enable tests.

* gnu/packages/emacs.scm (emacs-deferred)[phases]: Add fix-makefile.
[tests?]: Set to #t
[test-command]: Add.
[native-inputs]: Add ert-runner, emacs-ert-expectations and emacs-undercover.
---
 gnu/packages/emacs.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2c72b885d..8b5135f38 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2457,7 +2457,24 @@ Tracker as well as bug identifiers prepared for @code{bug-reference-mode}.")
                 "0xy9zb6wwkgwhcxdnslqk52bq3z24chgk6prqi4ks0qcf2bwyh5h"))
               (file-name (string-append name "-" version))))
     (build-system emacs-build-system)
-    ;; FIXME: Would need 'el-expectations' to actually run tests.
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'fix-makefile
+           (lambda _
+             (substitute* "Makefile"
+               (("\\$\\(CASK\\) exec ") ""))
+             #t)))
+       #:tests? #t
+       ;; FIXME: Normally we'd run the "test" target but for some reason the
+       ;; test-deferred target fails when run in the Guix build environment
+       ;; with the error: (file-error "Searching for program" "No such file or
+       ;; directory" "/bin/sh").
+       #:test-command '("make" "test-concurrent" "test-concurrent-compiled")))
+    (native-inputs
+     `(("ert-runner" ,ert-runner)
+       ("emacs-ert-expectations" ,emacs-ert-expectations)
+       ("emacs-undercover" ,emacs-undercover)))
     (synopsis "Simple asynchronous functions for Emacs Lisp")
     (description
      "The @code{deferred.el} library provides support for asynchronous tasks.
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: 0011-gnu-emacs-org-trello-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1073 bytes --]

From fd32c52f42112a7d50b1835878af44aaf22f8224 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:03:35 -0400
Subject: [PATCH 11/30] gnu: emacs-org-trello: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-org-trello)[native-inputs]: Add emacs-f and
emacs-helm.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 8b5135f38..1ce36c69c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2976,7 +2976,9 @@ started with 20 minutes.  All values are customizable.")
      `(("emacs-deferred" ,emacs-deferred)
        ("emacs-request" ,emacs-request)
        ("emacs-dash" ,emacs-dash)
-       ("emacs-s" ,emacs-s)))
+       ("emacs-s" ,emacs-s)
+       ("emacs-f" ,emacs-f)
+       ("emacs-helm" ,emacs-helm)))
     (home-page "https://org-trello.github.io")
     (synopsis "Emacs minor mode for interacting with Trello")
     (description "This package provides an Emacs minor mode to extend
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #13: 0012-gnu-emacs-smartparens-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1117 bytes --]

From 5e390573d856b83df97301c68eaccf16efaefdf8 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:05:28 -0400
Subject: [PATCH 12/30] gnu: emacs-smartparens: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-smartparens)[propagated-inputs]: Add
emacs-markdown-mode.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1ce36c69c..f86dc3237 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3105,7 +3105,9 @@ single theme but a set of guidelines with numerous implementations.")
                (base32
                 "0q5as813xs8y29i3v2rm97phd6m7xsmmw6hwbvx57gwmi8i1c409"))))
     (build-system emacs-build-system)
-    (propagated-inputs `(("emacs-dash" ,emacs-dash)))
+    (propagated-inputs
+     `(("emacs-dash" ,emacs-dash)
+       ("emacs-markdown-mode" ,emacs-markdown-mode)))
     (home-page "https://github.com/Fuco1/smartparens")
     (synopsis "Paredit-like insertion, wrapping and navigation with user
 defined pairs")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #14: 0013-gnu-emacs-realgud-Adapt-phase-for-the-reworked-emacs.patch --]
[-- Type: text/x-patch, Size: 964 bytes --]

From faae23c6bf52e930152c02870830335805346911 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:09:38 -0400
Subject: [PATCH 13/30] gnu: emacs-realgud: Adapt phase for the reworked
 emacs-build-system.

* gnu/packages/emacs.scm (emacs-realgud)[phases]: Move the fix-autogen-script
after the set-emacs-load-path phase.
---
 gnu/packages/emacs.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index f86dc3237..c533cb414 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3286,7 +3286,7 @@ after buffer changes.")
      `(#:tests? #t
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'fix-autogen-script
+         (add-after 'set-emacs-load-path 'fix-autogen-script
            (lambda _
              (substitute* "autogen.sh"
                (("./configure") "sh configure"))))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #15: 0014-gnu-emacs-request-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 974 bytes --]

From 1f8c732e4ee4a919c40e1624c46df664513a9008 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 16:11:53 -0400
Subject: [PATCH 14/30] gnu: emacs-request: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-request)[propagated-inputs]: Add emacs-deferred.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index c533cb414..a7e9e2f3a 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -3340,6 +3340,8 @@ parallel.")
                (base32
                 "0wyxqbb35yqf6ci47531lk32d6fppamx9d8826kdz983vm87him7"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-deferred" ,emacs-deferred)))
     (home-page "https://github.com/tkf/emacs-request")
     (synopsis "Package for speaking HTTP in Emacs Lisp")
     (description "This package provides a HTTP request library with multiple
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #16: 0015-gnu-emacs-idris-mode-Fix-hash.patch --]
[-- Type: text/x-patch, Size: 910 bytes --]

From 72382eebe1fa8b14a22befaea2e3e5fb0fb00da1 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 19 Mar 2018 21:13:33 -0400
Subject: [PATCH 15/30] gnu: emacs-idris-mode: Fix hash.

* gnu/packages/emacs.scm (emacs-idris-mode): Fix hash.
---
 gnu/packages/emacs.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index a7e9e2f3a..7c35b43a0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6587,7 +6587,7 @@ key.  Optionally, a mouse pop-up can be added by binding
              version ".tar"))
        (sha256
         (base32
-         "0ld4kfwnyyhlsnj5f6cbn4is4mpxdqalk2aifkw02r00mbr9n294"))))
+         "02r1qqsxi6qk7q4cj6a6pygbj856dcw9vcmhfh0ib92j41v77q6y"))))
     (build-system emacs-build-system)
     (propagated-inputs
      `(("emacs-prop-menu" ,emacs-prop-menu)))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #17: 0016-gnu-emacs-sx-Fix-build-issue.patch --]
[-- Type: text/x-patch, Size: 2631 bytes --]

From 9b22ad62152814d3518c17a2193c6b4d3448cc23 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 19 Mar 2018 21:28:42 -0400
Subject: [PATCH 16/30] gnu: emacs-sx: Fix build issue.

The package would fail building when attempting to create a cache
directory.  This has been fixed upstream but not in a tagged release.

* gnu/packages/emacs.scm (emacs-sx): Update to latest git version.
---
 gnu/packages/emacs.scm | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7c35b43a0..a2a43b4f6 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1736,26 +1736,30 @@ strings.")
     (license license:gpl2+)))
 
 (define-public emacs-sx
-  (package
-    (name "emacs-sx")
-    (version "0.4")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/vermiculus/sx.el/"
-                                  "archive/v" version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "1w0xghfljqg31axcnv8gzlrd8pw25nji6idnrhflq0af9qh1dw03"))))
-    (build-system emacs-build-system)
-    (propagated-inputs
-     `(("emacs-markdown-mode" ,emacs-markdown-mode)))
-    (home-page "https://github.com/vermiculus/sx.el/")
-    (synopsis "Emacs StackExchange client")
-    (description
-     "Emacs StackExchange client.  Ask and answer questions on
+  (let ((version "20180212")
+        (revision "1")
+        (commit "833435fbf90d1c9e927d165b155f3b1ef39271de"))
+    (package
+      (name "emacs-sx")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/vermiculus/sx.el")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1369xaxq1vy3d9yh862ddnhddikdpg2d0wv1ly00pnvdp9v4cqgd"))))
+      (build-system emacs-build-system)
+      (propagated-inputs
+       `(("emacs-markdown-mode" ,emacs-markdown-mode)))
+      (home-page "https://github.com/vermiculus/sx.el")
+      (synopsis "Emacs StackExchange client")
+      (description
+       "Emacs StackExchange client.  Ask and answer questions on
 Stack Overflow, Super User, and other StackExchange sites.")
-    (license license:gpl3+)))
+      (license license:gpl3+))))
 
 (define-public emacs-f
   (package
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #18: 0017-gnu-emacs-polymode-Fix-compilation-error.patch --]
[-- Type: text/x-patch, Size: 1363 bytes --]

From 63f66d9ff591c4d41c65c541ac069fe2851f80ea Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 19 Mar 2018 21:55:27 -0400
Subject: [PATCH 17/30] gnu: emacs-polymode: Fix compilation error.

* gnu/packages/emacs.scm (emacs-polymode)
[add-modes-subdir-to-loadpath]: New phase.
---
 gnu/packages/emacs.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index a2a43b4f6..0bbc63bf6 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6917,6 +6917,15 @@ contexts.
                  (base32
                   "057cybkq3cy07n5s332k071sjiky3mziy003lza4rh75mgqkwhmh"))))
       (build-system emacs-build-system)
+      (arguments
+       `(#:include (cons* "^modes/.*\\.el$" %default-include)
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'set-emacs-load-path 'add-modes-subdir-to-load-path
+             (lambda _
+               (setenv "EMACSLOADPATH"
+                       (string-append (getenv "EMACSLOADPATH")
+                                      ":" (getcwd) "/modes" ":")))))))
       (home-page "https://github.com/vspinu/polymode")
       (synopsis "Framework for multiple Emacs modes based on indirect buffers")
       (description "Polymode is an Emacs package that offers generic support
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #19: 0018-gnu-Add-emacs-scel.patch --]
[-- Type: text/x-patch, Size: 3153 bytes --]

From 5929cf659034db87f96d8e6ff4395f1c01148dfc Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 18 Mar 2018 16:37:30 -0400
Subject: [PATCH 18/30] gnu: Add emacs-scel.

* gnu/packages/emacs.scm (emacs-scel): New variable.
---
 gnu/packages/emacs.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 0bbc63bf6..f91a764b8 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2646,6 +2646,59 @@ implementation in Emacs.  To use it just load this file and bind that function
 to a key in your preferred mode.")
       (license license:public-domain))))
 
+(define-public emacs-scel
+  (let ((version "20170629")
+        (revision "1")
+        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
+    (package
+      (name "emacs-scel")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/supercollider/scel.git")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'move-el-files
+             (lambda _
+               (for-each
+                (lambda (f)
+                  (rename-file f (basename f)))
+                (find-files "el" "^.*\\.el(\\.in)?$"))
+               #t))
+           (add-after 'move-el-files 'configure-sclang-vars
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((supercollider (assoc-ref inputs "supercollider")))
+                 (substitute* "sclang-vars.el.in"
+                   (("@PKG_DATA_DIR@")
+                    (string-append supercollider "/share/SuperCollider"))
+                   ;; See: https://github.com/widp/el-supercollider/issues/1
+                   (("Help") "HelpSource")))
+               (rename-file "sclang-vars.el.in" "sclang-vars.el")
+               #t))
+           (add-after 'configure-sclang-vars 'install-extensions
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (ext-dir (string-append
+                                out "/share/SuperCollider/Extensions"
+                                "/scide_scel")))
+                 (delete-file "sc/CMakeLists.txt")
+                 (copy-recursively "sc" ext-dir))
+               #t)))))
+      (inputs
+       `(("supercollider" ,supercollider)))
+      (home-page "https://github.com/supercollider/scel")
+      (synopsis "SuperCollider Emacs interface")
+      (description "scel is an Emacs based interface to SuperCollider.")
+      (license license:gpl2+))))
+
 (define-public emacs-mit-scheme-doc
   (package
     (name "emacs-mit-scheme-doc")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #20: 0019-gnu-Add-emacs-kv.patch --]
[-- Type: text/x-patch, Size: 1721 bytes --]

From d8aff6113460735bf0a3de77382dc43383e27af6 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 24 Mar 2018 21:37:41 -0400
Subject: [PATCH 19/30] gnu: Add emacs-kv.

* gnu/packages/emacs.scm (emacs-kv): New variable.
---
 gnu/packages/emacs.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index f91a764b8..335142b55 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7230,6 +7230,31 @@ scratch buffer, and, by virtue of this extension, do so using the Emacs
 formatting rules for that language.")
       (license license:bsd-2))))
 
+(define-public emacs-kv
+  (package
+    (name "emacs-kv")
+    (version "0.0.19")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/nicferrier/emacs-kv.git")
+                    (commit "721148475bce38a70e0b678ba8aa923652e8900e")))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0r0lz2s6gvy04fwnafai668jsf4546h4k6zd6isx5wpk0n33pj5m"))))
+    (build-system emacs-build-system)
+    (arguments
+     `(#:tests? #t
+       #:test-command '("ert-runner" "kv-tests.el")))
+    (native-inputs
+     `(("ert-runner" ,ert-runner)))
+    (home-page "https://github.com/nicferrier/emacs-kv")
+    (synopsis "Key/value data structures library")
+    (description "A collection of tools for dealing with key/value data
+structures such as plists, alists and hash-tables.")
+    (license license:gpl3+)))
+
 (define-public emacs-esxml
   (package
     (name "emacs-esxml")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #21: 0020-gnu-emacs-esxml-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1987 bytes --]

From baae04ddbf5edd0512d7144d937aa508de112070 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 24 Mar 2018 23:07:18 -0400
Subject: [PATCH 20/30] gnu: emacs-esxml: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-esxml): Add phases to patch sources.
---
 gnu/packages/emacs.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 335142b55..4773c34b1 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7269,6 +7269,32 @@ structures such as plists, alists and hash-tables.")
                (base32
                 "00vv8a75wdklygdyr4km9mc2ismxak69c45jmcny41xl44rp9x8m"))))
     (build-system emacs-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; See: https://github.com/tali713/esxml/pull/28.
+         (add-after 'unpack 'fix-css-lite.el
+           (lambda _
+             (substitute* "css-lite.el"
+               ((";;; main interface")
+                (string-append ";;; main interface\n"
+                               "(require 'cl-lib)"))
+               (("mapcan")
+                "cl-mapcan")
+               (("',\\(cl-mapcan #'process-css-rule rules\\)")
+                "(cl-mapcan #'process-css-rule ',rules)"))
+             #t))
+         (add-after 'fix-css-lite.el 'fix-esxml-form.el
+           (lambda _
+             (substitute* "esxml-form.el"
+               ((",esxml-form-field-defn")
+                "#'esxml-form-field-defn"))))
+         ;; See: https://github.com/tali713/esxml/issues/25
+         (add-after 'fix-esxml-form.el 'rm-broken-test-file.el
+           (lambda _
+             (delete-file "esxpath.el"))))))
+    (propagated-inputs
+     `(("emacs-kv" ,emacs-kv)))
     (home-page "https://github.com/tali713/esxml/")
     (synopsis "SXML for EmacsLisp")
     (description "This is XML/XHTML done with S-Expressions in EmacsLisp.
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #22: 0021-gnu-emacs-mu4e-alert-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1274 bytes --]

From c6b89b0f02e3f7a2e0c622c4a21283548047ce24 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 28 Mar 2018 20:56:18 -0400
Subject: [PATCH 21/30] gnu: emacs-mu4e-alert: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-mu4e-alert)[propagated-inputs]: Add mu.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4773c34b1..7936e6bec 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -90,6 +90,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages acl)
+  #:use-module (gnu packages mail)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pdf)
@@ -5025,7 +5026,8 @@ customizable by the user.")
          "07qc834qnxn8xi4bw5nawj8g91bmkzw0r0vahkgysp7r9xrf57gj"))))
     (build-system emacs-build-system)
     (propagated-inputs
-     `(("emacs-alert" ,emacs-alert)
+     `(("mu" ,mu)                       ;for byte compilation
+       ("emacs-alert" ,emacs-alert)
        ("emacs-s" ,emacs-s)
        ("emacs-ht" ,emacs-ht)))
     (home-page "https://github.com/iqbalansari/mu4e-alert")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #23: 0022-gnu-emacs-org-contrib-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 934 bytes --]

From e931e99c2e34ed225af73ed4b7c39d3bb834fac9 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 28 Mar 2018 21:50:15 -0400
Subject: [PATCH 22/30] gnu: emacs-org-contrib: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-org-contrib)[native-inputs]: Add emacs-scel.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 7936e6bec..fc0ae5ffb 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -4640,6 +4640,8 @@ reproducible research.")
                     out "/share/emacs/site-lisp/guix.d/org-contrib-" ,version)
                  (for-each delete-file duplicates))
                #t))))))
+    (native-inputs
+     `(("emacs-scel" ,emacs-scel))) ;for byte compilation
     (propagated-inputs
      `(("emacs-org" ,emacs-org)))
     (synopsis "Contributed packages to Org mode")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #24: 0023-gnu-emacs-evil-matchit-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 888 bytes --]

From 48c861c552d26277636bd54aa3bde86fb46895ef Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 20:41:48 -0400
Subject: [PATCH 23/30] gnu: emacs-evil-matchit: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-evil-matchit)[propagated-inputs]: Add
emacs-evil.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index fc0ae5ffb..2b175a83f 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7065,6 +7065,8 @@ Feautures:
         (base32
          "1hm0k53m7d8zv2pk4p93k5mmilsv1mz7y2z6dqf7r6f0zmncs31a"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("evil" ,emacs-evil)))
     (home-page "https://github.com/redguardtoo/evil-matchit")
     (synopsis "Vim matchit ported into Emacs")
     (description
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #25: 0024-gnu-Add-emacs-spark.patch --]
[-- Type: text/x-patch, Size: 1718 bytes --]

From 868f4e4e871e255ba29a3d1b5924a147526e9054 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 21:18:16 -0400
Subject: [PATCH 24/30] gnu: Add emacs-spark.

* gnu/packages/emacs.scm (emacs-spark): New variable.
---
 gnu/packages/emacs.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 2b175a83f..f00b9864c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1909,6 +1909,29 @@ Expectations, but it can be used in other contexts.")
 definitions for testing with the Ecukes framework.")
     (license license:gpl3+)))
 
+(define-public emacs-spark
+  (let ((version "20160503")            ;no proper tag, use date of commit
+        (commit "0bf148c3ede3b31d56fd75f347cdd0b0eae60025")
+        (revision "1"))
+    (package
+      (name "emacs-spark")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/alvinfrancis/spark.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1ykqr86j17mi95s08d9fp02d7ych1331b04dcqxzxnmpkhwngyj1"))))
+      (build-system emacs-build-system)
+      (home-page "https://github.com/alvinfrancis/spark")
+      (synopsis "Port of cl-spark to Emacs Lisp")
+      (description "This library is a straightforward port of @code{cl-spark}
+to Emacs Lisp.")
+      (license license:expat))))
+
 (define-public emacs-es-mode
   (package
     (name "emacs-es-mode")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #26: 0025-gnu-emacs-es-mode-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 1078 bytes --]

From 8f16738318a7229898c87d7467fb193cd55b3554 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 21:18:36 -0400
Subject: [PATCH 25/30] gnu: emacs-es-mode: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-es-mode)[propagated-inputs]: Add emacs-dash
and emacs-spark.
---
 gnu/packages/emacs.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index f00b9864c..4b0fa7acd 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1949,7 +1949,9 @@ to Emacs Lisp.")
     (propagated-inputs
      ;; The version of org in Emacs 24.5 is not sufficient, and causes tables
      ;; to be rendered incorrectly
-     `(("emacs-org" ,emacs-org)))
+     `(("emacs-org" ,emacs-org)
+       ("emacs-dash" ,emacs-dash)
+       ("emacs-spark" ,emacs-spark)))
     (home-page "https://github.com/dakrone/es-mode")
     (synopsis "Major mode for editing Elasticsearch queries")
     (description "@code{es-mode} includes highlighting, completion and
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #27: 0026-gnu-Add-emacs-eimp.patch --]
[-- Type: text/x-patch, Size: 2506 bytes --]

From de2adbd9538d50efd52d13c18403bc3c13712ae4 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 21:46:35 -0400
Subject: [PATCH 26/30] gnu: Add emacs-eimp.

* gnu/packages/emacs.scm (emacs-eimp): New variable.
---
 gnu/packages/emacs.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4b0fa7acd..3c3d9e8db 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6361,6 +6361,44 @@ from within Emacs.  Restclient runs queries from a plan-text query sheet,
 displays results pretty-printed in XML or JSON with @code{restclient-mode}")
       (license license:public-domain))))
 
+(define-public emacs-eimp
+  (let ((version "1.4.0")
+        (commit "2e7536fe6d8f7faf1bad7a8ae37faba0162c3b4f")
+        (revision "1"))
+    (package
+      (name "emacs-eimp")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/nicferrier/eimp.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "154d57yafxbcf39r89n5j43c86rp2fki3lw3gwy7ww2g6qkclcra"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-mogrify-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((imagemagick (assoc-ref inputs "imagemagick")))
+                 ;; eimp.el is read-only in git.
+                 (invoke "chmod" "+w" "eimp.el")
+                 (emacs-substitute-variables "eimp.el"
+                   ("eimp-mogrify-program"
+                    (string-append imagemagick "/bin/mogrify"))))
+               #t)))))
+    (inputs
+     `(("imagemagick" ,imagemagick)))   ;provides the mogrify binary.
+    (home-page "https://github.com/nicferrier/eimp")
+    (synopsis "Interactive image manipulation from within Emacs")
+    (description "This package allows interactive image manipulation from
+within Emacs.  It uses the code@{mogrify} utility from ImageMagick to do the
+actual transformations.")
+    (license license:gpl2+))))
+
 (define-public emacs-dired-hacks
   (let ((commit "eda68006ce73bbf6b9b995bfd70d08bec8cade36")
         (revision "1"))
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #28: 0027-gnu-emacs-dired-hacks-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 853 bytes --]

From f0ce29d5fe5e096631f35e2c2459371c121ad3cb Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 22:56:29 -0400
Subject: [PATCH 27/30] gnu: emacs-dired-hacks: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-dired-hacks)[propagated-inputs]: Add emacs-eimp.
---
 gnu/packages/emacs.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 3c3d9e8db..c860a647d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -6418,6 +6418,7 @@ actual transformations.")
       (build-system emacs-build-system)
       (propagated-inputs
        `(("emacs-dash" ,emacs-dash)
+         ("emacs-eimp" ,emacs-eimp)
          ("emacs-f" ,emacs-f)
          ("emacs-s" ,emacs-s)))
       (home-page "https://github.com/Fuco1/dired-hacks")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #29: 0028-gnu-emacs-cdlatex-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 910 bytes --]

From 1f50be860953ba79fd6bd2675b9fab9a1255a674 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 30 Mar 2018 23:16:10 -0400
Subject: [PATCH 28/30] gnu: emacs-cdlatex: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-cdlatex)[propagated-inputs]: Add emacs-auctex.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index c860a647d..ed0fd6f91 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -5616,6 +5616,8 @@ conversion for Emacs Lisp.")
         (base32
          "0pivapphmykc6vhvpx7hdyl55ls37vc4jcrxpvs4yk7jzcmwa9xp"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-auctex" ,emacs-auctex)))
     (home-page "https://github.com/cdominik/cdlatex")
     (synopsis "Fast Emacs input methods for LaTeX environments and
 math")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #30: 0029-gnu-Add-emacs-howm.patch --]
[-- Type: text/x-patch, Size: 1493 bytes --]

From ef406206b7bc1ebbdb940010e51a1e96dd01bb61 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 00:22:24 -0400
Subject: [PATCH 29/30] gnu: Add emacs-howm.

* gnu/packages/emacs.scm (emacs-howm): New variable.
---
 gnu/packages/emacs.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index ed0fd6f91..5ca0c7a6c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1184,6 +1184,25 @@ or XEmacs.")
 a set of simplified face specifications and a user-supplied color palette")
     (license license:gpl3+)))
 
+(define-public emacs-howm
+  (package
+    (name "emacs-howm")
+    (version "1.4.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://howm.sourceforge.jp/a/howm-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0ddm91l6z58j7x59fa966j6q1rg4cinyza4r8ibg80hprn5h31qk"))))
+    (build-system emacs-build-system)
+    (home-page "http://howm.osdn.jp/")
+    (synopsis "Note-taking tool for Emacs")
+    (description "Howm is a note-taking tool for Emacs.  Like with
+code@{emacs-wiki.el}, it facilitates using hyperlinks and doing full-text
+searches.  Unlike code@{emacs-wiki.el}, it can be combined with any format.")
+    (license license:gpl1+)))
+
 (define-public emacs-calfw
   (package
     (name "emacs-calfw")
-- 
2.16.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #31: 0030-gnu-emacs-calfw-Fix-byte-compilation.patch --]
[-- Type: text/x-patch, Size: 943 bytes --]

From 1fb7cb90b8e4334a88d861cc9e7d417d87bbeee6 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 00:25:23 -0400
Subject: [PATCH 30/30] gnu: emacs-calfw: Fix byte compilation.

* gnu/packages/emacs.scm (emacs-calfw)[propagated-inputs]: Add emacs-howm.
---
 gnu/packages/emacs.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 5ca0c7a6c..eccba23d1 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1218,6 +1218,8 @@ searches.  Unlike code@{emacs-wiki.el}, it can be combined with any format.")
         (base32
          "17ssg8gx66yp63nhygjq2r6kgl4h45cacmrxsxs9f0lrfcx37k0l"))))
     (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-howm" ,emacs-howm)))
     (home-page "https://github.com/kiwanami/emacs-calfw/")
     (synopsis "Calendar framework for Emacs")
     (description
-- 
2.16.1


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

* [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.
  2018-04-17  2:59   ` [bug#31018] [PATCHv2] " Maxim Cournoyer
@ 2018-04-20 17:46     ` Arun Isaac
  2018-05-03 16:32       ` bug#31018: " Arun Isaac
       [not found]     ` <5b6467d3.AMMAAAVkQu8AAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa2idv@mailjet.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2018-04-20 17:46 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 31018

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


I've pushed all patches except those concerning strict byte compilation,
emacs-scel, emacs-org-contrib, emacs-howm and emacs-calfw.

Some comments follow.

> Done, although match-let appears to be undocumented :/.

Yes, match-let is currently undocumented. But, I have a pending patch to
guile regarding this. So, hopefully, this will be fixed soon.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30144

> In the past I played with attempting to define a
> search-path-specification for our Emacs package, which would
> generalize even more the way our Emacs packages are discovered in
> Guix. That ended up looking like the following:
>
> --8<---------------cut here---------------start------------->8---
> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "EMACSLOADPATH")
> +            (files '("share/emacs/site-lisp"))
> +            (file-pattern ".*")
> +            (append-separator? #t))))))
> --8<---------------cut here---------------end--------------->8---
>
> Where the new "append-separator?" argument was added by myself (this is
> a world rebuilding change and also changes the manifest file). I didn't
> pursue that for now given that it still suffers from 1. explained above.
>
> The nice properties of this however was that it was now possible to have
> the Emacs dependencies found in `guix environment' as well as in the
> build system (anywhere), by using the native mechanism that Guix comes
> with. If you have interest in going that way I could revive those two
> old patches.

For now, I've pushed with the set-emacs-load-path function you
provided. But, you could pursue this world rebuilding search-paths
approach as a separate bug report.

>>> Subject: [PATCH 15/27] gnu: Add emacs-scel.
>>>
>>> +(define-public emacs-scel
>>> +  (let ((version "20170629")
>>> +        (revision "1")
>>> +        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
>>> +    (package
>>> +      (name "emacs-scel")
>>> +      (version (git-version version revision commit))
>>> +      (source (origin
>>> +                (method git-fetch)
>>> +                (uri (git-reference
>>> +                      (url "https://github.com/supercollider/scel.git")
>>> +                      (commit commit)))
>>> +                (file-name (string-append name "-" version "-checkout"))
>>> +                (sha256
>>> +                 (base32
>>> +                  "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
>>> +      (build-system emacs-build-system)
>>
>> This package seems to use a cmake-build-system. Did you try that?
>
> I didn't, on purpose. I wanted the Elisp files to be processed the same
> as most of our other Emacs packages (with the patch-el-files phase
> patching binaries, for example) that we would miss otherwise).

I get your point. But, I think we can use phases from both the
emacs-build-system and the cmake-build-system, like I have done in the
attached patch. This keeps us more in line with the upstream repo,
rather than us reinventing too much. WDYT?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-emacs-scel.patch --]
[-- Type: text/x-patch, Size: 3357 bytes --]

From dd4d51654c04a44ed77692b0207763255c733c00 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 18 Mar 2018 16:37:30 -0400
Subject: [PATCH 2/2] gnu: Add emacs-scel.

* gnu/packages/emacs.scm (emacs-scel): New variable.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
---
 gnu/packages/emacs.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 9f6965848..38ffcc472 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -65,6 +65,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages code)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages guile)
@@ -2713,6 +2714,57 @@ implementation in Emacs.  To use it just load this file and bind that function
 to a key in your preferred mode.")
       (license license:public-domain))))
 
+(define-public emacs-scel
+  (let ((version "20170629")
+        (revision "1")
+        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
+    (package
+      (name "emacs-scel")
+      (version (git-version version revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/supercollider/scel.git")
+               (commit commit)))
+         (file-name (string-append name "-" version "-checkout"))
+         (sha256
+          (base32
+           "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:modules ((guix build emacs-build-system)
+                    ((guix build cmake-build-system) #:prefix cmake:)
+                    (guix build utils))
+         #:imported-modules (,@%emacs-build-system-modules
+                             (guix build cmake-build-system))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'configure
+             (lambda* (#:key outputs #:allow-other-keys)
+               (substitute* "el/CMakeLists.txt"
+                 (("share/emacs/site-lisp/SuperCollider")
+                  (string-append
+                   "share/emacs/site-lisp/guix.d/scel-" ,version)))
+               ((assoc-ref cmake:%standard-phases 'configure)
+                #:outputs outputs
+                #:configure-flags '("-DSC_EL_BYTECOMPILE=OFF"))))
+           (add-after 'set-emacs-load-path 'add-el-dir-to-emacs-load-path
+             (lambda _
+               (setenv "EMACSLOADPATH"
+                       (string-append (getcwd) "/el:" (getenv "EMACSLOADPATH")))
+               #t))
+           (replace 'install (assoc-ref cmake:%standard-phases 'install)))))
+      (inputs
+       `(("supercollider" ,supercollider)))
+      (native-inputs
+       `(("cmake" ,cmake)))
+      (home-page "https://github.com/supercollider/scel")
+      (synopsis "SuperCollider Emacs interface")
+      (description "@code{emacs-scel} is an Emacs interface to SuperCollider.
+SuperCollider is a platform for audio synthesis and algorithmic composition.")
+      (license license:gpl2+))))
+
 (define-public emacs-mit-scheme-doc
   (package
     (name "emacs-mit-scheme-doc")
-- 
2.15.1


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


>>> Subject: [PATCH 26/27] gnu: Add emacs-howm.
>>>
>> This package seems to use the gnu-build-system. Did you try that?
>
> No, for the same reasons explained above for the emacs-scel package.

Likewise. In this case, if we don't use the gnu-build-system, we'd miss
installing some of the files. Please look at my attached patch and see
if that is acceptable.

Also, all of howm's source files declare gpl1+ to be the license. But,
their COPYING file is of gpl2. Could you bring this contradiction to the
attention of upstream?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-gnu-Add-emacs-howm.patch --]
[-- Type: text/x-patch, Size: 2255 bytes --]

From afc86b1916a27e3c82863bf69f89aad3a89ab3d7 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 31 Mar 2018 00:22:24 -0400
Subject: [PATCH 1/2] gnu: Add emacs-howm.

* gnu/packages/emacs.scm (emacs-howm): New variable.

Signed-off-by: Arun Isaac <arunisaac@systemreboot.net>
---
 gnu/packages/emacs.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index b2fd069d3..9f6965848 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1185,6 +1185,42 @@ or XEmacs.")
 a set of simplified face specifications and a user-supplied color palette")
     (license license:gpl3+)))
 
+(define-public emacs-howm
+  (package
+    (name "emacs-howm")
+    (version "1.4.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://howm.sourceforge.jp/a/howm-"
+                           version ".tar.gz"))
+       (sha256
+        (base32
+         "0ddm91l6z58j7x59fa966j6q1rg4cinyza4r8ibg80hprn5h31qk"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("emacs" ,emacs-minimal)))
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--with-howmdir=" %output
+                            "/share/emacs/site-lisp/guix.d/howm-" ,version))
+       #:modules ((guix build gnu-build-system)
+                  ((guix build emacs-build-system) #:prefix emacs:)
+                  (guix build utils))
+       #:imported-modules (,@%gnu-build-system-modules
+                           (guix build emacs-build-system)
+                           (guix build emacs-utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'rename-lispdir 'make-autoloads
+           (assoc-ref emacs:%standard-phases 'make-autoloads)))))
+    (home-page "http://howm.osdn.jp/")
+    (synopsis "Note-taking tool for Emacs")
+    (description "Howm is a note-taking tool for Emacs.  Like
+code@{emacs-wiki.el}, it facilitates using hyperlinks and doing full-text
+searches.  Unlike code@{emacs-wiki.el}, it can be combined with any format.")
+    (license license:gpl1+)))
+
 (define-public emacs-calfw
   (package
     (name "emacs-calfw")
-- 
2.15.1


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


> Subject: [PATCH 22/30] gnu: emacs-org-contrib: Fix byte compilation.
>
> * gnu/packages/emacs.scm (emacs-org-contrib)[native-inputs]: Add emacs-scel.
> ---
>  gnu/packages/emacs.scm | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index 7936e6bec..fc0ae5ffb 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -4640,6 +4640,8 @@ reproducible research.")
>                      out "/share/emacs/site-lisp/guix.d/org-contrib-" ,version)
>                   (for-each delete-file duplicates))
>                 #t))))))
> +    (native-inputs
> +     `(("emacs-scel" ,emacs-scel))) ;for byte compilation

Should emacs-scel only be a native input, or should it be a propagated input?

> A big thank you for reviewing this lengthy set of patches :)

Thank you for your patience! :-)

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

* bug#31018: [PATCHv2] Improvements for our Emacs build system and fixes.
  2018-04-20 17:46     ` Arun Isaac
@ 2018-05-03 16:32       ` Arun Isaac
  2018-05-03 16:54         ` [bug#31018] " Arun Isaac
  0 siblings, 1 reply; 11+ messages in thread
From: Arun Isaac @ 2018-05-03 16:32 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 31018-done

Arun Isaac <arunisaac@systemreboot.net> writes:

> Should emacs-scel only be a native input, or should it be a propagated input?

I made emacs-scel a propagated input, and pushed all commits as
discussed.

Thanks!

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

* [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.
  2018-05-03 16:32       ` bug#31018: " Arun Isaac
@ 2018-05-03 16:54         ` Arun Isaac
  0 siblings, 0 replies; 11+ messages in thread
From: Arun Isaac @ 2018-05-03 16:54 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 31018-done


I also fixed the tests for emacs-deferred. It was a simple matter of
setting the SHELL environment variable.

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

* [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.
       [not found]     ` <5b6467d3.AMMAAAVkQu8AAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa2idv@mailjet.com>
@ 2018-05-07 12:13       ` Maxim Cournoyer
  2018-05-07 14:14         ` Arun Isaac
  0 siblings, 1 reply; 11+ messages in thread
From: Maxim Cournoyer @ 2018-05-07 12:13 UTC (permalink / raw)
  To: Arun Isaac; +Cc: 31018

Hi Arun,

Better late than never... eh. Thanks for merging the changes. I'll
address some of your points post-mortem, in case you'd still like to
know my ideas on them :)

Arun Isaac <arunisaac@systemreboot.net> writes:

> I've pushed all patches except those concerning strict byte compilation,
> emacs-scel, emacs-org-contrib, emacs-howm and emacs-calfw.
>
> Some comments follow.
>
>> Done, although match-let appears to be undocumented :/.
>
> Yes, match-let is currently undocumented. But, I have a pending patch to
> guile regarding this. So, hopefully, this will be fixed soon.
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30144
>
>> In the past I played with attempting to define a
>> search-path-specification for our Emacs package, which would
>> generalize even more the way our Emacs packages are discovered in
>> Guix. That ended up looking like the following:
>>
>> --8<---------------cut here---------------start------------->8---
>> +    (native-search-paths
>> +     (list (search-path-specification
>> +            (variable "EMACSLOADPATH")
>> +            (files '("share/emacs/site-lisp"))
>> +            (file-pattern ".*")
>> +            (append-separator? #t))))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> Where the new "append-separator?" argument was added by myself (this is
>> a world rebuilding change and also changes the manifest file). I didn't
>> pursue that for now given that it still suffers from 1. explained above.
>>
>> The nice properties of this however was that it was now possible to have
>> the Emacs dependencies found in `guix environment' as well as in the
>> build system (anywhere), by using the native mechanism that Guix comes
>> with. If you have interest in going that way I could revive those two
>> old patches.
>
> For now, I've pushed with the set-emacs-load-path function you
> provided. But, you could pursue this world rebuilding search-paths
> approach as a separate bug report.

I will, as free time allows :)

>
>>>> Subject: [PATCH 15/27] gnu: Add emacs-scel.
>>>>
>>>> +(define-public emacs-scel
>>>> +  (let ((version "20170629")
>>>> +        (revision "1")
>>>> +        (commit "aeea3ad4be9306d14c3a734a4ff54fee10ac135b"))
>>>> +    (package
>>>> +      (name "emacs-scel")
>>>> +      (version (git-version version revision commit))
>>>> +      (source (origin
>>>> +                (method git-fetch)
>>>> +                (uri (git-reference
>>>> +                      (url "https://github.com/supercollider/scel.git")
>>>> +                      (commit commit)))
>>>> +                (file-name (string-append name "-" version "-checkout"))
>>>> +                (sha256
>>>> +                 (base32
>>>> +                  "0jvmzs1lsjyndqshhii2y4mnr3wghai26i3p75453zrpxpg0zvvw"))))
>>>> +      (build-system emacs-build-system)
>>>
>>> This package seems to use a cmake-build-system. Did you try that?
>>
>> I didn't, on purpose. I wanted the Elisp files to be processed the same
>> as most of our other Emacs packages (with the patch-el-files phase
>> patching binaries, for example) that we would miss otherwise).
>
> I get your point. But, I think we can use phases from both the
> emacs-build-system and the cmake-build-system, like I have done in the
> attached patch. This keeps us more in line with the upstream repo,
> rather than us reinventing too much. WDYT?

Seems reasonable.

[...]

>>>> Subject: [PATCH 26/27] gnu: Add emacs-howm.
>>>>
>>> This package seems to use the gnu-build-system. Did you try that?
>>
>> No, for the same reasons explained above for the emacs-scel package.
>
> Likewise. In this case, if we don't use the gnu-build-system, we'd miss
> installing some of the files. Please look at my attached patch and see
> if that is acceptable.

I've taken a look, it looks more complete (you've got the tests enabled
now). Great work.

> Also, all of howm's source files declare gpl1+ to be the license. But,
> their COPYING file is of gpl2. Could you bring this contradiction to the
> attention of upstream?

This is surprising indeed. I've let a note about it to the author here:
https://osdn.net/projects/howm/ticket/38251.

Thank you,

Maxim

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

* [bug#31018] closed (Re: [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.)
       [not found] ` <handler.31018.D31018.152536517825664.notifdone@debbugs.gnu.org>
@ 2018-05-07 12:21   ` Maxim Cournoyer
  0 siblings, 0 replies; 11+ messages in thread
From: Maxim Cournoyer @ 2018-05-07 12:21 UTC (permalink / raw)
  To: 31018

Hi Arun,

> From: Arun Isaac <arunisaac@systemreboot.net>
> Subject: Re: [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.
> To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Cc: 31018-done@debbugs.gnu.org
> Date: Thu, 03 May 2018 22:02:46 +0530 (3 days, 19 hours, 41 minutes ago)

> Arun Isaac <arunisaac@systemreboot.net> writes:

> > Should emacs-scel only be a native input, or should it be a propagated input?

> I made emacs-scel a propagated input, and pushed all commits as
> discussed.

No objections; thanks again :)

Maxim

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

* [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.
  2018-05-07 12:13       ` Maxim Cournoyer
@ 2018-05-07 14:14         ` Arun Isaac
  0 siblings, 0 replies; 11+ messages in thread
From: Arun Isaac @ 2018-05-07 14:14 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 31018

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

> Thanks for merging the changes.

Thank you for contributing to Guix! :-)

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

end of thread, other threads:[~2018-05-07 14:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01 15:57 [bug#31018] [PATCH] Improvements for our Emacs build system and fixes Maxim Cournoyer
2018-04-13 20:41 ` Arun Isaac
     [not found] ` <faec7bc3.AM8AAAStCIYAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0RYW@mailjet.com>
2018-04-14  1:28   ` Maxim Cournoyer
2018-04-14 16:51 ` Arun Isaac
     [not found] ` <9925e912.AM4AAAS8QCUAAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa0jGH@mailjet.com>
2018-04-17  2:59   ` [bug#31018] [PATCHv2] " Maxim Cournoyer
2018-04-20 17:46     ` Arun Isaac
2018-05-03 16:32       ` bug#31018: " Arun Isaac
2018-05-03 16:54         ` [bug#31018] " Arun Isaac
     [not found]     ` <5b6467d3.AMMAAAVkQu8AAAAAAAAAAAPHPfsAAAACwQwAAAAAAAW9WABa2idv@mailjet.com>
2018-05-07 12:13       ` Maxim Cournoyer
2018-05-07 14:14         ` Arun Isaac
     [not found] ` <handler.31018.D31018.152536517825664.notifdone@debbugs.gnu.org>
2018-05-07 12:21   ` [bug#31018] closed (Re: [bug#31018] [PATCHv2] Improvements for our Emacs build system and fixes.) Maxim Cournoyer

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).