branch: externals/xr commit a948847b2f527a0d19a9db3f5348516304786f32 Author: Mattias Engdegård <matti...@acm.org> Commit: Mattias Engdegård <matti...@acm.org>
Don't complain about [z-a] z-a is much more likely to be an empty range on purpose than a mistake. In particular, [^z-a] is occasionally seen as a (arguably misguided) expression for matching any character. --- xr-test.el | 2 ++ xr.el | 2 ++ 2 files changed, 4 insertions(+) diff --git a/xr-test.el b/xr-test.el index 17b0b09..fd36db2 100644 --- a/xr-test.el +++ b/xr-test.el @@ -342,6 +342,8 @@ (should (equal (xr-lint "[]-Qa-fz-t]") '((1 . "Reversed range `]-Q' matches nothing") (7 . "Reversed range `z-t' matches nothing")))) + (should (equal (xr-lint "[z-a][^z-a]") + nil)) (should (equal (xr-lint "[^A-FFGI-LI-Mb-da-eg-ki-ns-t33-7]") '((5 . "Character `F' included in range `A-F'") (10 . "Ranges `I-L' and `I-M' overlap") diff --git a/xr.el b/xr.el index 55465e9..e76b150 100644 --- a/xr.el +++ b/xr.el @@ -126,6 +126,8 @@ (cond ((<= start end) (push (vector start end (point)) intervals)) + ;; It's unlikely that anyone writes z-a by mistake; don't complain. + ((and (eq start ?z) (eq end ?a))) (t (xr--report warnings (point) (format "Reversed range `%s' matches nothing"