From: Oleg Pykhalov <go.wigust@gmail.com>
To: Alex Kost <alezost@gmail.com>
Cc: 28832@debbugs.gnu.org
Subject: [bug#28832] [PATCH 1/3] gnu: Add emacs-json-reformat.
Date: Wed, 13 Dec 2017 07:55:22 +0300 [thread overview]
Message-ID: <87r2rzi5vp.fsf@gmail.com> (raw)
In-Reply-To: <87fu8famhm.fsf@gmail.com> (Alex Kost's message of "Tue, 12 Dec 2017 20:23:49 +0300")
[-- Attachment #1.1: Type: text/plain, Size: 869 bytes --]
Hello Alex and Ludovic,
Alex Kost <alezost@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@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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: EMACSLOADPATH --]
[-- Type: text/x-patch, Size: 2575 bytes --]
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)
[-- Attachment #1.3: Type: text/plain, Size: 250 bytes --]
> 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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-12-13 4:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-14 9:51 [bug#28832] [PATCH 0/3] gnu: Add emacs-json-mode Oleg Pykhalov
2017-10-14 10:29 ` [bug#28832] [PATCH 1/3] gnu: Add emacs-json-reformat Oleg Pykhalov
2017-10-14 10:29 ` [bug#28832] [PATCH 2/3] gnu: Add emacs-json-snatcher Oleg Pykhalov
2017-10-20 12:41 ` Ludovic Courtès
2017-10-14 10:29 ` [bug#28832] [PATCH 3/3] gnu: Add emacs-json-mode Oleg Pykhalov
2017-10-20 12:34 ` [bug#28832] [PATCH 1/3] gnu: Add emacs-json-reformat Ludovic Courtès
2017-12-01 10:23 ` Ludovic Courtès
2017-12-11 23:12 ` Oleg Pykhalov
2017-12-12 9:17 ` Ludovic Courtès
2017-12-12 17:23 ` Alex Kost
2017-12-13 4:55 ` Oleg Pykhalov [this message]
2017-12-15 20:35 ` Alex Kost
2017-12-15 9:36 ` Oleg Pykhalov
2017-12-15 14:02 ` Ludovic Courtès
2017-12-19 10:46 ` Oleg Pykhalov
2017-12-19 20:57 ` Alex Kost
2017-12-20 3:26 ` Oleg Pykhalov
2017-12-20 22:10 ` Alex Kost
2017-12-21 4:48 ` Oleg Pykhalov
2017-12-22 20:20 ` Alex Kost
2017-12-15 20:35 ` Alex Kost
2017-12-19 11:07 ` Oleg Pykhalov
2018-01-11 21:46 ` Ludovic Courtès
2018-01-15 12:01 ` bug#28832: " Oleg Pykhalov
2018-01-15 13:33 ` [bug#28832] " Ludovic Courtès
2018-01-16 17:32 ` Alex Kost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2rzi5vp.fsf@gmail.com \
--to=go.wigust@gmail.com \
--cc=28832@debbugs.gnu.org \
--cc=alezost@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.