GNU bug report logs - #31726
haskell-mode fails to build with (at least) Emacs 26.1

Previous Next

Package: guix;

Reported by: Jack Hill <jackhill <at> jackhill.us>

Date: Tue, 5 Jun 2018 16:44:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31726 in the body.
You can then email your comments to 31726 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Tue, 05 Jun 2018 16:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jack Hill <jackhill <at> jackhill.us>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 05 Jun 2018 16:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jack Hill <jackhill <at> jackhill.us>
To: bug-guix <at> gnu.org
Subject: haskell-mode fails to build with (at least) Emacs 26.1
Date: Tue, 5 Jun 2018 12:27:14 -0400 (EDT)
[Message part 1 (text/plain, inline)]
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

Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Tue, 05 Jun 2018 21:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: Jack Hill <jackhill <at> jackhill.us>
To: 31726 <at> debbugs.gnu.org
Subject: Re: bug#31726: Acknowledgement (haskell-mode fails to build with
 (at least) Emacs 26.1)
Date: Tue, 5 Jun 2018 17:02:10 -0400 (EDT)
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




Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Thu, 07 Jun 2018 16:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jack Hill <jackhill <at> jackhill.us>
Cc: 31726 <at> debbugs.gnu.org
Subject: Re: bug#31726: Acknowledgement (haskell-mode fails to build with (at
 least) Emacs 26.1)
Date: Thu, 07 Jun 2018 18:14:14 +0200
Hello,

Jack Hill <jackhill <at> 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’.




Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Thu, 07 Jun 2018 21:44:01 GMT) Full text and rfc822 format available.

Message #14 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: Jack Hill <jackhill <at> jackhill.us>
To: 31726 <at> debbugs.gnu.org
Subject: bug#31726 confirming proposed change
Date: Thu, 7 Jun 2018 17:43:48 -0400 (EDT)
[Message part 1 (text/plain, inline)]
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

Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Fri, 08 Jun 2018 14:32:02 GMT) Full text and rfc822 format available.

Message #17 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jack Hill <jackhill <at> jackhill.us>
Cc: 31726 <at> debbugs.gnu.org
Subject: Re: bug#31726: confirming proposed change
Date: Fri, 08 Jun 2018 16:30:53 +0200
Hi,

Jack Hill <jackhill <at> 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’.




Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Fri, 08 Jun 2018 19:48:02 GMT) Full text and rfc822 format available.

Message #20 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: Jack Hill <jackhill <at> jackhill.us>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 31726 <at> debbugs.gnu.org
Subject: Re: bug#31726: confirming proposed change
Date: Fri, 8 Jun 2018 15:46:46 -0400 (EDT)
[Message part 1 (text/plain, inline)]
On Fri, 8 Jun 2018, Ludovic Courtès wrote:

> Hi,
>
> Jack Hill <jackhill <at> 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 <at> 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 <at> 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

Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Sat, 09 Jun 2018 20:35:01 GMT) Full text and rfc822 format available.

Message #23 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jack Hill <jackhill <at> jackhill.us>
Cc: 31726 <at> debbugs.gnu.org
Subject: Re: bug#31726: confirming proposed change
Date: Sat, 09 Jun 2018 22:34:05 +0200
Hi,

Jack Hill <jackhill <at> jackhill.us> skribis:

>> Jack Hill <jackhill <at> 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 <at> 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’.




Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Fri, 20 Jul 2018 20:00:02 GMT) Full text and rfc822 format available.

Message #26 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: Jack Hill <jackhill <at> jackhill.us>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 31726 <at> debbugs.gnu.org
Subject: Attempt to use git reference for haskell-mode
Date: Fri, 20 Jul 2018 15:58:55 -0400 (EDT)
[Message part 1 (text/plain, inline)]
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 <at> 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 <at> 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

Information forwarded to bug-guix <at> gnu.org:
bug#31726; Package guix. (Mon, 23 Jul 2018 08:21:02 GMT) Full text and rfc822 format available.

Message #29 received at 31726 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Jack Hill <jackhill <at> jackhill.us>
Cc: 31726 <at> debbugs.gnu.org
Subject: Re: Attempt to use git reference for haskell-mode
Date: Mon, 23 Jul 2018 10:20:30 +0200
Hello Jack,

Jack Hill <jackhill <at> 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’.




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sun, 02 Sep 2018 15:09:02 GMT) Full text and rfc822 format available.

Notification sent to Jack Hill <jackhill <at> jackhill.us>:
bug acknowledged by developer. (Sun, 02 Sep 2018 15:09:02 GMT) Full text and rfc822 format available.

Message #34 received at 31726-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Vong <alexvong1995 <at> gmail.com>
Cc: 32608-done <at> debbugs.gnu.org, 31726-done <at> debbugs.gnu.org
Subject: Re: [bug#32608] [PATCH] gnu: haskell-mode: Fix test failure.
Date: Sun, 02 Sep 2018 17:08:17 +0200
Hi Alex,

Alex Vong <alexvong1995 <at> gmail.com> skribis:

> I manage to fix all test failures of haskell-mode (which FTBFS for a
> long time). I use Jack's bug report
> <https://github.com/haskell/haskell-mode/issues/1601> as a starting
> point and continue from there. The fix consists of backporting 2 commits
> from upstream and hard-coding the filename in the tests. (This is okay
> since the tests will not be installed.) 

Awesome.

> Let's write some Haskell for good (`・ω・´)

:-)

> From 99fefcd43adbe8effe24480e64f9fa0b461b8fe5 Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995 <at> gmail.com>
> Date: Sun, 2 Sep 2018 07:47:05 +0800
> Subject: [PATCH] gnu: haskell-mode: Fix test failure.
>
> Thanks to Jack Hill <jackhill <at> jackhill.us> for exploring differnt solutions
> at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31726>.
>
> * gnu/packages/patches/haskell-mode-Removed-unused-lexical-variables.patch,
> gnu/packages/patches/haskell-mode-removed-check-conventions-from-make.patch:
> New files.
> * gnu/local.mk (dist_patch_DATA): Add them.
> * gnu/packages/emacs.scm (haskell-mode)[source]: Use them.
> [arguments]: Adjust 'pre-build' phase to embed filename.

I’ve shorted the patch file names as suggested by ‘guix lint’, added a
“Fixes” line in the commit log, and applied.

Thanks to both of you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 01 Oct 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.