unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31726: haskell-mode fails to build with (at least) Emacs 26.1
@ 2018-06-05 16:27 Jack Hill
       [not found] ` <handler.31726.B.1528217025308.ack@debbugs.gnu.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jack Hill @ 2018-06-05 16:27 UTC (permalink / raw)
  To: 31726

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

I'm running guix (GNU Guix) 19b662ea7c53a28270a783f10ca033d8c9d2a954, and 
have /gnu/store/s32nba6rxx9x2kibsn6wsm1ixzhv64nl-emacs-26.1 installed. 
When I then try to install haskell-mode with

   guix package -i haskell-mode

the derivation build fails with

   haskell-process.el:160:1:Error: Unused lexical variable ‘move-point-in-windows’

This is the same error as a failed build on Hydra[0].

I have opened an upstream bug report[1], but have not yet done more 
troubleshooting.

Best,
Jack

[0] https://hydra.gnu.org/build/2766429/nixlog/1
[1] https://github.com/haskell/haskell-mode/issues/1601

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

* bug#31726: Acknowledgement (haskell-mode fails to build with (at least) Emacs 26.1)
       [not found] ` <handler.31726.B.1528217025308.ack@debbugs.gnu.org>
@ 2018-06-05 21:02   ` Jack Hill
  2018-06-07 16:14     ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Jack Hill @ 2018-06-05 21:02 UTC (permalink / raw)
  To: 31726

It looks like this may be fixed in upstream commit 
cee22450ee30e79952f594796721dc6b17798ee6 [0], which has not ended up in a 
release. I have not verified yet, but it looks like commit would address 
the problem.


[0] https://github.com/haskell/haskell-mode/commit/cee22450ee30e79952f594796721dc6b17798ee6

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

* bug#31726: Acknowledgement (haskell-mode fails to build with (at least) Emacs 26.1)
  2018-06-05 21:02   ` bug#31726: Acknowledgement (haskell-mode fails to build with (at least) Emacs 26.1) Jack Hill
@ 2018-06-07 16:14     ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2018-06-07 16:14 UTC (permalink / raw)
  To: Jack Hill; +Cc: 31726

Hello,

Jack Hill <jackhill@jackhill.us> skribis:

> It looks like this may be fixed in upstream commit
> cee22450ee30e79952f594796721dc6b17798ee6 [0], which has not ended up
> in a release. I have not verified yet, but it looks like commit would
> address the problem.
>
>
> [0] https://github.com/haskell/haskell-mode/commit/cee22450ee30e79952f594796721dc6b17798ee6

Could you propose a patch to apply this commit to our haskell-mode
package?

Thanks for digging into this!

Ludo’.

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

* bug#31726: confirming proposed change
  2018-06-05 16:27 bug#31726: haskell-mode fails to build with (at least) Emacs 26.1 Jack Hill
       [not found] ` <handler.31726.B.1528217025308.ack@debbugs.gnu.org>
@ 2018-06-07 21:43 ` Jack Hill
  2018-06-08 14:30   ` Ludovic Courtès
  2018-07-20 19:58 ` bug#31726: Attempt to use git reference for haskell-mode Jack Hill
  2 siblings, 1 reply; 9+ messages in thread
From: Jack Hill @ 2018-06-07 21:43 UTC (permalink / raw)
  To: 31726

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

Ludo’,

Sure, I'll give make a path a go. You're thinking that I should try 
applying the changes that the commit introduced as part of our package 
definition?

Best,
Jack

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

* bug#31726: confirming proposed change
  2018-06-07 21:43 ` bug#31726: confirming proposed change Jack Hill
@ 2018-06-08 14:30   ` Ludovic Courtès
  2018-06-08 19:46     ` Jack Hill
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2018-06-08 14:30 UTC (permalink / raw)
  To: Jack Hill; +Cc: 31726

Hi,

Jack Hill <jackhill@jackhill.us> skribis:

> Sure, I'll give make a path a go. You're thinking that I should try
> applying the changes that the commit introduced as part of our package
> definition?

Yes, either that or use a snapshot of upstream haskell-mode.

Thanks,
Ludo’.

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

* bug#31726: confirming proposed change
  2018-06-08 14:30   ` Ludovic Courtès
@ 2018-06-08 19:46     ` Jack Hill
  2018-06-09 20:34       ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Jack Hill @ 2018-06-08 19:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31726

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

On Fri, 8 Jun 2018, Ludovic Courtès wrote:

> Hi,
>
> Jack Hill <jackhill@jackhill.us> skribis:
>
>> Sure, I'll give make a path a go. You're thinking that I should try
>> applying the changes that the commit introduced as part of our package
>> definition?
>
> Yes, either that or use a snapshot of upstream haskell-mode.

I have started workign on a patch implementing the former. I've included 
what I have so far below, but it's not ready to be included in the 
distribution because not all of the tests pass. Maybe this is because the 
one patch shouldn't be applied in issolation and it would be bettter to 
take the snapshot approach?

Otherwise, is what I did with the package revision reasonable?

Thanks,
Jack

From 62ae1a14c48f3d70e6f47ffd6de60a0b9af9d43f Mon Sep 17 00:00:00 2001
From: Jack Hill <jackhill@jackhill.us>
Date: Thu, 7 Jun 2018 22:54:12 -0400
Subject: [PATCH] Patch haskell-mode to remove unused lexical variables

---
  gnu/packages/emacs.scm                             | 174 +++++++++++----------
  ...ell-mode-removed-unused-lexical-variables.patch |  42 +++++
  2 files changed, 131 insertions(+), 85 deletions(-)
  create mode 100644 gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index e90660a23..5e93cd2b8 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -631,92 +631,96 @@ only a handful of functions that are not resource-specific.")
      (license license:gpl3+)))

  (define-public haskell-mode
-  (package
-    (name "haskell-mode")
-    (version "16.1")
-    (source (origin
-              (method url-fetch)
-              (file-name (string-append name "-" version ".tar.gz"))
-              (uri (string-append
-                    "https://github.com/haskell/haskell-mode/archive/v"
-                    version ".tar.gz"))
-              (sha256
-               (base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h"))))
-    (inputs
-     `(("emacs-el-search" ,emacs-el-search) ; for tests
-       ("emacs-stream" ,emacs-stream)))     ; for tests
-    (propagated-inputs
-     `(("emacs-dash" ,emacs-dash)))
-    (native-inputs
-     `(("emacs" ,emacs-minimal)
-       ("texinfo" ,texinfo)))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:make-flags (list (string-append "EMACS="
-                                         (assoc-ref %build-inputs "emacs")
-                                         "/bin/emacs"))
-       #:modules ((ice-9 match)
-                  (srfi srfi-26)
-                  ,@%gnu-build-system-modules)
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (add-before
-          'build 'pre-build
-          (lambda* (#:key inputs #:allow-other-keys)
-            (define (el-dir store-dir)
-              (match (find-files store-dir "\\.el$")
-                ((f1 f2 ...) (dirname f1))
-                (_ "")))
-
-            (let ((sh (string-append (assoc-ref inputs "bash") "/bin/sh")))
-              (define emacs-prefix? (cut string-prefix? "emacs-" <>))
-
-              (setenv "SHELL" "sh")
-              (setenv "EMACSLOADPATH"
-                      (string-concatenate
-                       (map (match-lambda
-                              (((? emacs-prefix? name) . dir)
-                               (string-append (el-dir dir) ":"))
-                              (_ ""))
-                            inputs)))
-              (substitute* (find-files "." "\\.el") (("/bin/sh") sh))
-              (substitute* "tests/haskell-code-conventions.el"
-                ;; Function name recently changed in "emacs-el-search".
-                (("el-search--search-pattern") "el-search-forward")
-                ;; Don't contact home.
-                (("\\(when \\(>= emacs-major-version 25\\)")
-                 "(require 'el-search) (when nil"))
-              #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")))
-              (define (copy-to-dir dir files)
-                (for-each (lambda (f)
-                            (install-file f dir))
-                          files))
-
-              (with-directory-excursion "doc"
-                (unless (zero? (system* "makeinfo" "haskell-mode.texi"))
-                  (error "makeinfo failed"))
-                (install-file "haskell-mode.info" info))
-               (copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md"))
-               (copy-to-dir el-dir (find-files "." "\\.elc?"))
-               ;; These are part of other packages.
-               (with-directory-excursion el-dir
-                 (for-each delete-file '("dash.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
+  (let ((release "16.1")
+        (revision "1"))
+    (package
+      (name "haskell-mode")
+      (version (string-append release "-" revision))
+      (source (origin
+                (method url-fetch)
+                (file-name (string-append name "-" release ".tar.gz"))
+                (uri (string-append
+                      "https://github.com/haskell/haskell-mode/archive/v"
+                      release ".tar.gz"))
+                (sha256
+                 (base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h"))
+                (patches
+                 (search-patches "haskell-mode-removed-unused-lexical-variables.patch"))))
+      (inputs
+       `(("emacs-el-search" ,emacs-el-search) ; for tests
+         ("emacs-stream" ,emacs-stream)))     ; for tests
+      (propagated-inputs
+       `(("emacs-dash" ,emacs-dash)))
+      (native-inputs
+       `(("emacs" ,emacs-minimal)
+         ("texinfo" ,texinfo)))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:make-flags (list (string-append "EMACS="
+                                           (assoc-ref %build-inputs "emacs")
+                                           "/bin/emacs"))
+         #:modules ((ice-9 match)
+                    (srfi srfi-26)
+                    ,@%gnu-build-system-modules)
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (add-before
+               'build 'pre-build
+             (lambda* (#:key inputs #:allow-other-keys)
+               (define (el-dir store-dir)
+                 (match (find-files store-dir "\\.el$")
+                   ((f1 f2 ...) (dirname f1))
+                   (_ "")))
+
+               (let ((sh (string-append (assoc-ref inputs "bash") "/bin/sh")))
+                 (define emacs-prefix? (cut string-prefix? "emacs-" <>))
+
+                 (setenv "SHELL" "sh")
+                 (setenv "EMACSLOADPATH"
+                         (string-concatenate
+                          (map (match-lambda
+                                 (((? emacs-prefix? name) . dir)
+                                  (string-append (el-dir dir) ":"))
+                                 (_ ""))
+                               inputs)))
+                 (substitute* (find-files "." "\\.el") (("/bin/sh") sh))
+                 (substitute* "tests/haskell-code-conventions.el"
+                   ;; Function name recently changed in "emacs-el-search".
+                   (("el-search--search-pattern") "el-search-forward")
+                   ;; Don't contact home.
+                   (("\\(when \\(>= emacs-major-version 25\\)")
+                    "(require 'el-search) (when nil"))
+                 #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")))
+                 (define (copy-to-dir dir files)
+                   (for-each (lambda (f)
+                               (install-file f dir))
+                             files))
+
+                 (with-directory-excursion "doc"
+                   (unless (zero? (system* "makeinfo" "haskell-mode.texi"))
+                     (error "makeinfo failed"))
+                   (install-file "haskell-mode.info" info))
+                 (copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md"))
+                 (copy-to-dir el-dir (find-files "." "\\.elc?"))
+                 ;; These are part of other packages.
+                 (with-directory-excursion el-dir
+                   (for-each delete-file '("dash.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+)))
+      (license license:gpl3+))))

  (define-public flycheck
    (package
diff --git a/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch b/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch
new file mode 100644
index 000000000..a618df5fb
--- /dev/null
+++ b/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch
@@ -0,0 +1,42 @@
+From cee22450ee30e79952f594796721dc6b17798ee6 Mon Sep 17 00:00:00 2001
+From: Sascha Wilde <wilde@sha-bang.de>
+Date: Fri, 23 Sep 2016 15:35:59 +0200
+Subject: [PATCH] Removed unused lexical variables.
+
+---
+ haskell-lexeme.el  | 3 +--
+ haskell-process.el | 4 +---
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/haskell-lexeme.el b/haskell-lexeme.el
+index 4256a79..b832560 100644
+--- a/haskell-lexeme.el
++++ b/haskell-lexeme.el
+@@ -138,8 +138,7 @@ When match is successful, match-data will contain:
+   (match-text 2) - whole qualified identifier
+   (match-text 3) - unqualified part of identifier
+   (match-text 4) - closing backtick"
+-  (let ((begin (point))
+-        (match-data-old (match-data))
++  (let ((match-data-old (match-data))
+         first-backtick-start
+         last-backtick-start
+         qid-start
+diff --git a/haskell-process.el b/haskell-process.el
+index b4efba2..4f3f859 100644
+--- a/haskell-process.el
++++ b/haskell-process.el
+@@ -160,9 +160,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
+ (defun haskell-process-log (msg)
+   "Effective append MSG to the process log (if enabled)."
+   (when haskell-process-log
+-    (let* ((append-to (get-buffer-create "*haskell-process-log*"))
+-           (windows (get-buffer-window-list append-to t t))
+-           move-point-in-windows)
++    (let* ((append-to (get-buffer-create "*haskell-process-log*")))
+       (with-current-buffer append-to
+         ;; point should follow insertion so that it stays at the end
+         ;; of the buffer
+-- 
+2.11.0
+
-- 
2.11.0

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

* bug#31726: confirming proposed change
  2018-06-08 19:46     ` Jack Hill
@ 2018-06-09 20:34       ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2018-06-09 20:34 UTC (permalink / raw)
  To: Jack Hill; +Cc: 31726

Hi,

Jack Hill <jackhill@jackhill.us> skribis:

>> Jack Hill <jackhill@jackhill.us> skribis:
>>
>>> Sure, I'll give make a path a go. You're thinking that I should try
>>> applying the changes that the commit introduced as part of our package
>>> definition?
>>
>> Yes, either that or use a snapshot of upstream haskell-mode.
>
> I have started workign on a patch implementing the former. I've
> included what I have so far below, but it's not ready to be included
> in the distribution because not all of the tests pass. Maybe this is
> because the one patch shouldn't be applied in issolation and it would
> be bettter to take the snapshot approach?
>
> Otherwise, is what I did with the package revision reasonable?

Yes, definitely.

> From 62ae1a14c48f3d70e6f47ffd6de60a0b9af9d43f Mon Sep 17 00:00:00 2001
> From: Jack Hill <jackhill@jackhill.us>
> Date: Thu, 7 Jun 2018 22:54:12 -0400
> Subject: [PATCH] Patch haskell-mode to remove unused lexical variables
>
> ---
>  gnu/packages/emacs.scm                             | 174 +++++++++++----------
>  ...ell-mode-removed-unused-lexical-variables.patch |  42 +++++
>  2 files changed, 131 insertions(+), 85 deletions(-)
>  create mode 100644 gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch

You’ll need to add the patch to gnu/local.mk.

> --- /dev/null
> +++ b/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch

Please add a line or two with the URL of the upstream bug report or
patch, and maybe a few words on what the patch is about.

Thank you!

Ludo’.

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

* bug#31726: Attempt to use git reference for haskell-mode
  2018-06-05 16:27 bug#31726: haskell-mode fails to build with (at least) Emacs 26.1 Jack Hill
       [not found] ` <handler.31726.B.1528217025308.ack@debbugs.gnu.org>
  2018-06-07 21:43 ` bug#31726: confirming proposed change Jack Hill
@ 2018-07-20 19:58 ` Jack Hill
  2018-07-23  8:20   ` Ludovic Courtès
  2 siblings, 1 reply; 9+ messages in thread
From: Jack Hill @ 2018-07-20 19:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31726

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

Ludo’,

I've returned to working on the haskell-mode fixes for Emacs 26.1. 
However, I'm afraid that I'll need a bit more guidance about the best path 
forward to prepare a patch that is suitable for inclusion in Guix.

When I left off, in addition to your comments, I was concerned with test 
failures, so I tried to instead to define the package using a git 
reference (patch below (I have not yet worked on the commit message). 
Unfortunately, more of the tests fail than before. I was able to get more 
of the tests to pass by adding ghc as an input. With test disabled, I am 
able to install the package and load it in Emacs.

A breakdown of the number of failing test is as follows:
16.1 version with patch  -- 4
git version without ghc -- 11
git version with ghc -- 7

I'm not sure which version to prefer, or how to proceed making that 
decision. Version 16.1 was released in September 2016. By moving to the 
git version, we would no longer need to run a substitution in 
haskell-code-conventions.el as that file has been removed upstream.

What additional information would be useful?

Would it be acceptable to disable the tests?

Thanks,
Jack

From 79c41a7a3ad29441c164042b27ce5e2e3dcaf807 Mon Sep 17 00:00:00 2001
From: Jack Hill <jackhill@jackhill.us>
Date: Thu, 7 Jun 2018 22:54:12 -0400
Subject: [PATCH] Switch haskell-mode to use git-reference.

This change is needed for compatibility with new Emacs (the last released
version was in 2016).

Add ghc as an input as it is used in some of the tests.
---
  gnu/packages/emacs.scm                             | 168 ++++++++++-----------
  ...ell-mode-removed-unused-lexical-variables.patch |  42 ++++++
  2 files changed, 126 insertions(+), 84 deletions(-)
  create mode 100644 gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index fa790dba8..677c43fde 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -113,6 +113,7 @@
    #:use-module (gnu packages xdisorg)
    #:use-module (gnu packages shells)
    #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages haskell)
    #:use-module (guix utils)
    #:use-module (srfi srfi-1)
    #:use-module (ice-9 match))
@@ -636,91 +637,90 @@ only a handful of functions that are not resource-specific.")
      (license license:gpl3+)))

  (define-public haskell-mode
-  (package
-    (name "haskell-mode")
-    (version "16.1")
-    (source (origin
-              (method url-fetch)
-              (file-name (string-append name "-" version ".tar.gz"))
-              (uri (string-append
-                    "https://github.com/haskell/haskell-mode/archive/v"
-                    version ".tar.gz"))
-              (sha256
-               (base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h"))))
-    (inputs
-     `(("emacs-el-search" ,emacs-el-search) ; for tests
-       ("emacs-stream" ,emacs-stream)))     ; for tests
-    (propagated-inputs
-     `(("emacs-dash" ,emacs-dash)))
-    (native-inputs
-     `(("emacs" ,emacs-minimal)
-       ("texinfo" ,texinfo)))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:make-flags (list (string-append "EMACS="
-                                         (assoc-ref %build-inputs "emacs")
-                                         "/bin/emacs"))
-       #:modules ((ice-9 match)
-                  (srfi srfi-26)
-                  ,@%gnu-build-system-modules)
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (add-before
-          'build 'pre-build
-          (lambda* (#:key inputs #:allow-other-keys)
-            (define (el-dir store-dir)
-              (match (find-files store-dir "\\.el$")
-                ((f1 f2 ...) (dirname f1))
-                (_ "")))
-
-            (let ((sh (string-append (assoc-ref inputs "bash") "/bin/sh")))
-              (define emacs-prefix? (cut string-prefix? "emacs-" <>))
-
-              (setenv "SHELL" "sh")
-              (setenv "EMACSLOADPATH"
-                      (string-concatenate
-                       (map (match-lambda
-                              (((? emacs-prefix? name) . dir)
-                               (string-append (el-dir dir) ":"))
-                              (_ ""))
-                            inputs)))
-              (substitute* (find-files "." "\\.el") (("/bin/sh") sh))
-              (substitute* "tests/haskell-code-conventions.el"
-                ;; Function name recently changed in "emacs-el-search".
-                (("el-search--search-pattern") "el-search-forward")
-                ;; Don't contact home.
-                (("\\(when \\(>= emacs-major-version 25\\)")
-                 "(require 'el-search) (when nil"))
-              #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")))
-              (define (copy-to-dir dir files)
-                (for-each (lambda (f)
-                            (install-file f dir))
-                          files))
-
-              (with-directory-excursion "doc"
-                (invoke "makeinfo" "haskell-mode.texi")
-                (install-file "haskell-mode.info" info))
-               (copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md"))
-               (copy-to-dir el-dir (find-files "." "\\.elc?"))
-               ;; These are part of other packages.
-               (with-directory-excursion el-dir
-                 (for-each delete-file '("dash.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
+  (let ((release "16.1")
+        (revision "1")
+        (commit "dd0ea640fa449d021399a17db65e4d50d3f0f2a9"))
+    (package
+      (name "haskell-mode")
+      (version (string-append release "-" revision "-"
+                              (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/haskell/haskell-mode.git")
+                      (commit commit)))
+                (sha256
+                 (base32 "0cc8mhjn4qhn3zs3x7azkjnvalg156b6h0n13b8wzlvyp9ka28yj"))))
+      (inputs
+       `(("emacs-el-search" ,emacs-el-search) ; for tests
+         ("emacs-stream" ,emacs-stream) ; for tests
+         ("ghc" ,ghc))) ; for tests
+      (propagated-inputs
+       `(("emacs-dash" ,emacs-dash)))
+      (native-inputs
+       `(("emacs" ,emacs-minimal)
+         ("texinfo" ,texinfo)))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:make-flags (list (string-append "EMACS="
+                                           (assoc-ref %build-inputs "emacs")
+                                           "/bin/emacs"))
+         #:modules ((ice-9 match)
+                    (srfi srfi-26)
+                    ,@%gnu-build-system-modules)
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (add-before
+               'build 'pre-build
+             (lambda* (#:key inputs #:allow-other-keys)
+               (define (el-dir store-dir)
+                 (match (find-files store-dir "\\.el$")
+                   ((f1 f2 ...) (dirname f1))
+                   (_ "")))
+
+               (let ((sh (string-append (assoc-ref inputs "bash") "/bin/sh")))
+                 (define emacs-prefix? (cut string-prefix? "emacs-" <>))
+
+                 (setenv "SHELL" "sh")
+                 (setenv "EMACSLOADPATH"
+                         (string-concatenate
+                          (map (match-lambda
+                                 (((? emacs-prefix? name) . dir)
+                                  (string-append (el-dir dir) ":"))
+                                 (_ ""))
+                               inputs)))
+                 (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")))
+                 (define (copy-to-dir dir files)
+                   (for-each (lambda (f)
+                               (install-file f dir))
+                             files))
+
+                 (with-directory-excursion "doc"
+                   (unless (zero? (system* "makeinfo" "haskell-mode.texi"))
+                     (error "makeinfo failed"))
+                   (install-file "haskell-mode.info" info))
+                 (copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md"))
+                 (copy-to-dir el-dir (find-files "." "\\.elc?"))
+                 ;; These are part of other packages.
+                 (with-directory-excursion el-dir
+                   (for-each delete-file '("dash.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+)))
+      (license license:gpl3+))))

  (define-public flycheck
    (package
diff --git a/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch b/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch
new file mode 100644
index 000000000..a618df5fb
--- /dev/null
+++ b/gnu/packages/patches/haskell-mode-removed-unused-lexical-variables.patch
@@ -0,0 +1,42 @@
+From cee22450ee30e79952f594796721dc6b17798ee6 Mon Sep 17 00:00:00 2001
+From: Sascha Wilde <wilde@sha-bang.de>
+Date: Fri, 23 Sep 2016 15:35:59 +0200
+Subject: [PATCH] Removed unused lexical variables.
+
+---
+ haskell-lexeme.el  | 3 +--
+ haskell-process.el | 4 +---
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/haskell-lexeme.el b/haskell-lexeme.el
+index 4256a79..b832560 100644
+--- a/haskell-lexeme.el
++++ b/haskell-lexeme.el
+@@ -138,8 +138,7 @@ When match is successful, match-data will contain:
+   (match-text 2) - whole qualified identifier
+   (match-text 3) - unqualified part of identifier
+   (match-text 4) - closing backtick"
+-  (let ((begin (point))
+-        (match-data-old (match-data))
++  (let ((match-data-old (match-data))
+         first-backtick-start
+         last-backtick-start
+         qid-start
+diff --git a/haskell-process.el b/haskell-process.el
+index b4efba2..4f3f859 100644
+--- a/haskell-process.el
++++ b/haskell-process.el
+@@ -160,9 +160,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
+ (defun haskell-process-log (msg)
+   "Effective append MSG to the process log (if enabled)."
+   (when haskell-process-log
+-    (let* ((append-to (get-buffer-create "*haskell-process-log*"))
+-           (windows (get-buffer-window-list append-to t t))
+-           move-point-in-windows)
++    (let* ((append-to (get-buffer-create "*haskell-process-log*")))
+       (with-current-buffer append-to
+         ;; point should follow insertion so that it stays at the end
+         ;; of the buffer
+-- 
+2.11.0
+
-- 
2.11.0

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

* bug#31726: Attempt to use git reference for haskell-mode
  2018-07-20 19:58 ` bug#31726: Attempt to use git reference for haskell-mode Jack Hill
@ 2018-07-23  8:20   ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2018-07-23  8:20 UTC (permalink / raw)
  To: Jack Hill; +Cc: 31726

Hello Jack,

Jack Hill <jackhill@jackhill.us> skribis:

> I've returned to working on the haskell-mode fixes for Emacs
> 26.1. However, I'm afraid that I'll need a bit more guidance about the
> best path forward to prepare a patch that is suitable for inclusion in
> Guix.
>
> When I left off, in addition to your comments, I was concerned with
> test failures, so I tried to instead to define the package using a git
> reference (patch below (I have not yet worked on the commit
> message). Unfortunately, more of the tests fail than before. I was
> able to get more of the tests to pass by adding ghc as an input. With
> test disabled, I am able to install the package and load it in Emacs.
>
> A breakdown of the number of failing test is as follows:
> 16.1 version with patch  -- 4
> git version without ghc -- 11
> git version with ghc -- 7
>
> I'm not sure which version to prefer, or how to proceed making that
> decision. Version 16.1 was released in September 2016. By moving to
> the git version, we would no longer need to run a substitution in
> haskell-code-conventions.el as that file has been removed upstream.

From what you’re saying and from the previous discussion, it seems clear
to me that we’d rather use a recent Git snapshot.

> Would it be acceptable to disable the tests?

If there are 7 failing tests, perhaps that indicates a real issue.
Could you take a look at the test log to see if this is something
benign?  Sometimes it’s just hard-coded /usr/bin file names or similar
that cause tests to fail, and that is easy to fix.

Now, if haskell-mode has been failing to build for 2+ months, an update
without tests is still preferable over the status quo.  So if you don’t
see an immediate solution to the test failures, I suppose we could go
ahead and apply the patch.

Thank you,
Ludo’.

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

end of thread, other threads:[~2018-07-23  8:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 16:27 bug#31726: haskell-mode fails to build with (at least) Emacs 26.1 Jack Hill
     [not found] ` <handler.31726.B.1528217025308.ack@debbugs.gnu.org>
2018-06-05 21:02   ` bug#31726: Acknowledgement (haskell-mode fails to build with (at least) Emacs 26.1) Jack Hill
2018-06-07 16:14     ` Ludovic Courtès
2018-06-07 21:43 ` bug#31726: confirming proposed change Jack Hill
2018-06-08 14:30   ` Ludovic Courtès
2018-06-08 19:46     ` Jack Hill
2018-06-09 20:34       ` Ludovic Courtès
2018-07-20 19:58 ` bug#31726: Attempt to use git reference for haskell-mode Jack Hill
2018-07-23  8:20   ` Ludovic Courtès

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