unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add haskell-mode.
@ 2015-06-12 20:10 Federico Beffa
  2015-06-13 12:48 ` Federico Beffa
  0 siblings, 1 reply; 3+ messages in thread
From: Federico Beffa @ 2015-06-12 20:10 UTC (permalink / raw)
  To: Guix-devel

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

An emacs mode for Haskell.

Regards,
Fede

[-- Attachment #2: 0001-gnu-Add-haskell-mode.patch --]
[-- Type: text/x-diff, Size: 3386 bytes --]

From 15f4a10b6867ad2dab00c18aff72a5c33c0dff5e Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Fri, 12 Jun 2015 18:58:35 +0200
Subject: [PATCH] gnu: Add haskell-mode.

* gnu/packages/emacs.scm (haskell-mode): New variable.
---
 gnu/packages/emacs.scm | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index fbddff1..be9a045 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -430,6 +430,73 @@ operations.")
 support for Git-SVN.")
     (license license:gpl3+)))
 
+(define-public haskell-mode
+  (package
+    (name "haskell-mode")
+    (version "13.14.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/haskell/haskell-mode/archive/v"
+                    version ".tar.gz"))
+             (sha256
+              (base32 "1kxc2yj8vb122dv91r68h7c5ladcryx963fr16plfhg71fv7f9av"))))
+    (inputs `(("emacs" ,emacs-no-x)))
+    (native-inputs
+     `(("texinfo" ,texinfo)))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build emacs-utils)
+                  (guix build utils))
+       #:imported-modules (,@%gnu-build-system-modules
+                           (guix build emacs-utils))
+       #:make-flags (list (string-append "EMACS="
+                                         (assoc-ref %build-inputs "emacs")
+                                         "/bin/emacs"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before
+          'build 'pre-build
+          (lambda _
+            (setenv "SHELL" "sh")
+            (substitute* (find-files "." ".*\\.el") (("/bin/sh") "sh"))
+            #t))
+         (replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (el-dir (string-append out "/share/emacs/site-lisp"))
+                   (doc (string-append
+                         out "/share/doc/haskell-mode-" ,version))
+                   (info (string-append out "/share/info")))
+              (with-directory-excursion "doc"
+                (system* "makeinfo" "haskell-mode.texi")
+                (mkdir-p info)
+                (copy-file "haskell-mode.info"
+                           (string-append info "/haskell-mode.info")))
+              (for-each
+               (lambda (dir files)
+                 (mkdir-p dir)
+                 (for-each
+                  (lambda (f)
+                    (copy-file f (string-append dir "/" (basename f))))
+                  files))
+               (list doc el-dir)
+               (list '("CONTRIBUTING.md" "NEWS" "README.md")
+                     (find-files "." ".*\\.elc?")))
+               ;; these are now distributed with emacs
+               (with-directory-excursion el-dir
+                 (for-each delete-file '("cl-lib.el" "ert.el")))
+              #t))))))
+    (home-page "https://github.com/haskell/haskell-mode")
+    (synopsis "Haskell mode for Emacs")
+    (description
+     "This is an Emacs mode for editing, debugging and developing Haskell
+programs.")
+    (license license:gpl3+)))
+
 \f
 ;;;
 ;;; Web browsing.
-- 
2.2.1


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

* Re: [PATCH] gnu: Add haskell-mode.
  2015-06-12 20:10 [PATCH] gnu: Add haskell-mode Federico Beffa
@ 2015-06-13 12:48 ` Federico Beffa
  2015-06-14 16:57   ` Mark H Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Federico Beffa @ 2015-06-13 12:48 UTC (permalink / raw)
  To: Guix-devel

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

I started with the 'trivial-build-system' and the switched to the GNU
one and forgot to delete the module imports...
Updated.

Regards,
Fede

On Fri, Jun 12, 2015 at 10:10 PM, Federico Beffa <beffa@ieee.org> wrote:
> An emacs mode for Haskell.
>
> Regards,
> Fede

[-- Attachment #2: 0001-gnu-Add-haskell-mode.patch --]
[-- Type: text/x-diff, Size: 3144 bytes --]

From d08df1568688701e20582c74acc85b3d9b5da01a Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Fri, 12 Jun 2015 18:58:35 +0200
Subject: [PATCH] gnu: Add haskell-mode.

* gnu/packages/emacs.scm (haskell-mode): New variable.
---
 gnu/packages/emacs.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index fbddff1..2312711 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -430,6 +430,68 @@ operations.")
 support for Git-SVN.")
     (license license:gpl3+)))
 
+(define-public haskell-mode
+  (package
+    (name "haskell-mode")
+    (version "13.14.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/haskell/haskell-mode/archive/v"
+                    version ".tar.gz"))
+             (sha256
+              (base32 "1kxc2yj8vb122dv91r68h7c5ladcryx963fr16plfhg71fv7f9av"))))
+    (inputs `(("emacs" ,emacs-no-x)))
+    (native-inputs
+     `(("texinfo" ,texinfo)))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list (string-append "EMACS="
+                                         (assoc-ref %build-inputs "emacs")
+                                         "/bin/emacs"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before
+          'build 'pre-build
+          (lambda _
+            (setenv "SHELL" "sh")
+            (substitute* (find-files "." ".*\\.el") (("/bin/sh") "sh"))
+            #t))
+         (replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (el-dir (string-append out "/share/emacs/site-lisp"))
+                   (doc (string-append
+                         out "/share/doc/haskell-mode-" ,version))
+                   (info (string-append out "/share/info")))
+              (with-directory-excursion "doc"
+                (system* "makeinfo" "haskell-mode.texi")
+                (mkdir-p info)
+                (copy-file "haskell-mode.info"
+                           (string-append info "/haskell-mode.info")))
+              (for-each
+               (lambda (dir files)
+                 (mkdir-p dir)
+                 (for-each
+                  (lambda (f)
+                    (copy-file f (string-append dir "/" (basename f))))
+                  files))
+               (list doc el-dir)
+               (list '("CONTRIBUTING.md" "NEWS" "README.md")
+                     (find-files "." ".*\\.elc?")))
+               ;; these are now distributed with emacs
+               (with-directory-excursion el-dir
+                 (for-each delete-file '("cl-lib.el" "ert.el")))
+              #t))))))
+    (home-page "https://github.com/haskell/haskell-mode")
+    (synopsis "Haskell mode for Emacs")
+    (description
+     "This is an Emacs mode for editing, debugging and developing Haskell
+programs.")
+    (license license:gpl3+)))
+
 \f
 ;;;
 ;;; Web browsing.
-- 
2.2.1


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

* Re: [PATCH] gnu: Add haskell-mode.
  2015-06-13 12:48 ` Federico Beffa
@ 2015-06-14 16:57   ` Mark H Weaver
  0 siblings, 0 replies; 3+ messages in thread
From: Mark H Weaver @ 2015-06-14 16:57 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> writes:

> From d08df1568688701e20582c74acc85b3d9b5da01a Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> Date: Fri, 12 Jun 2015 18:58:35 +0200
> Subject: [PATCH] gnu: Add haskell-mode.
>
> * gnu/packages/emacs.scm (haskell-mode): New variable.
> ---
>  gnu/packages/emacs.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
>
> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index fbddff1..2312711 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -430,6 +430,68 @@ operations.")
>  support for Git-SVN.")
>      (license license:gpl3+)))
>  
> +(define-public haskell-mode
> +  (package
> +    (name "haskell-mode")
> +    (version "13.14.2")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "https://github.com/haskell/haskell-mode/archive/v"
> +                    version ".tar.gz"))

Please add a 'file-name' field to this origin, so that the source code
in the store will be called /gnu/store/…-haskell-mode-13.14.2.tar.gz
instead of /gnu/store/…-v13.14.2.tar.gz:

  (file-name (string-append name "-" version ".tar.gz"))

> +             (sha256
> +              (base32 "1kxc2yj8vb122dv91r68h7c5ladcryx963fr16plfhg71fv7f9av"))))
> +    (inputs `(("emacs" ,emacs-no-x)))
> +    (native-inputs
> +     `(("texinfo" ,texinfo)))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:make-flags (list (string-append "EMACS="
> +                                         (assoc-ref %build-inputs "emacs")
> +                                         "/bin/emacs"))
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (add-before
> +          'build 'pre-build
> +          (lambda _
> +            (setenv "SHELL" "sh")
> +            (substitute* (find-files "." ".*\\.el") (("/bin/sh") "sh"))

Please use "\\.el$" instead of ".*\\.el", and
(string-append (assoc-ref inputs "bash") "/bin/sh") instead of "sh" in
the substitution.  Plain "sh" is fine for SHELL.

> +            #t))
> +         (replace
> +          'install
> +          (lambda* (#:key outputs #:allow-other-keys)
> +            (let* ((out (assoc-ref outputs "out"))
> +                   (el-dir (string-append out "/share/emacs/site-lisp"))
> +                   (doc (string-append
> +                         out "/share/doc/haskell-mode-" ,version))
> +                   (info (string-append out "/share/info")))
> +              (with-directory-excursion "doc"
> +                (system* "makeinfo" "haskell-mode.texi")

Please check the result of 'system*':

 (unless (zero? (system* "makeinfo" "haskell-mode.texi"))
   (error "makeinfo failed"))

> +                (mkdir-p info)
> +                (copy-file "haskell-mode.info"
> +                           (string-append info "/haskell-mode.info")))
> +              (for-each
> +               (lambda (dir files)
> +                 (mkdir-p dir)
> +                 (for-each
> +                  (lambda (f)
> +                    (copy-file f (string-append dir "/" (basename f))))
> +                  files))
> +               (list doc el-dir)
> +               (list '("CONTRIBUTING.md" "NEWS" "README.md")
> +                     (find-files "." ".*\\.elc?")))

Please replace ".*\\.elc?" with "\\.elc?$".

Still, this outer 'for-each' is a bit hard to read.  How about something
like this instead?  (with the 'define' as the first thing in the 'let*')

  (define (copy-to-dir dir files)
    (mkdir-p dir)
    (for-each (lambda (f)
                (copy-file f (string-append dir "/" (basename f))))
              files))

[...]

  (copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md"))
  (copy-to-dir el-dir (find-files "." "\\.elc?$"))

> +               ;; these are now distributed with emacs
> +               (with-directory-excursion el-dir
> +                 (for-each delete-file '("cl-lib.el" "ert.el")))

These three lines are indented one more column than they should be,
making them appear to be within the 'for-each'.

> +              #t))))))
> +    (home-page "https://github.com/haskell/haskell-mode")
> +    (synopsis "Haskell mode for Emacs")
> +    (description
> +     "This is an Emacs mode for editing, debugging and developing Haskell
> +programs.")
> +    (license license:gpl3+)))
> +

Okay to push with these changes.

    Thanks!
      Mark

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

end of thread, other threads:[~2015-06-14 16:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-12 20:10 [PATCH] gnu: Add haskell-mode Federico Beffa
2015-06-13 12:48 ` Federico Beffa
2015-06-14 16:57   ` Mark H Weaver

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).