From: Mattias Engdegård Date: Wed, 26 Feb 2020 21:59:22 +0000 (+0100) Subject: Don't complain about the regexp "[:-:]" X-Git-Tag: emacs-28.0.90~7828 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3766bf728a43933083f4525970bcf9fdace3838d;p=emacs.git Don't complain about the regexp "[:-:]" Suggested by Clément Pit-Claudel. * src/regex-emacs.c (regex_compile): * test/src/regex-emacs-tests.el (regexp-invalid): Tolerate ranges. --- diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 38824370e05..794958eb461 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -2007,7 +2007,7 @@ regex_compile (re_char *pattern, ptrdiff_t size, if (*p == ':') { re_char *q = p + 1; - while (q != pend && *q != ']') + while (q != pend && *q != ']' && *q != '-') { if (*q == ':') { diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index 661d416e6a7..f1c703ab8bd 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -806,6 +806,7 @@ This evaluates the TESTS test cases from glibc." (ert-deftest regexp-invalid () ;; relint suppression: Duplicated (should-error (string-match "[:space:]" "") - :type 'invalid-regexp)) + :type 'invalid-regexp) + (should (equal (string-match "[:-:]" "a-:") 2))) ;;; regex-emacs-tests.el ends here