diff mbox

gnu: Add sicp.

Message ID 87lh358zye.fsf@drakenvlieg.flower
State New
Headers show

Commit Message

Jan Nieuwenhuizen May 19, 2016, 10:06 p.m. UTC
Ludovic Courtès writes:

Hi Ludovic

> What about putting it in (gnu packages scheme) instead?  Sounds like a
> natural home.

Sure.

>> +    (version "2016-02-20")

> Could you change the ‘version’ field according to the conventions
> described at (info "(guix) Version Numbers")?  Since there’s no release
> number, it’s OK to use “20160220” (no hyphens) before the rest of the
> version field.

OK.

>> +    (arguments
>> +     `(#:modules ((guix build utils)
>> +                  (srfi srfi-1)
>> +                  (srfi srfi-26))
>> +                 #:builder
>
> #:builder should be aligned with #:modules.

Sure, missed this.  Edited by hand for now.
  
I've been fighting with this (i.e.: manually changing Emacs'
indentation, something that feels just so wrong), and wondering
about it.  Isn't .dir-locals.el supposed to handle this
automagically...what am I missing?

I'm used to run indent-region on the whole file, but that often changes
things in most files I ran it in.

Also, for Guix I had to remove delete-trailing-whitespace from my
before-save-variables, otherwise my patches try to delete lots of
whitespace...

>> +                 (let ((gzip (assoc-ref %build-inputs "gzip"))
>> +                       (source (assoc-ref %build-inputs "source"))
>> +                       (texinfo (assoc-ref %build-inputs "texinfo"))
>> +                       (info-dir (string-append %output "/share/info")))
>> +                   (use-modules (guix build utils)
>> +                                (srfi srfi-1)
>> +                                (srfi srfi-26))
>
> Please move ‘use-modules’ to the top:
>
>   (begin
>     (use-modules (srfi …) …)
>
>     (let (…) …))

OK.

>> +                   (and
>> +                    (system* "makeinfo"
>> +                             "--output" (string-append info-dir "/sicp.info")
>> +                             (string-append source "/sicp-pocket.texi"))
>
> (zero? (system* …))

Yes, better.

>> +It was first published in 1985 by MIT Press and written by Massachusetts
>> +Institute of Technology (MIT) professors Harold Abelson and Gerald Jay
>> +Sussman, with Julie Sussman.")
>
> I would remove the last paragraph.

Done.

> Thanks for filling this gap!  :-)

:-)

Greetings,
Jan

Comments

Taylan Ulrich Bayırlı =?utf-8?Q?=2FKammer?= May 20, 2016, 8:19 a.m. UTC | #1
Jan Nieuwenhuizen <janneke@gnu.org> writes:

>>> +    (arguments
>>> +     `(#:modules ((guix build utils)
>>> +                  (srfi srfi-1)
>>> +                  (srfi srfi-26))
>>> +                 #:builder
>>
>> #:builder should be aligned with #:modules.
>
> Sure, missed this.  Edited by hand for now.
>   
> I've been fighting with this (i.e.: manually changing Emacs'
> indentation, something that feels just so wrong), and wondering
> about it.  Isn't .dir-locals.el supposed to handle this
> automagically...what am I missing?
>
> I'm used to run indent-region on the whole file, but that often changes
> things in most files I ran it in.

This modified `scheme-indent-function' by Mark Weaver fixes that:
Taylan
Jan Nieuwenhuizen May 20, 2016, 11:26 a.m. UTC | #2
Taylan Ulrich "Bayırlı/Kammer" writes:

> This modified `scheme-indent-function' by Mark Weaver fixes that:

Wow, that helps :-) Thank you!

I can't seem to find it in Guix git; should I look better or should we
link to it somehow?

Jan
Alex Kost May 21, 2016, 10:58 a.m. UTC | #3
Jan Nieuwenhuizen (2016-05-20 14:26 +0300) wrote:

> Taylan Ulrich "Bayırlı/Kammer" writes:
>
>> This modified `scheme-indent-function' by Mark Weaver fixes that:
>
> Wow, that helps :-) Thank you!
>
> I can't seem to find it in Guix git; should I look better or should we
> link to it somehow?

The source is here:
<http://www.netris.org/~mhw/scheme-indent-function.el>.

This is a usual problem (I would say an Emacs bug) that people face
with, and those who know about it, use the mentioned modified version
'scheme-indent-function'.

So what about patching our emacs package to fix scheme-indent-function?
I can make a patch if it's reasonable.
Ludovic Courtès May 21, 2016, 9:03 p.m. UTC | #4
Alex Kost <alezost@gmail.com> skribis:

> Jan Nieuwenhuizen (2016-05-20 14:26 +0300) wrote:
>
>> Taylan Ulrich "Bayırlı/Kammer" writes:
>>
>>> This modified `scheme-indent-function' by Mark Weaver fixes that:
>>
>> Wow, that helps :-) Thank you!
>>
>> I can't seem to find it in Guix git; should I look better or should we
>> link to it somehow?
>
> The source is here:
> <http://www.netris.org/~mhw/scheme-indent-function.el>.
>
> This is a usual problem (I would say an Emacs bug) that people face
> with, and those who know about it, use the mentioned modified version
> 'scheme-indent-function'.
>
> So what about patching our emacs package to fix scheme-indent-function?
> I can make a patch if it's reasonable.

I think we should submit it to bug-emacs@gnu.org first.  Thoughts?

Ludo’.
Ludovic Courtès May 21, 2016, 9:22 p.m. UTC | #5
Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> From 44bcbdb30f6789d4bc460aa84dca27321c074cba Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <janneke@gnu.org>
> Date: Thu, 19 May 2016 23:50:09 +0200
> Subject: [PATCH] gnu: Add sicp.
>
> * gnu/packages/scheme.scm (sicp): New variable.

Applied with minor changes:

> +    (version "20160220-1.5b52db56")

Avoided the duplicated commit ID here following the manual (info "(guix)
Version Numbers").

> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/sarabander/sicp")
> +             (commit "5b52db566968d28a89fbbaf338d207f01cc81cac")))
> +       (sha256
> +        (base32
> +         "10h6h7szwlfbshwh18bnl2hvyddj5i7106l79s145l0sjjv15cxb"))))

Added a ‘file-name’ field, as noted by ‘guix lint’.

> +           (every zero? (map
> +                         (cut system* "gzip" <>)

Pass ‘-9n’, where ‘-n’ allows the thing to be bit-reproducible (see
--rounds=2).

Thanks!

Ludo’.
Alex Kost May 24, 2016, 8:58 a.m. UTC | #6
Ludovic Courtès (2016-05-22 00:03 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Jan Nieuwenhuizen (2016-05-20 14:26 +0300) wrote:
>>
>>> Taylan Ulrich "Bayırlı/Kammer" writes:
>>>
>>>> This modified `scheme-indent-function' by Mark Weaver fixes that:
>>>
>>> Wow, that helps :-) Thank you!
>>>
>>> I can't seem to find it in Guix git; should I look better or should we
>>> link to it somehow?
>>
>> The source is here:
>> <http://www.netris.org/~mhw/scheme-indent-function.el>.
>>
>> This is a usual problem (I would say an Emacs bug) that people face
>> with, and those who know about it, use the mentioned modified version
>> 'scheme-indent-function'.
>>
>> So what about patching our emacs package to fix scheme-indent-function?
>> I can make a patch if it's reasonable.
>
> I think we should submit it to bug-emacs@gnu.org first.  Thoughts?

I also think so.  IIUC it's Mark and you who found this bug and came up
with this fix, so I hope one of you will submit it :-)

But as it may take a long time until this fix will go to emacs, I think
it would be good to patch our emacs package now.
Ludovic Courtès May 25, 2016, 9:49 p.m. UTC | #7
Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2016-05-22 00:03 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:

[...]

>>> The source is here:
>>> <http://www.netris.org/~mhw/scheme-indent-function.el>.
>>>
>>> This is a usual problem (I would say an Emacs bug) that people face
>>> with, and those who know about it, use the mentioned modified version
>>> 'scheme-indent-function'.
>>>
>>> So what about patching our emacs package to fix scheme-indent-function?
>>> I can make a patch if it's reasonable.
>>
>> I think we should submit it to bug-emacs@gnu.org first.  Thoughts?
>
> I also think so.  IIUC it's Mark and you who found this bug and came up
> with this fix, so I hope one of you will submit it :-)

Aha, well done!  Mark?  :-)

> But as it may take a long time until this fix will go to emacs, I think
> it would be good to patch our emacs package now.

Okay, let’s make an exception for this one.  Would you like to take care
of it?

Thanks,
Ludo’.
diff mbox

Patch

From 44bcbdb30f6789d4bc460aa84dca27321c074cba Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 19 May 2016 23:50:09 +0200
Subject: [PATCH] gnu: Add sicp.

* gnu/packages/scheme.scm (sicp): New variable.
---
 gnu/packages/scheme.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 6cf75c2..3539659 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -4,6 +4,7 @@ 
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,8 +26,10 @@ 
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages databases)
@@ -34,6 +37,7 @@ 
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages texlive)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages avahi)
   #:use-module (gnu packages libphidget)
@@ -714,3 +718,54 @@  procedures, embedded in the programming language Scheme, and intended to
 support teaching and research in mathematical physics and electrical
 engineering.")
       (license gpl2+))))
+
+(define-public sicp
+  (package
+    (name "sicp")
+    (version "20160220-1.5b52db56")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/sarabander/sicp")
+             (commit "5b52db566968d28a89fbbaf338d207f01cc81cac")))
+       (sha256
+        (base32
+         "10h6h7szwlfbshwh18bnl2hvyddj5i7106l79s145l0sjjv15cxb"))))
+    (build-system trivial-build-system)
+    (native-inputs `(("gzip" ,gzip)
+                     ("source" ,source)
+                     ("texinfo" ,texinfo)))
+    (arguments
+     `(#:modules ((guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (srfi srfi-1)
+                      (srfi srfi-26))
+         (let ((gzip (assoc-ref %build-inputs "gzip"))
+               (source (assoc-ref %build-inputs "source"))
+               (texinfo (assoc-ref %build-inputs "texinfo"))
+               (info-dir (string-append %output "/share/info")))
+          (setenv "PATH" (string-append gzip "/bin"
+                                        ":" texinfo "/bin"))
+          (mkdir-p info-dir)
+          (and
+           (zero?
+            (system* "makeinfo"
+                     "--output" (string-append info-dir "/sicp.info")
+                     (string-append source "/sicp-pocket.texi")))
+           (every zero? (map
+                         (cut system* "gzip" <>)
+                         (find-files info-dir))))))))
+    (home-page "http://sarabander.github.io/sicp")
+    (synopsis "Structure and Interpretation of Computer Programs")
+    (description "Structure and Interpretation of Computer Programs (SICP) is
+a textbook aiming to teach the principles of computer programming.
+
+Using Scheme, a dialect of the Lisp programming language, the book explains
+core computer science concepts such as abstraction in programming,
+metalinguistic abstraction, recursion, interpreters, and modular programming.")
+    (license cc-by-sa4.0)))
-- 
2.7.3