unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Jack Hill <jackhill@jackhill.us>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 31726@debbugs.gnu.org
Subject: bug#31726: Attempt to use git reference for haskell-mode
Date: Fri, 20 Jul 2018 15:58:55 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.20.1807201526550.11087@marsh.hcoop.net> (raw)
In-Reply-To: <alpine.DEB.2.20.1806051217350.1480@marsh.hcoop.net>

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

  parent reply	other threads:[~2018-07-20 20:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Jack Hill [this message]
2018-07-23  8:20   ` bug#31726: Attempt to use git reference for haskell-mode Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1807201526550.11087@marsh.hcoop.net \
    --to=jackhill@jackhill.us \
    --cc=31726@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).