[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xr c88fb0e 3/9: Use text quoting for all messages
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/xr c88fb0e 3/9: Use text quoting for all messages |
Date: |
Sat, 29 Feb 2020 17:22:11 -0500 (EST) |
branch: externals/xr
commit c88fb0e4165fdd5dc9b424fcc21f9349232949c7
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Use text quoting for all messages
Use format-message to convert the backquote-quote quoting to the
appropriate text-quoting-style.
---
xr-test.el | 295 +++++++++++++++++++++++++++++++------------------------------
xr.el | 109 ++++++++++++++---------
2 files changed, 214 insertions(+), 190 deletions(-)
diff --git a/xr-test.el b/xr-test.el
index 0688001..e0d00b9 100644
--- a/xr-test.el
+++ b/xr-test.el
@@ -340,117 +340,119 @@
)
(ert-deftest xr-lint ()
- (should (equal (xr-lint "^a*\\[\\?\\$\\(b\\{3\\}\\|c\\)[^]\\a-d^-]$")
- nil))
- (should (equal (xr-lint "a^b$c")
- '((1 . "Unescaped literal `^'")
- (3 . "Unescaped literal `$'"))))
- (should (equal (xr-lint "^**$")
- '((1 . "Unescaped literal `*'"))))
- (should (equal (xr-lint "a[\\\\[]")
- '((3 . "Duplicated `\\' inside character alternative"))))
- (should (equal (xr-lint "\\{\\(+\\|?\\)\\[\\]\\}\\\t")
- '((0 . "Escaped non-special character `{'")
- (4 . "Unescaped literal `+'")
- (7 . "Unescaped literal `?'")
- (14 . "Escaped non-special character `}'")
- (16 . "Escaped non-special character `\\t'"))))
- (should (equal (xr-lint "\\}\\w\\a\\b\\%")
- '((0 . "Escaped non-special character `}'")
- (4 . "Escaped non-special character `a'")
- (8 . "Escaped non-special character `%'"))))
- (should (equal (xr-lint "a?+b+?\\(?:c?\\)*d\\{3\\}+e*?\\{2,5\\}")
- '((2 . "Repetition of repetition")
- (14 . "Repetition of repetition")
- (25 . "Repetition of repetition"))))
- (should (equal (xr-lint "\\(a*\\)*\\(b+\\)*\\(c*\\)?\\(d+\\)?")
- '((6 . "Repetition of repetition")
- (13 . "Repetition of repetition")
- (20 . "Repetition of repetition"))))
- (should (equal (xr-lint "\\(e*\\)\\{3\\}")
- '((6 . "Repetition of repetition"))))
- (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")
- (16 . "Ranges `a-e' and `b-d' overlap")
- (22 . "Ranges `g-k' and `i-n' overlap")
- (25 . "Two-character range `s-t'")
- (29 . "Character `3' included in range `3-7'"))))
- (should (equal (xr-lint "[a[:digit:]b[:punct:]c[:digit:]]")
- '((22 . "Duplicated character class `[:digit:]'"))))
- (should (equal (xr-lint "a*\\|b+\\|\\(?:a\\)*")
- '((8 . "Duplicated alternative branch"))))
- (should (equal (xr-lint "a\\{,\\}")
- '((1 . "Uncounted repetition"))))
- (should (equal (xr-lint "a\\{\\}")
- '((1 . "Implicit zero repetition"))))
- (should (equal (xr-lint "[0-9[|]*/]")
- '((4 . "Suspect `[' in char alternative"))))
- (should (equal (xr-lint "[^][-].]")
- nil))
- (should (equal (xr-lint "[0-1]")
- nil))
- (should (equal (xr-lint "[^]-][]-^]")
- '((6 . "Two-character range `]-^'"))))
- (should (equal
- (xr-lint "[-A-Z][A-Z-][A-Z-a][^-A-Z][]-a][A-Z---.]")
- '((16 . "Literal `-' not first or last in character alternative"))))
- (should (equal
- (xr-lint "\\(?:a*b?\\)*\\(c\\|d\\|\\)+\\(^\\|e\\)*\\(?:\\)*")
- '((10 . "Repetition of expression matching an empty string")
- (21 . "Repetition of expression matching an empty string"))))
- (should (equal (xr-lint "\\'*\\<?\\(?:$\\)+")
- '((2 . "Repetition of zero-width assertion")
- (5 . "Repetition of zero-width assertion")
- (13 . "Repetition of zero-width assertion"))))
- (should (equal (xr-lint "a.cde*f?g\\|g\\|abcdefg")
- '((14 . "Branch matches subset of a previous branch"))))
- (should (equal (xr-lint "abcd\\|e\\|[aA].[^0-9z]d")
- '((9 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint "\\(?:\\(a\\)\\|.\\)\\(?:a\\|\\(.\\)\\)")
- '((21 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint ".\\|\n\\|\r")
- '((6 . "Branch matches subset of a previous branch"))))
- (should (equal (xr-lint "[^mM]\\|[^a-zA-Z]")
- '((7 . "Branch matches subset of a previous branch"))))
- (should (equal (xr-lint "[^mM]\\|[^A-LN-Z]")
- nil))
- (should (equal (xr-lint "[ab]\\|[^bcd]")
- nil))
- (should (equal (xr-lint "[ab]\\|[^cd]")
- '((6 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint ".\\|[a\n]")
- nil))
- (should (equal (xr-lint ".\\|[[:space:]\r]")
- '((3 . "Branch matches subset of a previous branch"))))
- (should (equal (xr-lint "ab?c+\\|a?b*c*")
- '((7 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint "\\(?:[aA]\\|b\\)\\|a")
- '((15 . "Branch matches subset of a previous branch"))))
- (should (equal (xr-lint "\\(?:a\\|b\\)\\|[abc]")
- '((12 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint "\\(?:a\\|b\\)\\|\\(?:[abd]\\|[abc]\\)")
- '((12 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint "ab\\|abc?")
- '((4 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint "abc\\|abcd*e?")
- '((5 . "Branch matches superset of a previous branch"))))
- (should (equal (xr-lint "[ab]+a?,a?[ab]+,[ab]*a*,a*[ab]*")
- '((6 . "Repetition subsumed by preceding repetition")
- (14 . "Repetition subsumes preceding repetition")
- (22 . "Repetition subsumed by preceding repetition")
- (30 . "Repetition subsumes preceding repetition"))))
- (should (equal (xr-lint "[^a]+b*,a?.*,a*a*,a*a+")
- '((6 . "Repetition subsumed by preceding repetition")
- (11 . "Repetition subsumes preceding repetition")
- (16 . "Repetition subsumed by preceding repetition")
- (21 . "Repetition subsumes preceding repetition"))))
- )
+ (let ((text-quoting-style 'grave))
+ (should (equal (xr-lint "^a*\\[\\?\\$\\(b\\{3\\}\\|c\\)[^]\\a-d^-]$")
+ nil))
+ (should (equal (xr-lint "a^b$c")
+ '((1 . "Unescaped literal `^'")
+ (3 . "Unescaped literal `$'"))))
+ (should (equal (xr-lint "^**$")
+ '((1 . "Unescaped literal `*'"))))
+ (should (equal (xr-lint "a[\\\\[]")
+ '((3 . "Duplicated `\\' inside character alternative"))))
+ (should (equal (xr-lint "\\{\\(+\\|?\\)\\[\\]\\}\\\t")
+ '((0 . "Escaped non-special character `{'")
+ (4 . "Unescaped literal `+'")
+ (7 . "Unescaped literal `?'")
+ (14 . "Escaped non-special character `}'")
+ (16 . "Escaped non-special character `\\t'"))))
+ (should (equal (xr-lint "\\}\\w\\a\\b\\%")
+ '((0 . "Escaped non-special character `}'")
+ (4 . "Escaped non-special character `a'")
+ (8 . "Escaped non-special character `%'"))))
+ (should (equal (xr-lint "a?+b+?\\(?:c?\\)*d\\{3\\}+e*?\\{2,5\\}")
+ '((2 . "Repetition of repetition")
+ (14 . "Repetition of repetition")
+ (25 . "Repetition of repetition"))))
+ (should (equal (xr-lint "\\(a*\\)*\\(b+\\)*\\(c*\\)?\\(d+\\)?")
+ '((6 . "Repetition of repetition")
+ (13 . "Repetition of repetition")
+ (20 . "Repetition of repetition"))))
+ (should (equal (xr-lint "\\(e*\\)\\{3\\}")
+ '((6 . "Repetition of repetition"))))
+ (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")
+ (16 . "Ranges `a-e' and `b-d' overlap")
+ (22 . "Ranges `g-k' and `i-n' overlap")
+ (25 . "Two-character range `s-t'")
+ (29 . "Character `3' included in range `3-7'"))))
+ (should (equal (xr-lint "[a[:digit:]b[:punct:]c[:digit:]]")
+ '((22 . "Duplicated character class `[:digit:]'"))))
+ (should (equal (xr-lint "a*\\|b+\\|\\(?:a\\)*")
+ '((8 . "Duplicated alternative branch"))))
+ (should (equal (xr-lint "a\\{,\\}")
+ '((1 . "Uncounted repetition"))))
+ (should (equal (xr-lint "a\\{\\}")
+ '((1 . "Implicit zero repetition"))))
+ (should (equal (xr-lint "[0-9[|]*/]")
+ '((4 . "Suspect `[' in char alternative"))))
+ (should (equal (xr-lint "[^][-].]")
+ nil))
+ (should (equal (xr-lint "[0-1]")
+ nil))
+ (should (equal (xr-lint "[^]-][]-^]")
+ '((6 . "Two-character range `]-^'"))))
+ (should (equal
+ (xr-lint "[-A-Z][A-Z-][A-Z-a][^-A-Z][]-a][A-Z---.]")
+ '((16 .
+ "Literal `-' not first or last in character alternative"))))
+ (should (equal
+ (xr-lint "\\(?:a*b?\\)*\\(c\\|d\\|\\)+\\(^\\|e\\)*\\(?:\\)*")
+ '((10 . "Repetition of expression matching an empty string")
+ (21 . "Repetition of expression matching an empty string"))))
+ (should (equal (xr-lint "\\'*\\<?\\(?:$\\)+")
+ '((2 . "Repetition of zero-width assertion")
+ (5 . "Repetition of zero-width assertion")
+ (13 . "Repetition of zero-width assertion"))))
+ (should (equal (xr-lint "a.cde*f?g\\|g\\|abcdefg")
+ '((14 . "Branch matches subset of a previous branch"))))
+ (should (equal (xr-lint "abcd\\|e\\|[aA].[^0-9z]d")
+ '((9 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint "\\(?:\\(a\\)\\|.\\)\\(?:a\\|\\(.\\)\\)")
+ '((21 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint ".\\|\n\\|\r")
+ '((6 . "Branch matches subset of a previous branch"))))
+ (should (equal (xr-lint "[^mM]\\|[^a-zA-Z]")
+ '((7 . "Branch matches subset of a previous branch"))))
+ (should (equal (xr-lint "[^mM]\\|[^A-LN-Z]")
+ nil))
+ (should (equal (xr-lint "[ab]\\|[^bcd]")
+ nil))
+ (should (equal (xr-lint "[ab]\\|[^cd]")
+ '((6 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint ".\\|[a\n]")
+ nil))
+ (should (equal (xr-lint ".\\|[[:space:]\r]")
+ '((3 . "Branch matches subset of a previous branch"))))
+ (should (equal (xr-lint "ab?c+\\|a?b*c*")
+ '((7 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint "\\(?:[aA]\\|b\\)\\|a")
+ '((15 . "Branch matches subset of a previous branch"))))
+ (should (equal (xr-lint "\\(?:a\\|b\\)\\|[abc]")
+ '((12 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint "\\(?:a\\|b\\)\\|\\(?:[abd]\\|[abc]\\)")
+ '((12 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint "ab\\|abc?")
+ '((4 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint "abc\\|abcd*e?")
+ '((5 . "Branch matches superset of a previous branch"))))
+ (should (equal (xr-lint "[ab]+a?,a?[ab]+,[ab]*a*,a*[ab]*")
+ '((6 . "Repetition subsumed by preceding repetition")
+ (14 . "Repetition subsumes preceding repetition")
+ (22 . "Repetition subsumed by preceding repetition")
+ (30 . "Repetition subsumes preceding repetition"))))
+ (should (equal (xr-lint "[^a]+b*,a?.*,a*a*,a*a+")
+ '((6 . "Repetition subsumed by preceding repetition")
+ (11 . "Repetition subsumes preceding repetition")
+ (16 . "Repetition subsumed by preceding repetition")
+ (21 . "Repetition subsumes preceding repetition"))))
+ ))
(ert-deftest xr-skip-set ()
(should (equal (xr-skip-set "0-9a-fA-F+*")
@@ -490,41 +492,42 @@
)
(ert-deftest xr-skip-set-lint ()
- (should (equal (xr-skip-set-lint "A[:ascii:]B[:space:][:ascii:]")
- '((20 . "Duplicated character class `[:ascii:]'"))))
- (should (equal (xr-skip-set-lint "a\\bF-AM-M\\")
- '((1 . "Unnecessarily escaped `b'")
- (3 . "Reversed range `F-A'")
- (6 . "Single-element range `M-M'")
- (9 . "Stray `\\' at end of string"))))
- (should (equal (xr-skip-set-lint "A-Fa-z3D-KM-N!3-7\\!b")
- '((7 . "Ranges `A-F' and `D-K' overlap")
- (10 . "Two-element range `M-N'")
- (14 . "Range `3-7' includes character `3'")
- (17 . "Duplicated character `!'")
- (17 . "Unnecessarily escaped `!'")
- (19 . "Character `b' included in range `a-z'"))))
- (should (equal (xr-skip-set-lint "!-\\$")
- '((2 . "Unnecessarily escaped `$'"))))
- (should (equal (xr-skip-set-lint "[^a-z]")
- '((0 . "Suspect skip set framed in `[...]'"))))
- (should (equal (xr-skip-set-lint "[0-9]+")
- '((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 "^")
- '((0 . "Negated empty set matches anything"))))
- (should (equal (xr-skip-set-lint "A-Z-")
- nil))
- (should (equal (xr-skip-set-lint "-A-Z")
- nil))
- (should (equal (xr-skip-set-lint "^-A-Z")
- nil))
- (should (equal (xr-skip-set-lint "A-Z-z")
- '((3 . "Literal `-' not first or last"))))
-)
+ (let ((text-quoting-style 'grave))
+ (should (equal (xr-skip-set-lint "A[:ascii:]B[:space:][:ascii:]")
+ '((20 . "Duplicated character class `[:ascii:]'"))))
+ (should (equal (xr-skip-set-lint "a\\bF-AM-M\\")
+ '((1 . "Unnecessarily escaped `b'")
+ (3 . "Reversed range `F-A'")
+ (6 . "Single-element range `M-M'")
+ (9 . "Stray `\\' at end of string"))))
+ (should (equal (xr-skip-set-lint "A-Fa-z3D-KM-N!3-7\\!b")
+ '((7 . "Ranges `A-F' and `D-K' overlap")
+ (10 . "Two-element range `M-N'")
+ (14 . "Range `3-7' includes character `3'")
+ (17 . "Duplicated character `!'")
+ (17 . "Unnecessarily escaped `!'")
+ (19 . "Character `b' included in range `a-z'"))))
+ (should (equal (xr-skip-set-lint "!-\\$")
+ '((2 . "Unnecessarily escaped `$'"))))
+ (should (equal (xr-skip-set-lint "[^a-z]")
+ '((0 . "Suspect skip set framed in `[...]'"))))
+ (should (equal (xr-skip-set-lint "[0-9]+")
+ '((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 "^")
+ '((0 . "Negated empty set matches anything"))))
+ (should (equal (xr-skip-set-lint "A-Z-")
+ nil))
+ (should (equal (xr-skip-set-lint "-A-Z")
+ nil))
+ (should (equal (xr-skip-set-lint "^-A-Z")
+ nil))
+ (should (equal (xr-skip-set-lint "A-Z-z")
+ '((3 . "Literal `-' not first or last"))))
+ ))
(provide 'xr-test)
diff --git a/xr.el b/xr.el
index 99cac70..6409554 100644
--- a/xr.el
+++ b/xr.el
@@ -139,12 +139,14 @@
(if (>= end ?\])
(push (vector ?\] end (point)) intervals)
(xr--report warnings (point)
- (format "Reversed range `%s' matches nothing"
- (xr--escape-string (match-string 0) nil))))
+ (format-message
+ "Reversed range `%s' matches nothing"
+ (xr--escape-string (match-string 0) nil))))
(when (eq end ?^)
(xr--report warnings (point)
- (format "Two-character range `%s'"
- (xr--escape-string (match-string 0) nil)))))
+ (format-message
+ "Two-character range `%s'"
+ (xr--escape-string (match-string 0) nil)))))
(goto-char (match-end 0)))
;; Initial ]
((looking-at "]")
@@ -163,7 +165,8 @@
(error "No character class `%s'" (match-string 0)))
(if (memq sym classes)
(xr--report warnings (point)
- (format "Duplicated character class `[:%s:]'" sym))
+ (format-message
+ "Duplicated character class `[:%s:]'" sym))
(push sym classes))
(goto-char (match-end 0))))
;; character range
@@ -177,14 +180,16 @@
((and (eq start ?z) (eq end ?a)))
(t
(xr--report warnings (point)
- (format "Reversed range `%s' matches nothing"
- (xr--escape-string (match-string 0) nil)))))
+ (format-message
+ "Reversed range `%s' matches nothing"
+ (xr--escape-string (match-string 0) nil)))))
;; Suppress warnings about ranges between adjacent digits,
;; like [0-1], as they are common and harmless.
(when (and (= end (1+ start)) (not (<= ?0 start end ?9)))
(xr--report warnings (point)
- (format "Two-character range `%s'"
- (xr--escape-string (match-string 0) nil))))
+ (format-message
+ "Two-character range `%s'"
+ (xr--escape-string (match-string 0) nil))))
(goto-char (match-end 0))))
((looking-at (rx eos))
(error "Unterminated character alternative"))
@@ -205,12 +210,13 @@
(not (and intervals
(eq (aref (car (last intervals)) 0) ?\]))))
(xr--report warnings (point)
- "Suspect `[' in char alternative"))
+ (format-message "Suspect `[' in char alternative")))
(when (and (looking-at (rx "-" (not (any "]"))))
(> (point) start-pos))
(xr--report
warnings (point)
- "Literal `-' not first or last in character alternative"))
+ (format-message
+ "Literal `-' not first or last in character alternative")))
(push (vector ch ch (point)) intervals))
(forward-char 1))))
@@ -231,33 +237,37 @@
((and (eq (aref this 0) (aref this 1))
(eq (aref next 0) (aref next 1)))
(setcdr s (cddr s))
- (format "Duplicated `%c' inside character alternative"
- (aref this 0)))
+ (format-message
+ "Duplicated `%c' inside character alternative"
+ (aref this 0)))
;; Duplicate range: drop it and warn.
((and (eq (aref this 0) (aref next 0))
(eq (aref this 1) (aref next 1)))
(setcdr s (cddr s))
- (format "Duplicated `%c-%c' inside character alternative"
- (aref this 0) (aref this 1)))
+ (format-message
+ "Duplicated `%c-%c' inside character alternative"
+ (aref this 0) (aref this 1)))
;; Character in range: drop it and warn.
((eq (aref this 0) (aref this 1))
(setcar s next)
(setcdr s (cddr s))
- (format "Character `%c' included in range `%c-%c'"
- (aref this 0) (aref next 0) (aref next 1)))
+ (format-message
+ "Character `%c' included in range `%c-%c'"
+ (aref this 0) (aref next 0) (aref next 1)))
;; Same but other way around.
((eq (aref next 0) (aref next 1))
(setcdr s (cddr s))
- (format "Character `%c' included in range `%c-%c'"
- (aref next 0) (aref this 0) (aref this 1)))
+ (format-message
+ "Character `%c' included in range `%c-%c'"
+ (aref next 0) (aref this 0) (aref this 1)))
;; Overlapping ranges: merge and warn.
(t
(let ((this-end (aref this 1)))
(aset this 1 (max (aref this 1) (aref next 1)))
(setcdr s (cddr s))
- (format "Ranges `%c-%c' and `%c-%c' overlap"
- (aref this 0) this-end
- (aref next 0) (aref next 1)))))))
+ (format-message "Ranges `%c-%c' and `%c-%c' overlap"
+ (aref this 0) this-end
+ (aref next 0) (aref next 1)))))))
(xr--report warnings (max (aref this 2) (aref next 2))
(xr--escape-string message nil)))))
(setq s (cdr s)))
@@ -476,7 +486,8 @@ UPPER may be nil, meaning infinity."
(forward-char 1)
(if (null sequence)
(push 'bol sequence)
- (xr--report warnings (match-beginning 0) "Unescaped literal `^'")
+ (xr--report warnings (match-beginning 0)
+ (format-message "Unescaped literal `^'"))
(push "^" sequence)))
;; $ - only special at end of sequence
@@ -484,7 +495,8 @@ UPPER may be nil, meaning infinity."
(forward-char 1)
(if (looking-at (rx (or "\\|" "\\)" eos)))
(push 'eol sequence)
- (xr--report warnings (match-beginning 0) "Unescaped literal `$'")
+ (xr--report warnings (match-beginning 0)
+ (format-message "Unescaped literal `$'"))
(push "$" sequence)))
;; * ? + (and non-greedy variants)
@@ -534,7 +546,7 @@ UPPER may be nil, meaning infinity."
(let ((literal (match-string 1)))
(goto-char (match-end 1))
(xr--report warnings (match-beginning 0)
- (format "Unescaped literal `%s'" literal))
+ (format-message "Unescaped literal `%s'" literal))
(push literal sequence))))
;; \{..\} - not special at beginning of sequence or after ^
@@ -693,7 +705,7 @@ UPPER may be nil, meaning infinity."
;; Note that we do not warn about \\], since the symmetry with \\[
;; makes it unlikely to be a serious error.
(xr--report warnings (match-beginning 0)
- (format "Escaped non-special character `%s'"
+ (format-message "Escaped non-special character `%s'"
(xr--escape-string (match-string 2) nil)))))
(t (error "Backslash at end of regexp")))
@@ -1016,7 +1028,8 @@ single-character strings."
(opt "?"))
eos))
(not (looking-at (rx "[:" (one-or-more anything) ":]" eos))))
- (xr--report warnings (point) "Suspect skip set framed in `[...]'"))
+ (xr--report warnings (point)
+ (format-message "Suspect skip set framed in `[...]'")))
(let ((negated (looking-at (rx "^")))
(start-pos (point))
@@ -1038,11 +1051,12 @@ single-character strings."
(when (and (eq (char-before) ?\[)
(eq (char-after (match-end 0)) ?\]))
(xr--report warnings (1- (point))
- "Suspect character class framed in `[...]'"))
+ (format-message
+ "Suspect character class framed in `[...]'")))
(when (memq sym classes)
(xr--report warnings (point)
- (format "Duplicated character class `%s'"
- (match-string 0))))
+ (format-message "Duplicated character class `%s'"
+ (match-string 0))))
(push sym classes)))
((looking-at (rx (or (seq "\\" (group anything))
@@ -1060,32 +1074,37 @@ single-character strings."
(not (memq start '(?^ ?- ?\\))))
(xr--report warnings (point)
(xr--escape-string
- (format "Unnecessarily escaped `%c'" start) nil)))
+ (format-message "Unnecessarily escaped `%c'" start)
+ nil)))
(when (and (match-beginning 3)
(not (memq end '(?^ ?- ?\\))))
(xr--report warnings (1- (match-beginning 3))
(xr--escape-string
- (format "Unnecessarily escaped `%c'" end) nil)))
+ (format-message "Unnecessarily escaped `%c'" end)
+ nil)))
(when (and (eq start ?-)
(not end)
(match-beginning 2)
(< start-pos (point) (1- (point-max))))
(xr--report warnings (point)
- "Literal `-' not first or last"))
+ (format-message "Literal `-' not first or last")))
(if (and end (> start end))
(xr--report warnings (point)
(xr--escape-string
- (format "Reversed range `%c-%c'" start end) nil))
+ (format-message "Reversed range `%c-%c'" start end)
+ nil))
(cond
((eq start end)
(xr--report warnings (point)
(xr--escape-string
- (format "Single-element range `%c-%c'" start end)
+ (format-message "Single-element range `%c-%c'"
+ start end)
nil)))
((eq (1+ start) end)
(xr--report warnings (point)
(xr--escape-string
- (format "Two-element range `%c-%c'" start end)
+ (format-message "Two-element range `%c-%c'"
+ start end)
nil))))
(let ((tail ranges))
(while tail
@@ -1096,18 +1115,20 @@ single-character strings."
(cond
((and end (< start end)
(< (car range) (cdr range)))
- (format "Ranges `%c-%c' and `%c-%c' overlap"
- (car range) (cdr range) start end))
+ (format-message
+ "Ranges `%c-%c' and `%c-%c' overlap"
+ (car range) (cdr range) start end))
((and end (< start end))
- (format "Range `%c-%c' includes character `%c'"
- start end (car range)))
+ (format-message
+ "Range `%c-%c' includes character `%c'"
+ start end (car range)))
((< (car range) (cdr range))
- (format
+ (format-message
"Character `%c' included in range `%c-%c'"
start (car range) (cdr range)))
(t
- (format "Duplicated character `%c'"
- start)))))
+ (format-message "Duplicated character `%c'"
+ start)))))
(xr--report warnings (point)
(xr--escape-string msg nil))
;; Expand previous interval to include this range.
@@ -1121,7 +1142,7 @@ single-character strings."
((looking-at (rx "\\" eos))
(xr--report warnings (point)
- "Stray `\\' at end of string")))
+ (format-message "Stray `\\' at end of string"))))
(goto-char (match-end 0)))
- [elpa] externals/xr updated (b5ae891 -> dcf5240), Mattias Engdegård, 2020/02/29
- [elpa] externals/xr 9a8bf08 2/9: Update copyright year to 2020, Mattias Engdegård, 2020/02/29
- [elpa] externals/xr 0fb29c8 1/9: Update copyright year to 2020, Mattias Engdegård, 2020/02/29
- [elpa] externals/xr 9d9debd 5/9: Remove package description in xr.el, Mattias Engdegård, 2020/02/29
- [elpa] externals/xr 3af4048 4/9: Suppress false positives in repetition subsumption check (bug #2), Mattias Engdegård, 2020/02/29
- [elpa] externals/xr 1932e3d 7/9: Avoid ambiguous regexp (relint/xr complaint), Mattias Engdegård, 2020/02/29
- [elpa] externals/xr d7a6480 8/9: Translate [^\n] into nonl, Mattias Engdegård, 2020/02/29
- [elpa] externals/xr dcf5240 9/9: Increment version to 1.16, Mattias Engdegård, 2020/02/29
- [elpa] externals/xr e82efe8 6/9: Improved character class set relations, Mattias Engdegård, 2020/02/29
- [elpa] externals/xr c88fb0e 3/9: Use text quoting for all messages,
Mattias Engdegård <=