diff --git a/.github/workflows/lint-emacs.yml b/.github/workflows/lint-emacs.yml index 872a125..266add8 100644 --- a/.github/workflows/lint-emacs.yml +++ b/.github/workflows/lint-emacs.yml @@ -1,4 +1,4 @@ -name: Lint Emacs +name: CI on: push: @@ -7,7 +7,7 @@ on: paths: ['**.el'] jobs: - test: + compile: runs-on: ubuntu-latest # continue-on-error: ${{matrix.emacs_version == 'snapshot'}} @@ -25,7 +25,53 @@ jobs: run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh - name: Check out the source code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Compile the project + run: make compile + + lint: + runs-on: ubuntu-latest + # continue-on-error: ${{matrix.emacs_version == 'snapshot'}} + + strategy: + matrix: + emacs_version: ['29.1'] + + steps: + - name: Set up Emacs + uses: purcell/setup-emacs@master + with: + version: ${{matrix.emacs_version}} + + - name: Install Eldev + run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh + + - name: Check out the source code + uses: actions/checkout@v4 - name: Lint the project - run: eldev -dtT -C compile --warnings-as-errors + run: make lint + + test: + runs-on: ubuntu-latest + # continue-on-error: ${{matrix.emacs_version == 'snapshot'}} + + strategy: + matrix: + emacs_version: ['snapshot'] + + steps: + - name: Set up Emacs + uses: purcell/setup-emacs@master + with: + version: ${{matrix.emacs_version}} + + - name: Install Eldev + run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh + + - name: Check out the source code + uses: actions/checkout@v4 + + - name: Run tests + run: make test diff --git a/.gitignore b/.gitignore index 7807b63..c3df805 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ elpa* /clojure-ts-mode-autoloads.el /clojure-ts-mode-pkg.el + +/.eldev +/Eldev-local diff --git a/Eldev b/Eldev new file mode 100644 index 0000000..e6b3c00 --- /dev/null +++ b/Eldev @@ -0,0 +1,27 @@ +; -*- mode: emacs-lisp; lexical-binding: t -*- + +(eldev-require-version "1.8.2") + +(eldev-use-package-archive 'gnu-elpa) +(eldev-use-package-archive 'nongnu-elpa) + +(eldev-use-package-archive 'melpa-stable) +(eldev-use-package-archive 'melpa-unstable) + +(eldev-use-plugin 'autoloads) + +(eldev-add-extra-dependencies 'test 'buttercup) + +(setq byte-compile-docstring-max-column 240) +(setq checkdoc-force-docstrings-flag nil) +(setq checkdoc-permit-comma-termination-flag t) +(setq checkdoc--interactive-docstring-flag nil) + +(setf eldev-lint-default '(elisp)) + +(with-eval-after-load 'elisp-lint + ;; We will byte-compile with Eldev. + (setf elisp-lint-ignored-validators '("fill-column" "check-declare") + enable-local-variables :safe)) + +(setq eldev-project-main-file "clojure-ts-mode.el") diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3e61353 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +.PHONY: clean compile lint test all +.DEFAULT_GOAL := all + +clean: + eldev clean + +lint: clean + eldev lint -c + +# Checks for byte-compilation warnings. +compile: clean + eldev -dtT compile --warnings-as-errors + +test: clean + eldev -dtT -p test + +all: clean compile lint test diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el index 481a82b..0700640 100644 --- a/clojure-ts-mode.el +++ b/clojure-ts-mode.el @@ -239,9 +239,9 @@ if a third argument (the value) is provided. (defconst clojure-ts--typedef-symbol-regexp (eval-and-compile (rx line-start - (or "defprotocol" "defmulti" "deftype" "defrecord" - "definterface" "defmethod" "defstruct") - line-end)) + (or "defprotocol" "defmulti" "deftype" "defrecord" + "definterface" "defmethod" "defstruct") + line-end)) "A regular expression matching a symbol used to define a type.") (defconst clojure-ts--type-symbol-regexp @@ -773,7 +773,7 @@ forms like deftype, defrecord, reify, proxy, etc." (defun clojure-ts--match-fn-docstring (node) "Match NODE when it is a docstring for PARENT function definition node." - ;; A string that is the third node in a function defn block + ;; A string that is the third node in a function defn block (let ((parent (treesit-node-parent node))) (and (treesit-node-eq node (treesit-node-child parent 2 t)) (let ((first-auncle (treesit-node-child parent 0 t))) @@ -854,11 +854,11 @@ forms like deftype, defrecord, reify, proxy, etc." (defconst clojure-ts--thing-settings `((clojure (sexp ,(regexp-opt clojure-ts--sexp-nodes) - text ,(regexp-opt '("comment")))))) + text ,(regexp-opt '("comment")))))) (defvar clojure-ts-mode-map (let ((map (make-sparse-keymap))) - ;(set-keymap-parent map clojure-mode-map) + ;;(set-keymap-parent map clojure-mode-map) map)) (defvar clojure-ts-clojurescript-mode-map diff --git a/test/clojure-ts-mode-util-test.el b/test/clojure-ts-mode-util-test.el new file mode 100644 index 0000000..9d02bcc --- /dev/null +++ b/test/clojure-ts-mode-util-test.el @@ -0,0 +1,29 @@ +;;; clojure-ts-mode-util-test.el --- Clojure TS Mode: util test suite -*- lexical-binding: t; -*- + +;; Copyright © 2022-2024 Danny Freeman + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; The unit test suite of Clojure TS Mode + +(require 'clojure-ts-mode) +(require 'buttercup) + +(describe "clojure-ts-mode-version" + (it "should not be nil" + (expect clojure-ts-mode-version)))