From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePqZw-0007r9-2n for guix-patches@gnu.org; Fri, 15 Dec 2017 09:03:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePqZq-0003I6-7X for guix-patches@gnu.org; Fri, 15 Dec 2017 09:03:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54392) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePqZq-0003Hv-38 for guix-patches@gnu.org; Fri, 15 Dec 2017 09:03:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ePqZp-0004vp-Nu for guix-patches@gnu.org; Fri, 15 Dec 2017 09:03:01 -0500 Subject: [bug#28832] [PATCH 1/3] gnu: Add emacs-json-reformat. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87lgke3vlz.fsf@gmail.com> <20171014102915.11778-1-go.wigust@gmail.com> <87y3o6uheo.fsf@gnu.org> <87d13yiw6w.fsf@gnu.org> <87609cluzf.fsf@gmail.com> <87zi6os3u3.fsf@gnu.org> <87fu8famhm.fsf@gmail.com> <877etofi3n.fsf@gmail.com> Date: Fri, 15 Dec 2017 15:02:07 +0100 In-Reply-To: <877etofi3n.fsf@gmail.com> (Oleg Pykhalov's message of "Fri, 15 Dec 2017 12:36:28 +0300") Message-ID: <87vah8hyxs.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Oleg Pykhalov Cc: Alex Kost , 28832@debbugs.gnu.org Hi Oleg, I think it would have been better to open a separate issue for this. Here are some superficial comments. I hope someone more knowledgeable about Emacs can comment. Oleg Pykhalov skribis: > From adda59022a61dfcf2add1d9f01d02df4be90a0f1 Mon Sep 17 00:00:00 2001 > From: Oleg Pykhalov > Date: Wed, 13 Dec 2017 08:10:21 +0300 > Subject: [PATCH] emacs-build-system: Add EMACSLOADPATH. > > * guix/build/emacs-build-system.scm: Add EMACSLOADPATH. Please see =E2=80=98C-x v l=E2=80=99 in that file for the syntax of commit = logs. :-) > +(define (store-directory->package-name store-dir) > + "Extract package name from STORE-DIR." > + (let-values (((name _) ((compose package-name->name+version > + strip-store-file-name) > + store-dir))) > + name)) It=E2=80=99s enough to write it like this: (define store-directory->package-name (compose package-name->name+version strip-store-file-name)) Guile does automatic =E2=80=9Cmultiple-value truncation=E2=80=9D, which mea= ns that the second value that the procedure returns can be ignored by the caller. > +(define (store-directory->package-version store-dir) > + "Extract package version from STORE-DIR." > + (let-values (((_ version) ((compose package-name->name+version > + strip-store-file-name) > + store-dir))) > + version)) Likewise. > +(define* (setup-environment #:key inputs #:allow-other-keys) > + "Export the variable EMACSLOADPATH, which are based on INPUTS respecti= vely." > + (let* ((filtered-inputs (emacs-inputs inputs)) > + (emacs-input-dir (cdr (assoc "emacs" filtered-inputs))) > + (inputs-dirs (cdr filtered-inputs))) Nitpick: Please see the guidelines mentioned in on how to choose identifiers. I=E2=80=99d write: (let* ((inputs (emacs-inputs inputs)) (emacs (assoc-ref inputs "emacs"))) =E2=80=A6) =E2=80=98inputs-dirs=E2=80=99 is unneeded AIUI (see below). > + ;; EMACSLOADPATH is where Emacs looks for the source code of the bui= ld's > + ;; dependencies. > + (setenv "EMACSLOADPATH" > + (string-append emacs-input-dir "/share/emacs/" > + (store-directory->package-version emacs-input= -dir) > + "/lisp")) > + (for-each > + (lambda (input) > + (let ((store-item (cdr input))) Rather: (for-each (match-lambda ((name . input) =E2=80=A6)) =E2=80=A6) > + (setenv "EMACSLOADPATH" > + (string-append > + (or (getenv "EMACSLOADPATH") "") > + ":" store-item %install-suffix "/" > + ((compose string-drop-emacs store-directory->package-n= ame) > + store-item))))) Rather: (string-drop-emacs (store-directory->package-name item)) IMO =E2=80=98compose=E2=80=99 makes things less readable in this case. > + ((compose (lambda (inputs) (alist-delete "emacs" inputs)) > + (lambda (inputs) (alist-delete "source" inputs))) > + (delete-duplicates inputs-dirs))) Rather: (fold alist-delete inputs '("emacs" "source")) Did you try rebuilding Emacs packages, and to simplify those that explicitly pass -L flags? Thanks a lot for working on it! Ludo=E2=80=99.