all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: asymptote: Install Emacs data
@ 2016-05-06 23:48 Nicolas Goaziou
  2016-05-07  8:15 ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-05-06 23:48 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

Hello,

The following patch installs Emacs libraries provided by Asymptote in
a location where they can be found.

Thank you for considering it for inclusion.


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: install Emacs data with asymptote --]
[-- Type: text/x-diff, Size: 2364 bytes --]

From 5ebefd0edc14c4b0dc0db6dec200cc117c625848 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
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))
+       #: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$")))))))
     (home-page "http://asymptote.sourceforge.net")
     (synopsis "Script-based vector graphics language")
     (description
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: asymptote: Install Emacs data
  2016-05-06 23:48 [PATCH] gnu: asymptote: Install Emacs data Nicolas Goaziou
@ 2016-05-07  8:15 ` Alex Kost
  2016-05-07 12:50   ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Kost @ 2016-05-07  8:15 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: guix-devel

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 "<asymptote>/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 <mail@nicolasgoaziou.fr>
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: asymptote: Install Emacs data
  2016-05-07  8:15 ` Alex Kost
@ 2016-05-07 12:50   ` Nicolas Goaziou
  2016-05-08  8:58     ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-05-07 12:50 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 820 bytes --]

Hello,

Alex Kost <alezost@gmail.com> writes:

> 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 "<asymptote>/base/asy-mode.el", so it would also
> be good to generate "asymptote-autoloads.el" file.

Indeed.

> 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.

Fair enough.

Here is an updated patch with suggested changes. Thank you for the review.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: asymptote: install Emacs data (take 2) --]
[-- Type: text/x-diff, Size: 3280 bytes --]

From bc0ade21f50a9c6b2f063e8043abe72a61fa9328 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
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 | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/plotutils.scm b/gnu/packages/plotutils.scm
index 3fdd539..fc0436b 100644
--- a/gnu/packages/plotutils.scm
+++ b/gnu/packages/plotutils.scm
@@ -25,6 +25,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages bdw-gc)
+  #:use-module (gnu packages emacs)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages image)
   #:use-module (gnu packages ghostscript)
@@ -190,7 +191,8 @@ colors, styles, options and details.")
        ("texlive" ,texlive)             ;For tests and documentation
        ("perl" ,perl)))
     (inputs
-     `(("fftw" ,fftw)
+     `(("emacs" ,emacs-no-x)
+       ("fftw" ,fftw)
        ("freeglut" ,freeglut)
        ("gsl" ,gsl)
        ("libgc" ,libgc)
@@ -198,7 +200,13 @@ colors, styles, options and details.")
        ("readline" ,readline)
        ("zlib" ,zlib)))
     (arguments
-     `(#:configure-flags
+     `(#:modules ((guix build emacs-utils)
+                  (guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-26))
+       #: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,15 +218,26 @@ 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\""))))
+                "defaultPDFViewer=\"gv\""))
+             #t))
          (add-before 'check 'set-HOME
            ;; 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")
+             #t))
+         (add-after 'install 'install-Emacs-data
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Install related Emacs libraries into 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)))))
     (home-page "http://asymptote.sourceforge.net")
     (synopsis "Script-based vector graphics language")
     (description
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: asymptote: Install Emacs data
  2016-05-07 12:50   ` Nicolas Goaziou
@ 2016-05-08  8:58     ` Alex Kost
  2016-05-08  9:10       ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Kost @ 2016-05-08  8:58 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: guix-devel

Nicolas Goaziou (2016-05-07 15:50 +0300) wrote:

> Hello,
>
> Alex Kost <alezost@gmail.com> writes:
>
>> 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 "<asymptote>/base/asy-mode.el", so it would also
>> be good to generate "asymptote-autoloads.el" file.
>
> Indeed.
>
>> 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.
>
> Fair enough.
>
> Here is an updated patch with suggested changes. Thank you for the review.

Thanks!  Looks good to me, so if there will be no other comments in
several days, I will commit it.  Did you check that the resulting
"/share/emacs/site-lisp" directory contains elisp files (including
"asymptote-autoloads.el")?

-- 
Alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: asymptote: Install Emacs data
  2016-05-08  8:58     ` Alex Kost
@ 2016-05-08  9:10       ` Nicolas Goaziou
  2016-05-12 10:02         ` Alex Kost
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-05-08  9:10 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Hello,

Alex Kost <alezost@gmail.com> writes:

> Thanks!  Looks good to me, so if there will be no other comments in
> several days, I will commit it.  Did you check that the resulting
> "/share/emacs/site-lisp" directory contains elisp files (including
> "asymptote-autoloads.el")?

Yes, I did. All is fine, AFAICT.


Regards,

-- 
Nicolas Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: asymptote: Install Emacs data
  2016-05-08  9:10       ` Nicolas Goaziou
@ 2016-05-12 10:02         ` Alex Kost
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Kost @ 2016-05-12 10:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: guix-devel

Nicolas Goaziou (2016-05-08 12:10 +0300) wrote:

> Alex Kost <alezost@gmail.com> writes:
>
>> Thanks!  Looks good to me, so if there will be no other comments in
>> several days, I will commit it.  Did you check that the resulting
>> "/share/emacs/site-lisp" directory contains elisp files (including
>> "asymptote-autoloads.el")?
>
> Yes, I did. All is fine, AFAICT.

I was going to commit it, but I can't do it right now (apparently there
are problems with git.sv.gnu.org).  I will do as soon as possible.
Thanks!

-- 
Alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-12 10:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 23:48 [PATCH] gnu: asymptote: Install Emacs data Nicolas Goaziou
2016-05-07  8:15 ` Alex Kost
2016-05-07 12:50   ` Nicolas Goaziou
2016-05-08  8:58     ` Alex Kost
2016-05-08  9:10       ` Nicolas Goaziou
2016-05-12 10:02         ` Alex Kost

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.