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

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

[elpa] externals/xr f1afeff 1/5: Add check for `[...]'-framed skip sets


From: Mattias Engdegård
Subject: [elpa] externals/xr f1afeff 1/5: Add check for `[...]'-framed skip sets
Date: Thu, 21 Mar 2019 09:23:02 -0400 (EDT)

branch: externals/xr
commit f1afeff68c1fb2e52da2f7f6e899801ef96b9349
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Add check for `[...]'-framed skip sets
    
    This seems to be a particularly common misunderstanding of skip set
    syntax.
    Increment version to 1.8.
---
 xr-test.el | 4 +++-
 xr.el      | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xr-test.el b/xr-test.el
index 860070c..17b0b09 100644
--- a/xr-test.el
+++ b/xr-test.el
@@ -413,7 +413,9 @@
                    (14 . "Duplicated character `!'")
                    (14 . "Unnecessarily escaped `!'")
                    (16 . "Character `b' included in range `a-z'"))))
-  )
+  (should (equal (xr-skip-set-lint "[^a-z]")
+                 '((0 . "Suspect skip set framed in `[...]'"))))
+)
 
 (provide 'xr-test)
 
diff --git a/xr.el b/xr.el
index 2d1eff8..410de13 100644
--- a/xr.el
+++ b/xr.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2019 Free Software Foundation, Inc.
 
 ;; Author: Mattias Engdegård <address@hidden>
-;; Version: 1.7
+;; Version: 1.8
 ;; Keywords: lisp, maint, regexps
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -619,6 +619,10 @@
 ;; - an end is only `\' if last in the string
 
 (defun xr--parse-skip-set-buffer (warnings)
+  ;; An ad-hoc check, but one that catches lots of mistakes.
+  (when (and (looking-at (rx "[" (one-or-more anything) "]" eos))
+             (not (looking-at (rx "[:" (one-or-more anything) ":]" eos))))
+    (xr--report warnings (point) "Suspect skip set framed in `[...]'"))
   (let ((negated (looking-at (rx "^")))
         (ranges nil)
         (classes nil))



reply via email to

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