branch: externals/xr commit 8912612803a734984f600b73d58c92ff40f7d480 Author: Mattias Engdegård <matti...@acm.org> Commit: Mattias Engdegård <matti...@acm.org>
Fix xr-lint complaint about \[ --- xr-test.el | 7 ++++--- xr.el | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xr-test.el b/xr-test.el index f646c13..7077283 100644 --- a/xr-test.el +++ b/xr-test.el @@ -255,7 +255,7 @@ ) (ert-deftest xr-lint () - (should (equal (xr-lint "^a*\\(b\\{3\\}\\|c\\)[^]\\a-d^-]$") + (should (equal (xr-lint "^a*\\[\\?\\$\\(b\\{3\\}\\|c\\)[^]\\a-d^-]$") nil)) (should (equal (xr-lint "a^b$c") '((1 . "Unescaped literal `^'") @@ -264,11 +264,12 @@ '((1 . "Unescaped literal `*'")))) (should (equal (xr-lint "a[\\\\[]") '((2 . "Escaped `\\' inside character alternative")))) - (should (equal (xr-lint "\\{\\(+\\|?\\)\\}") + (should (equal (xr-lint "\\{\\(+\\|?\\)\\[\\]\\}") '((0 . "Escaped non-special character `{'") (4 . "Unescaped literal `+'") (7 . "Unescaped literal `?'") - (10 . "Escaped non-special character `}'")))) + (12 . "Escaped non-special character `]'") + (14 . "Escaped non-special character `}'")))) (should (equal (xr-lint "\\}\\w\\a\\b\\%") '((0 . "Escaped non-special character `}'") (4 . "Escaped non-special character `a'") diff --git a/xr.el b/xr.el index a430cf2..60d84b9 100644 --- a/xr.el +++ b/xr.el @@ -433,7 +433,7 @@ ;; Escaped character. Only \*+?.^$[ really need escaping, but we accept ;; any not otherwise handled character after the backslash since ;; such sequences are found in the wild. - ((looking-at (rx "\\" (group (or (any "\\*+?.^$") + ((looking-at (rx "\\" (group (or (any "\\*+?.^$[") (group anything))))) (forward-char 2) (push (match-string 1) sequence)