all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>, Alex Kost <alezost@gmail.com>
Subject: Re: [PATCH 3/5] build: Add 'emacs-build-system'
Date: Thu, 25 Jun 2015 14:33:42 +0200	[thread overview]
Message-ID: <87mvzoge6x.fsf@gnu.org> (raw)
In-Reply-To: <CAKrPhPP6g4DhqSfHthOmoqjDdLH8Rut5E=hK_qwsDy7k5Q6CdA@mail.gmail.com> (Federico Beffa's message of "Wed, 24 Jun 2015 18:12:40 +0200")

Federico Beffa <beffa@ieee.org> skribis:

> From 725d42eb3e5c44bcec1bd81988d1f952e6be02a4 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> Date: Sun, 21 Jun 2015 10:10:05 +0200
> Subject: [PATCH 3/5] build: Add 'emacs-build-system'.
>
> * Makefile.am (MODULES): Add 'guix/build-system/emacs.scm' and
>   'guix/build/emacs-build-system.scm'.
> * guix/build-system/emacs.scm: New file.
> * guix/build/emacs-build-system.scm: New file.
> * doc/guix.texi (Build Systems): Document it.

Overall LGTM.
One last round of comments:

> +@defvr {Scheme Variable} emacs-build-system
> +This variable is exported by @code{(guix build-system emacs)}.  It
> +implements an installation procedure similar to the one of Emacs own
                                                                   ^
Add an apostrophe here.  —————————————————————————————————————————–’

> +packaging system.  It first creates the @code{PACKAGE-autoloads.el}
                   ^
Add an @pxref to the Emacs manual and then start a new paragraph.
Use @var{package} rather than PACKAGE.

> +file, then it byte compiles all Emacs Lisp files.  Differently from the
> +Emacs packaging system, the @code{info} documentation files are moved to

s/@code{info}/Info/

> +the standard documentation directory and the @code{dir} file is deleted.

@file{dir}

> +Each package is installed in its own directory under
> +@code{share/emacs/site-lisp/guix.d}.

@file as well.

> +(define-syntax lambda*-with-emacs-env
> +  (lambda (x)
> +    "Creates a 'lambda*' expression where the following variables are bound to
> +the values expected by the 'emacs-build-system': 'emacs', 'out', 'name-ver',
> +'name', 'elpa-name-ver', 'elpa-name', 'info-dir', 'el-dir'.  The first
> +parameter of the syntax must be a list of symbols which become key parameters
> +of the procedure.  'inputs' and 'outputs' are automatically added to them.
> +The remaining parameters become the body of the procedure."

Interesting trick.

> +    (syntax-case x ()
> +      ((k (p ...) e1 e2 ...)
> +       (with-syntax (((outputs inputs emacs out name-ver name elpa-name-ver
> +                               elpa-name info-dir el-dir)
> +                      (map (cut datum->syntax #'k <>)
> +                           '(outputs inputs emacs out name-ver name
> +                                     elpa-name-ver elpa-name
> +                                     info-dir el-dir))))
> +         #'(lambda* (#:key outputs inputs p ... #:allow-other-keys)
> +             (let* ((emacs (string-append (assoc-ref inputs "emacs")
> +                                          "/bin/emacs"))
> +                    (out (assoc-ref outputs "out"))
> +                    (name-ver (store-dir->name-version out))
> +                    (name (package-name->name+version name-ver))
> +                    (elpa-name-ver (store-dir->elpa-name-version out))
> +                    (elpa-name (package-name->name+version elpa-name-ver))
> +                    (info-dir (string-append out "/share/info/" name-ver))
> +                    (el-dir (string-append out %install-suffix
> +                                           "/" elpa-name-ver)))
> +               e1 e2 ...)))))))

The problem is that this forcefully introduces bindings in an opaque way
(that is, regardless of whether the ‘outputs’ binding appears in the
source, there’s an ‘outputs’ binding that magically appears; this is
“unhygienic” or “non referentially transparent,” or just “bad”.  ;-))

Ideally, the identifiers that appear in the macro expansion should
either be in the source, or be unique (compiler-generated.)

What about starting from the ‘phase-lambda’ macro that Taylan proposed
at <https://lists.gnu.org/archive/html/guix-devel/2015-02/msg00712.html>?

It doesn’t solve everything, so perhaps you would need something like:

  (elpa-lambda ((emacs emacs-program) (el-dir emacs-lisp-directory))
    ...)

where ‘emacs-program’ and ‘emacs-lisp-directory’ are literals.

How does that sound?

> +(define (emacs-inputs inputs)
> +  "Retrive the list of Emacs packages from inputs."

“Retrieve” and “INPUTS”

> +  (filter (lambda (p)
> +            (and (pair? p)
> +                 (emacs-package? (package-name->name+version (first p)))))

(match-lambda
  ((label . directory)
   (emacs-package? (package-name+version directory))))

(Which means the ‘first’ above should have been ‘second’?)

For top-level bindings, try to consistently use non-abbreviated
words–e.g., ‘store-directory->name+version’ instead of
‘store-dir->name-version’ (also ‘+’ to denote the multiple-value return
in this example.)

Could you send an updated patch?

Thank you!

Ludo’.

  reply	other threads:[~2015-06-25 12:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21  8:31 [PATCH 3/5] build: Add 'emacs-build-system' Federico Beffa
2015-06-21 20:40 ` Alex Kost
2015-06-22  8:51   ` Federico Beffa
2015-06-22 11:49     ` Mathieu Lirzin
2015-06-22 17:59     ` Alex Kost
2015-06-22 19:33       ` Federico Beffa
2015-06-22 19:40         ` Thompson, David
2015-06-23  6:51           ` Federico Beffa
2015-06-25 11:57             ` Ludovic Courtès
2015-06-25 18:39               ` Federico Beffa
2015-06-23 11:57         ` Alex Kost
2015-06-24 16:12           ` Federico Beffa
2015-06-25 12:33             ` Ludovic Courtès [this message]
2015-06-25 18:36               ` Federico Beffa
2015-06-27  9:59                 ` Ludovic Courtès
2015-07-06 17:47 ` Alex Kost
  -- strict thread matches above, loose matches on Subject: below --
2015-07-07  7:21 Federico Beffa
2015-07-07 16:58 ` Alex Kost
2015-07-08 20:22   ` Federico Beffa
2015-07-09  8:51     ` Alex Kost
2015-07-09 20:41       ` Federico Beffa
2015-07-10  6:47         ` Alex Kost
2015-07-10  7:43           ` Federico Beffa
2015-07-15 21:52           ` Ludovic Courtès

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=87mvzoge6x.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=beffa@ieee.org \
    --cc=guix-devel@gnu.org \
    /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.