gnu: emacs-haskell-mode: Update to 17.4.

* gnu/packages/patches/emacs-haskell-mode-no-redefine-builtin.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/emacs-xyz.scm (emacs-haskell-mode): Update to 17.4.
[source]<patches>: Use it here.
This commit is contained in:
Liliana Marie Prikler 2023-08-19 00:52:53 +02:00
parent ef077b83f9
commit 5a989fc417
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
3 changed files with 164 additions and 88 deletions

View file

@ -1096,6 +1096,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-git-email-missing-parens.patch \ %D%/packages/patches/emacs-git-email-missing-parens.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-json-reformat-fix-tests.patch \ %D%/packages/patches/emacs-json-reformat-fix-tests.patch \
%D%/packages/patches/emacs-haskell-mode-no-redefine-builtin.patch \
%D%/packages/patches/emacs-highlight-stages-add-gexp.patch \ %D%/packages/patches/emacs-highlight-stages-add-gexp.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \ %D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \ %D%/packages/patches/emacs-native-comp-driver-options.patch \

View file

@ -2249,99 +2249,99 @@ replacement.")
(license license:gpl3+)))) (license license:gpl3+))))
(define-public emacs-haskell-mode (define-public emacs-haskell-mode
(let ((revision "0") (package
(commit "5a9f8072c7b9168f0a8409adf9d62a3e4ad4ea3d")) (name "emacs-haskell-mode")
(package (version "17.4")
(name "emacs-haskell-mode") (source
(version (git-version "17.2" revision commit)) (origin
(source (method git-fetch)
(origin (uri (git-reference
(method git-fetch) (url "https://github.com/haskell/haskell-mode")
(uri (git-reference (commit (string-append "v" version))))
(url "https://github.com/haskell/haskell-mode") (file-name (git-file-name name version))
(commit commit))) (sha256
(file-name (git-file-name name version)) (base32 "03j94fgw1bljbjqmikbn9mnrfifxf7g9zrb727zmnnrjwyi0wd4n"))
(sha256 (patches
(base32 "0np1wrwdq7b9hpqpl9liampacnkx6diphyk8h2sbz2mfn9qr7pxs")))) (search-patches "emacs-haskell-mode-no-redefine-builtin.patch"))))
(propagated-inputs (propagated-inputs
(list emacs-dash)) (list emacs-dash))
(native-inputs (native-inputs
(list emacs-minimal emacs-el-search emacs-stream texinfo)) (list emacs-minimal emacs-el-search emacs-stream texinfo))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
(list (list
#:make-flags #~(list #:make-flags #~(list
(string-append "EMACS=" #$emacs-minimal "/bin/emacs")) (string-append "EMACS=" #$emacs-minimal "/bin/emacs"))
#:modules `((ice-9 match) #:modules `((ice-9 match)
(srfi srfi-26) (srfi srfi-26)
((guix build emacs-build-system) #:prefix emacs:) ((guix build emacs-build-system) #:prefix emacs:)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:imported-modules `(,@%gnu-build-system-modules #:imported-modules `(,@%gnu-build-system-modules
(guix build emacs-build-system) (guix build emacs-build-system)
(guix build emacs-utils)) (guix build emacs-utils))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(delete 'configure) (delete 'configure)
(add-before 'build 'pre-build (add-before 'build 'pre-build
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(define (el-dir store-dir) (define (el-dir store-dir)
(match (find-files store-dir "\\.el$") (match (find-files store-dir "\\.el$")
((f1 f2 ...) (dirname f1)) ((f1 f2 ...) (dirname f1))
(_ ""))) (_ "")))
(let ((sh (search-input-file inputs "/bin/sh"))) (let ((sh (search-input-file inputs "/bin/sh")))
(define emacs-prefix? (cut string-prefix? "emacs-" <>)) (define emacs-prefix? (cut string-prefix? "emacs-" <>))
(setenv "SHELL" "sh") (setenv "SHELL" "sh")
(setenv "EMACSLOADPATH" (setenv "EMACSLOADPATH"
(string-concatenate (string-concatenate
(map (match-lambda (map (match-lambda
(((? emacs-prefix? name) . dir) (((? emacs-prefix? name) . dir)
(string-append (el-dir dir) ":")) (string-append (el-dir dir) ":"))
(_ "")) (_ ""))
inputs))) inputs)))
(substitute* (find-files "." "\\.el") (("/bin/sh") sh))))) (substitute* (find-files "." "\\.el") (("/bin/sh") sh)))))
(add-before 'check 'delete-failing-tests (add-before 'check 'delete-failing-tests
;; XXX: these tests require GHC executable, which would be a big ;; XXX: these tests require GHC executable, which would be a big
;; native input. ;; native input.
(lambda _ (lambda _
(with-directory-excursion "tests" (with-directory-excursion "tests"
;; File `haskell-indent-tests.el' fails with ;; File `haskell-indent-tests.el' fails with
;; `haskell-indent-put-region-in-literate-2' ;; `haskell-indent-put-region-in-literate-2'
;; on Emacs 27.1+ ;; on Emacs 27.1+
;; XXX: https://github.com/haskell/haskell-mode/issues/1714 ;; XXX: https://github.com/haskell/haskell-mode/issues/1714
(for-each delete-file (for-each delete-file
'("haskell-indent-tests.el" '("haskell-indent-tests.el"
"haskell-customize-tests.el" "haskell-customize-tests.el"
"inferior-haskell-tests.el")) "inferior-haskell-tests.el"))
;; requires many external tools (e.g. git, hasktags) ;; requires many external tools (e.g. git, hasktags)
(substitute* "haskell-mode-tests.el" (substitute* "haskell-mode-tests.el"
(("\\(ert-deftest haskell-generate-tags.*" all) (("\\(ert-deftest haskell-generate-tags.*" all)
(string-append all " (skip-unless nil)")))))) (string-append all " (skip-unless nil)"))))))
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(el-dir (emacs:elpa-directory out)) (el-dir (emacs:elpa-directory out))
(doc (string-append (doc (string-append
out "/share/doc/haskell-mode-" #$version)) out "/share/doc/haskell-mode-" #$version))
(info (string-append out "/share/info"))) (info (string-append out "/share/info")))
(define (copy-to-dir dir files) (define (copy-to-dir dir files)
(for-each (lambda (f) (for-each (lambda (f)
(install-file f dir)) (install-file f dir))
files)) files))
(with-directory-excursion "doc" (with-directory-excursion "doc"
(invoke "makeinfo" "haskell-mode.texi") (invoke "makeinfo" "haskell-mode.texi")
(install-file "haskell-mode.info" info)) (install-file "haskell-mode.info" info))
(copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md")) (copy-to-dir doc '("CONTRIBUTING.md" "NEWS" "README.md"))
(copy-to-dir el-dir (find-files "." "\\.elc?")))))))) (copy-to-dir el-dir (find-files "." "\\.elc?"))))))))
(home-page "https://github.com/haskell/haskell-mode") (home-page "https://github.com/haskell/haskell-mode")
(synopsis "Haskell mode for Emacs") (synopsis "Haskell mode for Emacs")
(description (description
"This is an Emacs mode for editing, debugging and developing Haskell "This is an Emacs mode for editing, debugging and developing Haskell
programs.") programs.")
(license license:gpl3+)))) (license license:gpl3+)))
(define-public emacs-dante (define-public emacs-dante
(package (package

View file

@ -0,0 +1,75 @@
From faa95a784d2c74c72e70367a5d531df6dd61aeab Mon Sep 17 00:00:00 2001
From: Steve Purcell <steve@sanityinc.com>
Date: Sun, 6 Aug 2023 16:41:48 +0200
Subject: [PATCH] Don't redefine built-in function
Fixes #1817
---
tests/haskell-indent-tests.el | 14 ++++++++------
tests/haskell-indentation-tests.el | 14 ++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/tests/haskell-indent-tests.el b/tests/haskell-indent-tests.el
index 7196405b8..9a3de4ad3 100644
--- a/tests/haskell-indent-tests.el
+++ b/tests/haskell-indent-tests.el
@@ -40,11 +40,13 @@
;; (haskell-indent-put-region-in-literate (point-min) (point-max) -1)
;; (buffer-substring-no-properties (point-min) (point-max))))))
-(defsubst string-trim-left (string)
- "Remove leading whitespace from STRING."
- (if (string-match "\\`[ \t\n\r]+" string)
- (replace-match "" t t string)
- string))
+(if (fboundp 'string-trim-left)
+ (defalias 'haskell--string-trim-left 'string-trim-left)
+ (defun haskell--string-trim-left (string &optional regexp)
+ "Remove leading whitespace from STRING."
+ (if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string)
+ (substring string (match-end 0))
+ string)))
(defun haskell-indent-format-info (info)
(if (cdr info)
@@ -128,7 +130,7 @@ macro quotes them for you."
:expected-result
,(if allow-failure :failed :passed)
(haskell-indent-check
- ,(string-trim-left source)
+ ,(haskell--string-trim-left source)
,@(mapcar (lambda (x)
(list 'quote x))
test-cases))))))
diff --git a/tests/haskell-indentation-tests.el b/tests/haskell-indentation-tests.el
index 4889b76a7..cd783a4f4 100644
--- a/tests/haskell-indentation-tests.el
+++ b/tests/haskell-indentation-tests.el
@@ -33,11 +33,13 @@
;;; Code:
-(defsubst string-trim-left (string)
- "Remove leading whitespace from STRING."
- (if (string-match "\\`[ \t\n\r]+" string)
- (replace-match "" t t string)
- string))
+(if (fboundp 'string-trim-left)
+ (defalias 'haskell--string-trim-left 'string-trim-left)
+ (defun haskell--string-trim-left (string &optional regexp)
+ "Remove leading whitespace from STRING."
+ (if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string)
+ (substring string (match-end 0))
+ string)))
(defun haskell-indentation-check (source &rest test-cases)
"Check if `haskell-indentation-find-indentations' returns expected results.
@@ -115,7 +117,7 @@ macro quotes them for you."
:expected-result
,(if allow-failure :failed :passed)
(haskell-indentation-check
- ,(string-trim-left source)
+ ,(haskell--string-trim-left source)
,@(mapcar (lambda (x)
(list 'quote x))
test-cases))))))