From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH] gnu: asymptote: Install Emacs data Date: Sat, 07 May 2016 11:15:18 +0300 Message-ID: <87posy7089.fsf@gmail.com> References: <87inyqbvf2.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayxOV-0004eE-LL for guix-devel@gnu.org; Sat, 07 May 2016 04:15:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayxOR-0005Xz-Bi for guix-devel@gnu.org; Sat, 07 May 2016 04:15:22 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:35995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayxOQ-0005Xt-Ts for guix-devel@gnu.org; Sat, 07 May 2016 04:15:19 -0400 Received: by mail-lf0-x242.google.com with SMTP id y84so15609380lfc.3 for ; Sat, 07 May 2016 01:15:18 -0700 (PDT) In-Reply-To: <87inyqbvf2.fsf@saiph.selenimh> (Nicolas Goaziou's message of "Sat, 07 May 2016 01:48:01 +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" To: Nicolas Goaziou Cc: guix-devel@gnu.org Nicolas Goaziou (2016-05-07 02:48 +0300) wrote: > Hello, > > The following patch installs Emacs libraries provided by Asymptote in > a location where they can be found. Thanks! Sorry I didn't build asymptote (as I don't have a wish to build gigabytes of texlive), but I looked at the source and I see there are "autoloads" cookies in "/base/asy-mode.el", so it would also be good to generate "asymptote-autoloads.el" file. This file will be automatically loaded by emacs, and a user will not have to do any additional settings in ".emacs", as ".asy" files will be opened in "asy-mode" automatically. For example, you may look at (gnu packages emacs) module to see how "autoloads" file are generated using 'emacs-generate-autoloads' procedure. I write some notes below, that seems appropriate to me, but I'm not going to test the patch because of texlive (sorry again). I hope other people will do. > From 5ebefd0edc14c4b0dc0db6dec200cc117c625848 Mon Sep 17 00:00:00 2001 > From: Nicolas Goaziou > Date: Wed, 4 May 2016 00:43:36 +0200 > Subject: [PATCH] gnu: asymptote: Install Emacs data > > * gnu/packages/plotutils.scm (asymptote)[arguments]: Add a phase to > install Emacs-Lisp files in an appropriate place. > --- > gnu/packages/plotutils.scm | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/gnu/packages/plotutils.scm b/gnu/packages/plotutils.scm > index 3fdd539..027fdc1 100644 > --- a/gnu/packages/plotutils.scm > +++ b/gnu/packages/plotutils.scm > @@ -198,7 +198,10 @@ colors, styles, options and details.") > ("readline" ,readline) > ("zlib" ,zlib))) > (arguments > - `(#:configure-flags > + `(#:modules ((guix build gnu-build-system) > + (guix build utils) > + (srfi srfi-26)) You will need to add (guix build emacs-utils) module here, and: #:imported-modules (,@%gnu-build-system-modules (guix build emacs-utils)) > + #:configure-flags > (list (string-append "--enable-gc=" (assoc-ref %build-inputs "libgc")) > (string-append "--with-latex=" > (assoc-ref %outputs "out") > @@ -210,7 +213,7 @@ colors, styles, options and details.") > (modify-phases %standard-phases > (add-before 'build 'patch-pdf-viewer > (lambda _ > - ;; Default to a free pdf viewer > + ;; Default to a free pdf viewer. > (substitute* "settings.cc" > (("defaultPDFViewer=\"acroread\"") > "defaultPDFViewer=\"gv\"")))) > @@ -218,7 +221,14 @@ colors, styles, options and details.") > ;; Some tests require write access to $HOME, otherwise leading to > ;; "failed to create directory /homeless-shelter/.asy" error. > (lambda _ > - (setenv "HOME" "/tmp")))))) > + (setenv "HOME" "/tmp"))) > + (add-after 'install 'install-emacs-data > + (lambda* (#:key outputs #:allow-other-keys) > + ;; Install related Emacs libraries in an appropriate location. > + (for-each (cute install-file <> > + (string-append (assoc-ref outputs "out") > + "/share/emacs/site-lisp")) > + (find-files "." "\\.el$"))))))) Overall this phase would look like this (not tested): (add-after 'install 'install-emacs-data (lambda* (#:key outputs #:allow-other-keys) ;; Install related Emacs libraries in an appropriate location. (let* ((out (assoc-ref outputs "out")) (lisp-dir (string-append out "/share/emacs/site-lisp"))) (for-each (cut install-file <> lisp-dir) (find-files "." "\\.el$")) (emacs-generate-autoloads ,name lisp-dir)) #t)) Note that I added #t to the end of the phase because if a phase succeeds it should return "not false" value. I think it's ok to add #t to the other phases in this patch. > (home-page "http://asymptote.sourceforge.net") > (synopsis "Script-based vector graphics language") > (description -- Alex