From patchwork Fri Aug 18 22:52:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 53008 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 895A627BBEA; Sat, 19 Aug 2023 09:44:36 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E160F27BBE2 for ; Sat, 19 Aug 2023 09:44:34 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXHYx-0000c0-8s; Sat, 19 Aug 2023 04:44:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXHYv-0000bT-Pz for guix-patches@gnu.org; Sat, 19 Aug 2023 04:44:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qXHYv-0000ea-Hw for guix-patches@gnu.org; Sat, 19 Aug 2023 04:44:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXHYw-0005AR-CY; Sat, 19 Aug 2023 04:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65376] [PATCH emacs-team 2/7] gnu: emacs-haskell-mode: Update to 17.4. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, liliana.prikler@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 19 Aug 2023 08:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65376 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65376@debbugs.gnu.org Cc: andrew@trop.in, liliana.prikler@gmail.com X-Debbugs-Original-Xcc: andrew@trop.in, liliana.prikler@gmail.com Received: via spool by 65376-submit@debbugs.gnu.org id=B65376.169243459719731 (code B ref 65376); Sat, 19 Aug 2023 08:44:02 +0000 Received: (at 65376) by debbugs.gnu.org; 19 Aug 2023 08:43:17 +0000 Received: from localhost ([127.0.0.1]:49396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXHYB-00058A-SL for submit@debbugs.gnu.org; Sat, 19 Aug 2023 04:43:16 -0400 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]:45274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXHY7-00057K-Es for 65376@debbugs.gnu.org; Sat, 19 Aug 2023 04:43:12 -0400 Received: by mail-ej1-x643.google.com with SMTP id a640c23a62f3a-99357737980so212838166b.2 for <65376@debbugs.gnu.org>; Sat, 19 Aug 2023 01:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692434585; x=1693039385; h=mime-version:to:subject:date:from:references:in-reply-to:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oLGvl2u9hTRYkcVxQQIX3kA70Fn+WdLPaTcFDsmaG+w=; b=j53rCV4f/r0Pe3b1EnFTDs+SopFYGQNesaeYmuVTko2yrxVXDVfL2fd583aRxlGJon JgUMAf+LlQrdq0XlDQ62okGwZYZUj6b1ED1kvKaoh3n01t+3TWK+uU1KFuG22OTk1wjN Lcngf9fbgzpisAyFoBIWIrrXOh9S4DYRLlYMAnV2Q/MTjG70TW2eOiVWSCBLqeSS+ohN 1mZiJZLWguINSmg8qFMas7ejN3sM6QaUMi47s7cFEllOlumXIMsNlQvSSzJSdykc/z2v K6KLOJ/Sfsdl7SvxygTueYP6WEuedI8uOKT0upRyWIiPRXLlLg0NrciDg1EmymjpbBfa Q4Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692434585; x=1693039385; h=mime-version:to:subject:date:from:references:in-reply-to:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oLGvl2u9hTRYkcVxQQIX3kA70Fn+WdLPaTcFDsmaG+w=; b=a1EnO1XzvTjKQ7eDT76/nAXOltgC4S3OAS95wogH//kbHySL0g6nrOa/fTXiyC6GkD YadGZ4jZ15rdKxmARyhG/IVHfQfseTj8wnrPok2OGtDIGxSp+m3wCnzmudcfJyeoF1dP uE9nl9WpheqIpYuAB9a5gRMwOEoidgRQ8+i/jRO1nxDOL7aGvFYipvQMfz4TiyjEf5QS /kGmbD0y/ryyRz6kgrDu2HDql4okuSPvpeDenmpfjwV0uVlOM15MR2KXZEeIW1cyRdiW 1e224sCImQ89EgGddXGoqZThm7zXsOd05bmiY4n/jMFR7E48YpfsmpZhki9bT7n1bASx MWXA== X-Gm-Message-State: AOJu0YxKqrof5ZgfTK2cqpwILaIJD3rAO8NiacUSMebOGUnSdNgLCJOE eGqSOIxSkMS17COKBp2mh1qdsrqLeLD4MQ== X-Google-Smtp-Source: AGHT+IFFEPXy+PvJrsU6U+01w5CUZF+jiSXSob7EZpVtNqWusM3No7CrqlJL/H2aTd8H33xh6EQbnQ== X-Received: by 2002:a17:907:7818:b0:99d:eb3c:5239 with SMTP id la24-20020a170907781800b0099deb3c5239mr1136829ejc.43.1692434584664; Sat, 19 Aug 2023 01:43:04 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id w14-20020a1709064a0e00b0099d804da2e9sm2316168eju.225.2023.08.19.01.43.03 for <65376@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 01:43:03 -0700 (PDT) Message-ID: <5a989fc417de48b64cb2ee6a5228c3af391acc25.1692427560.git.liliana.prikler@gmail.com> In-Reply-To: References: From: Liliana Marie Prikler Date: Sat, 19 Aug 2023 00:52:53 +0200 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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]: Use it here. --- gnu/local.mk | 1 + gnu/packages/emacs-xyz.scm | 182 +++++++++--------- ...acs-haskell-mode-no-redefine-builtin.patch | 75 ++++++++ 3 files changed, 167 insertions(+), 91 deletions(-) create mode 100644 gnu/packages/patches/emacs-haskell-mode-no-redefine-builtin.patch diff --git a/gnu/local.mk b/gnu/local.mk index 7af2755a2b..e14a9adc33 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1096,6 +1096,7 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-git-email-missing-parens.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.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-lispy-fix-thread-last-test.patch \ %D%/packages/patches/emacs-native-comp-driver-options.patch \ diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index 30f924a3fb..1e03625f62 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm @@ -2249,99 +2249,99 @@ (define-public emacs-unpackaged-el (license license:gpl3+)))) (define-public emacs-haskell-mode - (let ((revision "0") - (commit "5a9f8072c7b9168f0a8409adf9d62a3e4ad4ea3d")) - (package - (name "emacs-haskell-mode") - (version (git-version "17.2" revision commit)) - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/haskell/haskell-mode") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 "0np1wrwdq7b9hpqpl9liampacnkx6diphyk8h2sbz2mfn9qr7pxs")))) - (propagated-inputs - (list emacs-dash)) - (native-inputs - (list emacs-minimal emacs-el-search emacs-stream texinfo)) - (build-system gnu-build-system) - (arguments - (list - #:make-flags #~(list - (string-append "EMACS=" #$emacs-minimal "/bin/emacs")) - #:modules `((ice-9 match) - (srfi srfi-26) - ((guix build emacs-build-system) #:prefix emacs:) - ,@%gnu-build-system-modules) - #:imported-modules `(,@%gnu-build-system-modules - (guix build emacs-build-system) - (guix build emacs-utils)) - #: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)) - (_ ""))) + (package + (name "emacs-haskell-mode") + (version "17.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/haskell/haskell-mode") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "03j94fgw1bljbjqmikbn9mnrfifxf7g9zrb727zmnnrjwyi0wd4n")) + (patches + (search-patches "emacs-haskell-mode-no-redefine-builtin.patch")))) + (propagated-inputs + (list emacs-dash)) + (native-inputs + (list emacs-minimal emacs-el-search emacs-stream texinfo)) + (build-system gnu-build-system) + (arguments + (list + #:make-flags #~(list + (string-append "EMACS=" #$emacs-minimal "/bin/emacs")) + #:modules `((ice-9 match) + (srfi srfi-26) + ((guix build emacs-build-system) #:prefix emacs:) + ,@%gnu-build-system-modules) + #:imported-modules `(,@%gnu-build-system-modules + (guix build emacs-build-system) + (guix build emacs-utils)) + #: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 (search-input-file inputs "/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))))) - (add-before 'check 'delete-failing-tests - ;; XXX: these tests require GHC executable, which would be a big - ;; native input. - (lambda _ - (with-directory-excursion "tests" - ;; File `haskell-indent-tests.el' fails with - ;; `haskell-indent-put-region-in-literate-2' - ;; on Emacs 27.1+ - ;; XXX: https://github.com/haskell/haskell-mode/issues/1714 - (for-each delete-file - '("haskell-indent-tests.el" - "haskell-customize-tests.el" - "inferior-haskell-tests.el")) - - ;; requires many external tools (e.g. git, hasktags) - (substitute* "haskell-mode-tests.el" - (("\\(ert-deftest haskell-generate-tags.*" all) - (string-append all " (skip-unless nil)")))))) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (el-dir (emacs:elpa-directory out)) - (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?")))))))) - (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 ((sh (search-input-file inputs "/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))))) + (add-before 'check 'delete-failing-tests + ;; XXX: these tests require GHC executable, which would be a big + ;; native input. + (lambda _ + (with-directory-excursion "tests" + ;; File `haskell-indent-tests.el' fails with + ;; `haskell-indent-put-region-in-literate-2' + ;; on Emacs 27.1+ + ;; XXX: https://github.com/haskell/haskell-mode/issues/1714 + (for-each delete-file + '("haskell-indent-tests.el" + "haskell-customize-tests.el" + "inferior-haskell-tests.el")) + + ;; requires many external tools (e.g. git, hasktags) + (substitute* "haskell-mode-tests.el" + (("\\(ert-deftest haskell-generate-tags.*" all) + (string-append all " (skip-unless nil)")))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (el-dir (emacs:elpa-directory out)) + (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?")))))))) + (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 emacs-dante (package diff --git a/gnu/packages/patches/emacs-haskell-mode-no-redefine-builtin.patch b/gnu/packages/patches/emacs-haskell-mode-no-redefine-builtin.patch new file mode 100644 index 0000000000..65ace2ee5e --- /dev/null +++ b/gnu/packages/patches/emacs-haskell-mode-no-redefine-builtin.patch @@ -0,0 +1,75 @@ +From faa95a784d2c74c72e70367a5d531df6dd61aeab Mon Sep 17 00:00:00 2001 +From: Steve Purcell +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))))))