summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiyue Deng <manphiz@gmail.com>2023-11-29 12:14:58 -0800
committerXiyue Deng <manphiz@gmail.com>2023-11-29 12:14:58 -0800
commit69056744d562e8da3a9094169eabe1cadb3584ea (patch)
treec1f548aea49aa739a91a762cacc6715301ac61dd
parent3cf6ed98a909fe2cbabcd2dfce391a06bf1a77db (diff)
parent25d713a67d8e0209ee74bfc0153fdf677697b43f (diff)
Merge tag 'v5.18.1'
v5.18.1 https://github.com/clojure-emacs/clojure-mode/blob/v5.18.1/CHANGELOG.md
-rw-r--r--.circleci/config.yml151
-rw-r--r--.gitignore3
-rw-r--r--CHANGELOG.md6
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--Cask9
-rw-r--r--Eldev26
-rw-r--r--Makefile47
-rw-r--r--README.md2
-rw-r--r--clojure-mode.el11
-rw-r--r--test/clojure-mode-bytecomp-warnings.el40
-rw-r--r--test/clojure-mode-convert-collection-test.el1
-rw-r--r--test/clojure-mode-font-lock-test.el25
-rw-r--r--test/clojure-mode-refactor-add-arity-test.el1
-rw-r--r--test/clojure-mode-util-test.el2
-rw-r--r--test/test-checks.el30
-rw-r--r--test/utils/test-helper.el2
16 files changed, 197 insertions, 165 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index def610e..cb2679f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,56 +1,131 @@
version: 2.1
-# Default actions to perform on each Emacs version
-default: &default-steps
- steps:
- - checkout
- - run: apt-get update && apt-get install make
- - run: make elpa
- - run: emacs --version
- - run: make test
- # Make sure to run test-checks before test-bytecomp, as test-bytecomp autogenerates
- # files which won't pass test-checks.
- - run: make test-checks
- - run: make test-bytecomp
+orbs:
+ win: circleci/windows@2.2.0
+
+commands:
+ setup:
+ steps:
+ - checkout
+ - run:
+ name: Install Eldev
+ command: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev > x.sh && source ./x.sh
+
+ setup-macos:
+ steps:
+ - checkout
+ - run:
+ name: Install Emacs latest
+ command: |
+ brew install homebrew/cask/emacs
+ - run:
+ name: Install Eldev
+ command: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev > x.sh && source ./x.sh
+
+ setup-windows:
+ steps:
+ - checkout
+ - run:
+ name: Install Eldev
+ command: |
+ # Remove expired DST Root CA X3 certificate. Workaround
+ # for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038
+ # bug on Emacs 27.2.
+ gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13
+ gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item
+ (iwr https://raw.github.com/doublep/eldev/master/webinstall/circle-eldev.ps1).Content | powershell -command -
+ test:
+ steps:
+ - run:
+ name: Run regression tests
+ command: eldev -dtT -p test
+ lint:
+ steps:
+ - run:
+ name: Lint
+ command: eldev lint -c
+ compile:
+ steps:
+ - run:
+ name: Check for byte-compilation errors
+ command: eldev -dtT compile --warnings-as-errors
-# Enumerated list of Emacs versions
jobs:
- test-emacs-25:
+ test-ubuntu-emacs-26:
docker:
- - image: silex/emacs:25-ci-cask
+ - image: silex/emacs:26-ci
entrypoint: bash
- <<: *default-steps
-
- test-emacs-26:
+ steps:
+ - setup
+ - test
+ - lint
+ - compile
+ test-ubuntu-emacs-27:
docker:
- - image: silex/emacs:26-ci-cask
+ - image: silex/emacs:27-ci
entrypoint: bash
- <<: *default-steps
-
- test-emacs-27:
+ steps:
+ - setup
+ - test
+ - lint
+ - compile
+ test-ubuntu-emacs-28:
docker:
- - image: silex/emacs:27-ci-cask
+ - image: silex/emacs:28-ci
entrypoint: bash
- <<: *default-steps
-
- test-emacs-28:
+ steps:
+ - setup
+ - test
+ - lint
+ - compile
+ test-ubuntu-emacs-29:
docker:
- - image: silex/emacs:28-ci-cask
+ - image: silex/emacs:29-ci
entrypoint: bash
- <<: *default-steps
-
- test-emacs-master:
+ steps:
+ - setup
+ - test
+ - lint
+ - compile
+ test-ubuntu-emacs-master:
docker:
- - image: silex/emacs:master-ci-cask
+ - image: silex/emacs:master-ci
entrypoint: bash
- <<: *default-steps
+ steps:
+ - setup
+ - test
+ - lint
+ - compile
+ test-macos-emacs-latest:
+ macos:
+ xcode: "14.2.0"
+ steps:
+ - setup-macos
+ - test
+ - lint
+ - compile
+ test-windows-emacs-latest:
+ executor: win/default
+ steps:
+ - run:
+ name: Install Emacs latest
+ command: |
+ choco install emacs
+ - setup-windows
+ - test
+ - lint
+ - compile
workflows:
- version: 2
+ version: 2.1
ci-test-matrix:
jobs:
- - test-emacs-25
- - test-emacs-26
- - test-emacs-27
- - test-emacs-28
- - test-emacs-master
+ - test-ubuntu-emacs-26
+ - test-ubuntu-emacs-27
+ - test-ubuntu-emacs-28
+ - test-ubuntu-emacs-29
+ - test-ubuntu-emacs-master
+ - test-windows-emacs-latest
+ - test-macos-emacs-latest:
+ requires:
+ - test-ubuntu-emacs-29
diff --git a/.gitignore b/.gitignore
index ef07d5a..360a994 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,6 @@
elpa*
/clojure-mode-autoloads.el
/clojure-mode-pkg.el
+
+/.eldev
+/Eldev-local
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 204db20..416a855 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
## master (unreleased)
+## 5.18.1 (2023-11-24)
+
+### Bugs fixed
+
+* [#653](https://github.com/clojure-emacs/clojure-mode/issues/653): Don't highlight vars with colons as keywords.
+
## 5.18.0 (2023-10-18)
### Changes
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2743702..2eada5b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -39,8 +39,8 @@ and description in grammatically correct, complete sentences.
## Development setup
1. Fork and clone the repository.
-1. Install [Cask][7].
-1. Run `cask install` in the repository folder.
+1. Install [Eldev][7].
+1. Run `eldev build` in the repository folder.
1. Run tests with `make test`.
**Note:** macOS users should make sure that the `emacs` command resolves the version of Emacs they've installed
@@ -53,5 +53,5 @@ See [this article][8] for more details.
[4]: https://help.github.com/articles/using-pull-requests
[5]: https://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
[6]: https://github.com/clojure-emacs/clojure-mode/blob/master/CHANGELOG.md
-[7]: https://github.com/cask/cask
+[7]: https://github.com/emacs-eldev/eldev
[8]: https://emacsredux.com/blog/2015/05/09/emacs-on-os-x/
diff --git a/Cask b/Cask
deleted file mode 100644
index abcd75f..0000000
--- a/Cask
+++ /dev/null
@@ -1,9 +0,0 @@
-(source gnu)
-(source melpa)
-
-(package-file "clojure-mode.el")
-
-(development
- (depends-on "s")
- (depends-on "buttercup")
- (depends-on "paredit"))
diff --git a/Eldev b/Eldev
new file mode 100644
index 0000000..1becee1
--- /dev/null
+++ b/Eldev
@@ -0,0 +1,26 @@
+; -*- mode: emacs-lisp; lexical-binding: t -*-
+
+(eldev-require-version "1.6")
+
+(eldev-use-package-archive 'gnu-elpa)
+(eldev-use-package-archive 'nongnu-elpa)
+(eldev-use-package-archive 'melpa)
+
+(eldev-use-plugin 'autoloads)
+
+(eldev-add-extra-dependencies 'test 'paredit 's '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 '("package-lint" "fill-column" "byte-compile" "checkdoc")
+ enable-local-variables :safe
+ elisp-lint-indent-specs '((define-clojure-indent . 0))))
+
+(setq eldev-project-main-file "clojure-mode.el")
diff --git a/Makefile b/Makefile
index 2750396..3e61353 100644
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,17 @@
-CASK = cask
-export EMACS ?= emacs
-EMACSFLAGS =
-
-PKGDIR := $(shell EMACS=$(EMACS) $(CASK) package-directory)
-
-SRCS = $(wildcard *.el)
-OBJS = $(SRCS:.el=.elc)
-
-.PHONY: compile test clean elpa
-
-all: compile
-
-elpa-$(EMACS):
- $(CASK) install
- $(CASK) update
- touch $@
-
-elpa: elpa-$(EMACS)
-
-elpaclean:
- rm -f elpa*
- rm -rf .cask # Clean packages installed for development
-
-compile: elpa
- $(CASK) build
+.PHONY: clean compile lint test all
+.DEFAULT_GOAL := all
clean:
- rm -f $(OBJS) clojure-mode-autoloads.el
+ eldev clean
-test: $(PKGDIR)
- $(CASK) exec buttercup
+lint: clean
+ eldev lint -c
-test-checks:
- $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
- -l test/test-checks.el ./
+# Checks for byte-compilation warnings.
+compile: clean
+ eldev -dtT compile --warnings-as-errors
-test-bytecomp: $(SRCS:.el=.elc-test)
+test: clean
+ eldev -dtT -p test
-%.elc-test: %.el elpa
- $(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
- -l test/clojure-mode-bytecomp-warnings.el $<
+all: clean compile lint test
diff --git a/README.md b/README.md
index e029765..13f949c 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ highlighting), indentation, navigation and refactoring support for the
**This documentation tracks the `master` branch of `clojure-mode`. Some of
the features and settings discussed here might not be available in
older releases (including the current stable release). Please, consult
-the relevant git tag (e.g. [5.18.0](https://github.com/clojure-emacs/clojure-mode/tree/v5.18.0)) if you need documentation for a
+the relevant git tag (e.g. [5.18.1](https://github.com/clojure-emacs/clojure-mode/tree/v5.18.1)) if you need documentation for a
specific `clojure-mode` release.**
## Installation
diff --git a/clojure-mode.el b/clojure-mode.el
index 8dda555..fba4211 100644
--- a/clojure-mode.el
+++ b/clojure-mode.el
@@ -12,7 +12,7 @@
;; Maintainer: Bozhidar Batsov <bozhidar@batsov.dev>
;; URL: https://github.com/clojure-emacs/clojure-mode
;; Keywords: languages clojure clojurescript lisp
-;; Version: 5.18.0
+;; Version: 5.18.1
;; Package-Requires: ((emacs "25.1"))
;; This file is not part of GNU Emacs.
@@ -1072,12 +1072,13 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
;; keywords: {:oneword/ve/yCom|pLex.stu-ff 0}
(,(concat "\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "?\\)\\(/\\)"
"\\(" clojure--keyword-sym-regexp "\\)")
+ ;; with ns
(1 'clojure-keyword-face)
(2 font-lock-type-face)
- ;; (2 'clojure-keyword-face)
(3 'default)
(4 'clojure-keyword-face))
- (,(concat "\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "\\)")
+ (,(concat "\\<\\(:\\{1,2\\}\\)\\(" clojure--keyword-sym-regexp "\\)")
+ ;; without ns
(1 'clojure-keyword-face)
(2 'clojure-keyword-face))
@@ -3129,7 +3130,7 @@ Assumes cursor is at beginning of function."
"Add an arity to a function.
Assumes cursor is at beginning of function."
- (let ((beg-line (what-line))
+ (let ((beg-line (line-number-at-pos))
(end (save-excursion (forward-sexp)
(point))))
(down-list 2)
@@ -3141,7 +3142,7 @@ Assumes cursor is at beginning of function."
(insert "[")
(save-excursion (insert "])\n(")))
((looking-back "\\[" 1) ;; single-arity fn
- (let* ((same-line (string= beg-line (what-line)))
+ (let* ((same-line (= beg-line (line-number-at-pos)))
(new-arity-text (concat (when same-line "\n") "([")))
(save-excursion
(goto-char end)
diff --git a/test/clojure-mode-bytecomp-warnings.el b/test/clojure-mode-bytecomp-warnings.el
deleted file mode 100644
index 41b3230..0000000
--- a/test/clojure-mode-bytecomp-warnings.el
+++ /dev/null
@@ -1,40 +0,0 @@
-;;; clojure-mode-bytecomp-warnings.el --- Check for byte-compilation problems -*- lexical-binding: t; -*-
-
-;; Copyright © 2012-2021 Bozhidar Batsov and contributors
-;;
-;; 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 <https://www.gnu.org/licenses/>.
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; This is a script to be loaded while visiting a `clojure-mode' source file.
-;; It will prepare all requirements and then byte-compile the file and signal an
-;; error on any warning. For example:
-;;
-;; emacs -Q --batch -l test/clojure-mode-bytecomp-warnings.el clojure-mode.el
-
-;; This assumes that all `clojure-mode' dependencies are already on the package
-;; dir (probably from running `cask install').
-
-(setq load-prefer-newer t)
-(add-to-list 'load-path (expand-file-name "./"))
-(require 'package)
-(package-generate-autoloads 'clojure-mode default-directory)
-(package-initialize)
-(load-file "clojure-mode-autoloads.el")
-(setq byte-compile-error-on-warn t)
-(batch-byte-compile)
-
-;;; clojure-mode-bytecomp-warnings.el ends here
diff --git a/test/clojure-mode-convert-collection-test.el b/test/clojure-mode-convert-collection-test.el
index 28c5977..14e5291 100644
--- a/test/clojure-mode-convert-collection-test.el
+++ b/test/clojure-mode-convert-collection-test.el
@@ -27,6 +27,7 @@
(require 'clojure-mode)
(require 'buttercup)
+(require 'test-helper "test/utils/test-helper")
(describe "clojure-convert-collection-to-map"
(when-refactoring-it "should convert a list to a map"
diff --git a/test/clojure-mode-font-lock-test.el b/test/clojure-mode-font-lock-test.el
index bb6ef74..5e578ba 100644
--- a/test/clojure-mode-font-lock-test.el
+++ b/test/clojure-mode-font-lock-test.el
@@ -262,6 +262,13 @@ DESCRIPTION is the description of the spec."
(9 10 nil)
(11 16 nil))
+ ("(colons:are:okay)"
+ (2 16 nil))
+
+ ("(some-ns/colons:are:okay)"
+ (2 8 font-lock-type-face)
+ (9 24 nil))
+
("(oneword/ve/yCom|pLex.stu-ff)"
(2 8 font-lock-type-face)
(9 10 nil)
@@ -715,6 +722,19 @@ DESCRIPTION is the description of the spec."
(10 10 default)
(11 30 clojure-keyword-face)))
+ (when-fontifying-it "should handle keywords with colons"
+ (":a:a"
+ (1 4 clojure-keyword-face))
+
+ (":a:a/:a"
+ (1 7 clojure-keyword-face))
+
+ ("::a:a"
+ (1 5 clojure-keyword-face))
+
+ ("::a.a:a"
+ (1 7 clojure-keyword-face)))
+
(when-fontifying-it "should handle very complex keywords"
(" :ve/yCom|pLex.stu-ff"
(3 4 font-lock-type-face)
@@ -824,7 +844,10 @@ DESCRIPTION is the description of the spec."
(when-fontifying-it "should handle variables defined with def"
("(def foo 10)"
(2 4 font-lock-keyword-face)
- (6 8 font-lock-variable-name-face)))
+ (6 8 font-lock-variable-name-face))
+ ("(def foo:bar 10)"
+ (2 4 font-lock-keyword-face)
+ (6 12 font-lock-variable-name-face)))
(when-fontifying-it "should handle variables definitions of type string"
("(def foo \"hello\")"
diff --git a/test/clojure-mode-refactor-add-arity-test.el b/test/clojure-mode-refactor-add-arity-test.el
index 9c75f12..5f1c5fb 100644
--- a/test/clojure-mode-refactor-add-arity-test.el
+++ b/test/clojure-mode-refactor-add-arity-test.el
@@ -24,6 +24,7 @@
(require 'clojure-mode)
(require 'buttercup)
+(require 'test-helper "test/utils/test-helper")
(describe "clojure-add-arity"
diff --git a/test/clojure-mode-util-test.el b/test/clojure-mode-util-test.el
index 565773d..6157a3d 100644
--- a/test/clojure-mode-util-test.el
+++ b/test/clojure-mode-util-test.el
@@ -46,7 +46,7 @@
(bb-edn-src (expand-file-name "src" temp-dir)))
(write-region "{}" nil bb-edn)
(make-directory bb-edn-src)
- (expect (clojure-project-dir bb-edn-src)
+ (expect (expand-file-name (clojure-project-dir bb-edn-src))
:to-equal (file-name-as-directory temp-dir))))))
(describe "clojure-project-relative-path"
diff --git a/test/test-checks.el b/test/test-checks.el
deleted file mode 100644
index a4b4208..0000000
--- a/test/test-checks.el
+++ /dev/null
@@ -1,30 +0,0 @@
-;; This is a script to be loaded from the root `clojure-mode' directory. It will -*- lexical-binding: t; -*-
-;; prepare all requirements and then run `check-declare-directory' on
-;; `default-directory'. For example: emacs -Q --batch -l test/test-checkdoc.el
-
-;; This assumes that all `clojure-mode' dependencies are already on the package
-;; dir (probably from running `cask install').
-
-(add-to-list 'load-path (expand-file-name "./"))
-(require 'package)
-(require 'check-declare)
-(package-initialize)
-
-;; disable some annoying (or non-applicable) checkdoc checks
-(setq checkdoc-package-keywords-flag nil)
-(setq checkdoc-arguments-in-order-flag nil)
-(setq checkdoc-verb-check-experimental-flag nil)
-
-(let ((files (directory-files default-directory t
- "\\`[^.].*\\.el\\'" t)))
-
- ;; `checkdoc-file' was introduced in Emacs 25
- (when (fboundp 'checkdoc-file)
- (dolist (file files)
- (checkdoc-file file))
- (when (get-buffer "*Warnings*")
- (message "Failing due to checkdoc warnings...")
- (kill-emacs 1)))
-
- (when (apply #'check-declare-files files)
- (kill-emacs 1)))
diff --git a/test/utils/test-helper.el b/test/utils/test-helper.el
index b359277..e7894f0 100644
--- a/test/utils/test-helper.el
+++ b/test/utils/test-helper.el
@@ -26,7 +26,7 @@
(message "Running tests on Emacs %s" emacs-version)
(let* ((current-file (if load-in-progress load-file-name (buffer-file-name)))
- (source-directory (locate-dominating-file current-file "Cask"))
+ (source-directory (locate-dominating-file current-file "Eldev"))
;; Do not load outdated byte code for tests
(load-prefer-newer t))
;; Load the file under test