From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 3/5] build: Add 'emacs-build-system' Date: Thu, 25 Jun 2015 14:33:42 +0200 Message-ID: <87mvzoge6x.fsf@gnu.org> References: <87twu06bhk.fsf@gmail.com> <87si9jsjyj.fsf@gmail.com> <87mvzqr623.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z86Ll-00008m-SD for guix-devel@gnu.org; Thu, 25 Jun 2015 08:33:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z86Lh-0000u4-Qi for guix-devel@gnu.org; Thu, 25 Jun 2015 08:33:49 -0400 In-Reply-To: (Federico Beffa's message of "Wed, 24 Jun 2015 18:12:40 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Federico Beffa Cc: Guix-devel , Alex Kost Federico Beffa skribis: > From 725d42eb3e5c44bcec1bd81988d1f952e6be02a4 Mon Sep 17 00:00:00 2001 > From: Federico Beffa > 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. =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=93=E2=80=99 > +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 bo= und to > +the values expected by the 'emacs-build-system': 'emacs', 'out', 'name-v= er', > +'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 param= eters > +of the procedure. 'inputs' and 'outputs' are automatically added to the= m. > +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 =E2=80=98outputs=E2=80=99 binding appea= rs in the source, there=E2=80=99s an =E2=80=98outputs=E2=80=99 binding that magically= appears; this is =E2=80=9Cunhygienic=E2=80=9D or =E2=80=9Cnon referentially transparent,=E2= =80=9D or just =E2=80=9Cbad=E2=80=9D. ;-)) 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 =E2=80=98phase-lambda=E2=80=99 macro that Tayl= an proposed at ? It doesn=E2=80=99t solve everything, so perhaps you would need something li= ke: (elpa-lambda ((emacs emacs-program) (el-dir emacs-lisp-directory)) ...) where =E2=80=98emacs-program=E2=80=99 and =E2=80=98emacs-lisp-directory=E2= =80=99 are literals. How does that sound? > +(define (emacs-inputs inputs) > + "Retrive the list of Emacs packages from inputs." =E2=80=9CRetrieve=E2=80=9D and =E2=80=9CINPUTS=E2=80=9D > + (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 =E2=80=98first=E2=80=99 above should have been =E2=80=98se= cond=E2=80=99?) For top-level bindings, try to consistently use non-abbreviated words=E2=80=93e.g., =E2=80=98store-directory->name+version=E2=80=99 instead= of =E2=80=98store-dir->name-version=E2=80=99 (also =E2=80=98+=E2=80=99 to deno= te the multiple-value return in this example.) Could you send an updated patch? Thank you! Ludo=E2=80=99.