branch: externals/xr commit 018a994f9cb5d2fcd9dcfcabef40f492b7bb952b Author: Mattias Engdegård <matti...@acm.org> Commit: Mattias Engdegård <matti...@acm.org>
Warn about [[:class:]] in skip-sets This check overlaps the general "[...]" check, but neither is a subset of the other. It's possible to get both; no harm in that. --- xr-test.el | 2 ++ xr.el | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/xr-test.el b/xr-test.el index 644eedf..dbcf84c 100644 --- a/xr-test.el +++ b/xr-test.el @@ -425,6 +425,8 @@ '((2 . "Unnecessarily escaped `$'")))) (should (equal (xr-skip-set-lint "[^a-z]") '((0 . "Suspect skip set framed in `[...]'")))) + (should (equal (xr-skip-set-lint "[[:space:]].") + '((0 . "Suspect character class framed in `[...]'")))) (should (equal (xr-skip-set-lint "") '((0 . "Empty set matches nothing")))) (should (equal (xr-skip-set-lint "^") diff --git a/xr.el b/xr.el index d2a65d1..8b7c3b6 100644 --- a/xr.el +++ b/xr.el @@ -647,6 +647,11 @@ lower multibyte nonascii print punct space unibyte upper word xdigit)) (error "No character class `%s'" (match-string 0))) + ;; Another useful ad-hoc check. + (when (and (eq (char-before) ?\[) + (eq (char-after (match-end 0)) ?\])) + (xr--report warnings (1- (point)) + "Suspect character class framed in `[...]'")) (when (memq sym classes) (xr--report warnings (point) (format "Duplicated character class `%s'"