emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/idris-mode 7a7a468000 10/10: Merge pull request #609 from


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode 7a7a468000 10/10: Merge pull request #609 from keram/mla-jfdm-fix-flycheck-main
Date: Wed, 18 Jan 2023 07:59:54 -0500 (EST)

branch: elpa/idris-mode
commit 7a7a4680004bed6ba87b8e56fafd55b408aac8d1
Merge: e39bb892f8 6272999465
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #609 from keram/mla-jfdm-fix-flycheck-main
    
    Improvment to flycheck checkers
---
 Makefile                    |   7 +--
 flycheck-idris.el           | 101 ++++++++++++++++++++++++++++++++++++++++++++
 idris-mode.el               |  20 ---------
 test/test-data/Flycheck.idr |   8 ++++
 4 files changed, 113 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index 46994f0f13..4d31c9870f 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 
 EMACS ?= emacs
 
-NEED_PKGS=prop-menu
+NEED_PKGS=prop-menu flycheck
 
 BATCHEMACS=$(EMACS) --batch --no-site-file -q \
        -eval '(add-to-list (quote load-path) "${PWD}/")' \
@@ -37,8 +37,9 @@ OBJS =        idris-commands.elc              \
        idris-syntax.elc                \
        idris-warnings.elc              \
        idris-warnings-tree.elc         \
-       idris-xref.elc \
-       inferior-idris.elc
+       idris-xref.elc                  \
+       inferior-idris.elc              \
+       flycheck-idris.elc
 
 .el.elc:
        $(BYTECOMP) $<
diff --git a/flycheck-idris.el b/flycheck-idris.el
new file mode 100644
index 0000000000..7de22a167e
--- /dev/null
+++ b/flycheck-idris.el
@@ -0,0 +1,101 @@
+;;; flycheck-idris.el --- Major mode for editing Idris code -*- 
lexical-binding: t -*-
+
+;; Copyright (C) 2022
+
+;; Author:
+;; URL: https://github.com/idris-hackers/idris-mode
+;; Keywords: languages
+;; Package-Requires: ((emacs "24") (prop-menu "0.1") (cl-lib "0.5"))
+;; Version: 1.1.0
+
+
+;;; Commentary:
+
+;; FlyCheck checkers for Idris(2)
+
+;;; Code:
+
+(require 'flycheck)
+(require 'idris-mode)
+
+(flycheck-define-checker idris
+  "An Idris syntax and type checker."
+  :command ("idris"
+            "--check" "--nocolor" "--warnpartial"
+            ;; Compute the command-line options similarly to inferior-idris
+            (eval (idris-compute-flags))
+            source-original)
+  :error-patterns
+  ((warning line-start
+            (file-name)
+            ":"
+            line
+            ":"
+            column
+            "-"
+            end-column
+            ":" line-end "\n"
+            (one-or-more blank) "|\n"
+            (one-or-more digit) (one-or-more blank) "|" (one-or-more 
not-newline) "\n"
+            (one-or-more blank) "|" (zero-or-more blank) (one-or-more "~") "\n"
+            "Warning - "(message (one-or-more not-newline)
+                                 (zero-or-more "\n" (one-or-more 
not-newline))))
+   (error line-start
+          (file-name)
+          ":"
+          line
+          ":"
+          column
+          "-"
+          end-column
+          ":" line-end "\n"
+          (one-or-more blank) "|\n"
+          (one-or-more digit) (one-or-more blank) "|" (one-or-more 
not-newline) "\n"
+          (one-or-more blank) "|" (zero-or-more blank) (one-or-more "~") "\n"
+          (one-or-more not-newline) "\n"
+          (one-or-more blank) (one-or-more not-newline) "\n\n"
+          (message (one-or-more not-newline)
+                   (zero-or-more "\n" (one-or-more not-newline)))))
+  :error-filter delete-dups
+  :modes idris-mode)
+
+
+(flycheck-define-checker idris2
+  "An Idris2 syntax and type checker."
+  :command ("idris2"
+            "--check" "--no-colour"
+            ;; Compute the command-line options similarly to inferior-idris
+            (eval (idris-compute-flags))
+            source-original)
+  :error-patterns ((warning line-start
+                            "Warning: "
+                            (message (one-or-more not-newline)
+                                     (zero-or-more "\n" (one-or-more 
not-newline))
+                                     "\n\n")
+                            (one-or-more (not ":")) ;; (file-name)
+                            ":"  line
+                            ":"  column
+                            "--" end-line
+                            ":"  end-column)
+                   (error line-start
+                          (zero-or-one "Uncaught error: ")
+                          "Error: "
+                          (zero-or-one "While processing" (one-or-more (not 
".")) ".")
+                          (message (one-or-more not-newline)
+                                   (zero-or-more "\n" (one-or-more 
not-newline))
+                                   "\n\n")
+                          (one-or-more (not ":")) ;; (file-name)
+                          ":"  line
+                          ":"  column
+                          "--" end-line
+                          ":"  end-column))
+  :modes idris-mode)
+
+
+;;; ###autoload
+(add-to-list 'flycheck-checkers 'idris)
+(add-to-list 'flycheck-checkers 'idris2)
+
+
+(provide 'flycheck-idris)
+;;; flycheck-idris.el ends here
diff --git a/idris-mode.el b/idris-mode.el
index 4ac0a22123..7809e9a912 100644
--- a/idris-mode.el
+++ b/idris-mode.el
@@ -173,25 +173,5 @@ Invokes `idris-mode-hook'."
 (push '("\\.lidr$" . idris-mode) auto-mode-alist)
 
 
-;;; Handy utilities for other modes
-(eval-after-load 'flycheck
-  '(eval
-    '(progn
-       (flycheck-define-checker idris
-         "An Idris syntax and type checker."
-         :command ("idris"
-                 "--check" "--nocolor" "--warnpartial"
-                 ;; Compute the command-line options similarly to 
inferior-idris
-                 (eval (idris-compute-flags))
-                 source)
-         :error-patterns
-         ((warning line-start (file-name) ":" line ":" column ":Warning - "
-                   (message (and (* nonl) (* "\n" (not (any "/" "~")) (* 
nonl)))))
-          (error line-start (file-name) ":" line ":" column ":"
-                 (message (and (* nonl) (* "\n" (not (any "/" "~")) (* 
nonl))))))
-         :modes idris-mode)
-
-       (add-to-list 'flycheck-checkers 'idris))))
-
 (provide 'idris-mode)
 ;;; idris-mode.el ends here
diff --git a/test/test-data/Flycheck.idr b/test/test-data/Flycheck.idr
new file mode 100644
index 0000000000..88499cf468
--- /dev/null
+++ b/test/test-data/Flycheck.idr
@@ -0,0 +1,8 @@
+plus : Nat -> Nat -> Nat
+plus x y = plus x "w"
+
+data Foo : Nat -> Type where
+  F : Foo plus
+
+double : Nat -> Nat
+double x = rhs x x



reply via email to

[Prev in Thread] Current Thread [Next in Thread]