gnu: haskell-mode: Fix test failure.

Fixes <https://bugs.gnu.org/31726>.

Thanks to Jack Hill <jackhill@jackhill.us> for exploring different solutions
at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31726>.

* gnu/packages/patches/haskell-mode-unused-variables.patch,
gnu/packages/patches/haskell-mode-make-check.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 file name.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Alex Vong 2018-09-02 07:47:05 +08:00 committed by Ludovic Courtès
parent b21a55a9f2
commit 2bd6ed9e4c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
4 changed files with 91 additions and 7 deletions

View file

@ -791,6 +791,8 @@ dist_patch_DATA = \
%D%/packages/patches/gtkglext-disable-disable-deprecated.patch \ %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
%D%/packages/patches/gzdoom-search-in-installed-share.patch \ %D%/packages/patches/gzdoom-search-in-installed-share.patch \
%D%/packages/patches/handbrake-pkg-config-path.patch \ %D%/packages/patches/handbrake-pkg-config-path.patch \
%D%/packages/patches/haskell-mode-unused-variables.patch \
%D%/packages/patches/haskell-mode-make-check.patch \
%D%/packages/patches/hdf4-architectures.patch \ %D%/packages/patches/hdf4-architectures.patch \
%D%/packages/patches/hdf4-reproducibility.patch \ %D%/packages/patches/hdf4-reproducibility.patch \
%D%/packages/patches/hdf4-shared-fortran.patch \ %D%/packages/patches/hdf4-shared-fortran.patch \

View file

@ -646,7 +646,11 @@ (define-public haskell-mode
"https://github.com/haskell/haskell-mode/archive/v" "https://github.com/haskell/haskell-mode/archive/v"
version ".tar.gz")) version ".tar.gz"))
(sha256 (sha256
(base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h")))) (base32 "0g6lcjw7lcgavv3yrd8xjcyqgfyjl787y32r1z14amw2f009m78h"))
(patches
(search-patches ; backport test failure fixes
"haskell-mode-unused-variables.patch"
"haskell-mode-make-check.patch"))))
(inputs (inputs
`(("emacs-el-search" ,emacs-el-search) ; for tests `(("emacs-el-search" ,emacs-el-search) ; for tests
("emacs-stream" ,emacs-stream))) ; for tests ("emacs-stream" ,emacs-stream))) ; for tests
@ -686,12 +690,11 @@ (define emacs-prefix? (cut string-prefix? "emacs-" <>))
(_ "")) (_ ""))
inputs))) inputs)))
(substitute* (find-files "." "\\.el") (("/bin/sh") sh)) (substitute* (find-files "." "\\.el") (("/bin/sh") sh))
(substitute* "tests/haskell-code-conventions.el" ;; embed filename to fix test failure
;; Function name recently changed in "emacs-el-search". (let ((file "tests/haskell-cabal-tests.el"))
(("el-search--search-pattern") "el-search-forward") (substitute* file
;; Don't contact home. (("\\(buffer-file-name\\)")
(("\\(when \\(>= emacs-major-version 25\\)") (format #f "(or (buffer-file-name) ~s)" file))))
"(require 'el-search) (when nil"))
#t))) #t)))
(replace (replace
'install 'install

View file

@ -0,0 +1,35 @@
Copied from upstream repository.
Hunk #2 is removed since it cannot be applied and it is not needed.
From 7cead7137bf54851c1b7df5a3854351296d21276 Mon Sep 17 00:00:00 2001
From: Vasantha Ganesh K <vasanthaganesh.k@tuta.io>
Date: Thu, 22 Jun 2017 23:38:40 +0530
Subject: [PATCH] removed `check-conventions' from make
---
Makefile | 7 +-
tests/haskell-code-conventions.el | 165 ------------------------------
2 files changed, 1 insertion(+), 171 deletions(-)
delete mode 100644 tests/haskell-code-conventions.el
diff --git a/Makefile b/Makefile
index b2c89d6..aa907c5 100644
--- a/Makefile
+++ b/Makefile
@@ -79,12 +79,7 @@ build-$(EMACS_VERSION)/build-flag : build-$(EMACS_VERSION) $(patsubst %.el,build
check-%: tests/%-tests.el
$(BATCH) -l "$<" -f ert-run-tests-batch-and-exit;
-check: compile $(AUTOLOADS) check-ert check-conventions
-
-check-conventions :
- $(BATCH) -l tests/haskell-code-conventions.el \
- -f haskell-check-conventions-batch-and-exit
- @echo "conventions are okay"
+check: compile $(AUTOLOADS) check-ert
check-ert: $(ELCHECKS)
$(BATCH) --eval "(when (= emacs-major-version 24) \
--
2.18.0

View file

@ -0,0 +1,44 @@
Copied verbatim from upstream repository.
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.18.0