GNU bug report logs -
#28832
[PATCH 0/3] gnu: Add emacs-json-mode.
Previous Next
Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>
Date: Sat, 14 Oct 2017 09:53:01 UTC
Severity: normal
Tags: patch
Done: Oleg Pykhalov <go.wigust <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello Alex and Ludovic,
Alex Kost <alezost <at> gmail.com> writes:
[...]
>> If ‘emacs-build-system’ sets ‘EMACSLOADPATH’ automatically, then
>> individual package definitions won’t need those -L flags. Dunno if
>> there are good reasons not to do so. Maybe Alex has an opinion?
>
> I would rather ask Federico who wrote ‘emacs-build-system’ :)
Do you mean Federico Beffa <beffa <at> fbengineering.ch>? He is quite in
Guix git repository for 9 months as I see. Is it a good idea to CC him?
> Yeah, maybe ‘emacs-build-system’ could benefit from using EMACSLOADPATH,
> I don't know, someone should probably give it a try ;-)
I succeeded to implement this, but the patch needs some more love. The
biggest issue is how to get an Emacs version in setup-environment.
You could test it on emacs-git-messenger or emacs-json-reformat.
[Message part 2 (text/x-patch, inline)]
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index bd0d2e026..269038744 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -183,6 +183,10 @@ store in '.el' files."
"Check if NAME correspond to the name of an Emacs package."
(string-prefix? "emacs-" name))
+(define (string-drop-emacs x)
+ "Drops `emacs-' from a string."
+ (string-drop x 6))
+
(define (emacs-inputs inputs)
"Retrieve the list of Emacs packages from INPUTS."
(filter (match-lambda
@@ -222,6 +226,38 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages."
strip-store-file-name)
store-dir))
+;; Copied from haskell-build-system.scm
+(define (package-name-version store-dir)
+ "Given a store directory STORE-DIR return 'name-version' of the package."
+ (let* ((base (basename store-dir)))
+ (string-drop base (+ 1 (string-index base #\-)))))
+
+(define* (setup-environment #:key inputs outputs #:allow-other-keys)
+ "Export the variable EMACSLOADPATH, which are based on INPUTS and OUTPUTS,
+respectively."
+ (let ((out (assoc-ref outputs "out")))
+ ;; EMACSLOADPATH is where Emacs looks for the source code of the build's
+ ;; dependencies.
+ (set-path-environment-variable
+ "EMACSLOADPATH"
+ ;; XXX Matching "." hints that we could do
+ ;; something simpler here...
+ (list ".")
+ (cons (let ((store-item (cdr (assoc "emacs" (emacs-inputs inputs)))))
+ ;; TODO: Get a version from inputs
+ (string-append store-item "/share/emacs/25.3/lisp"))
+ (map
+ (lambda (foobar)
+ (let ((store-item (cdr foobar)))
+ (string-append store-item
+ %install-suffix "/"
+ (string-drop-emacs
+ (package-name-version store-item)))))
+ (alist-delete "emacs"
+ (alist-delete "source"
+ (emacs-inputs inputs))))))
+ #t))
+
(define %standard-phases
(modify-phases gnu:%standard-phases
(replace 'unpack unpack)
@@ -229,6 +265,7 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages."
(delete 'check)
(delete 'install)
(replace 'build build)
+ (add-before 'build 'setup-environment setup-environment)
(add-before 'build 'install install)
(add-after 'install 'make-autoloads make-autoloads)
(add-after 'make-autoloads 'patch-el-files patch-el-files)
[Message part 3 (text/plain, inline)]
> BTW, Oleg, did you try to use 'ert-runner' instead of running emacs for
> tests manually? Perhaps, it will work; look at commit
> 8505d34829b99744a36d72dd583768f1e49210a6 for example.
Nope, but I will. Thank you for notice this!
Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 7 years and 130 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.