summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/rx.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-02-29 10:12:10 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2020-02-29 10:15:51 +0100
commitd42419590563964fd61b35dea7738e77c0f90cba (patch)
treeffda968b876185033881bd959f30ce7946eb17ee /lisp/emacs-lisp/rx.el
parent9908b5a61438ab82964d43bcfbcbe968d9bf601b (diff)
downloademacs-d42419590563964fd61b35dea7738e77c0f90cba.tar.gz
Fix rx charset generation
* lisp/emacs-lisp/rx.el (rx--charset-p): Don't overquote. (rx--generate-alt): Generate '.' for negated newline. * test/lisp/emacs-lisp/rx-tests.el (rx-any, rx-charset-or): Test.
Diffstat (limited to 'lisp/emacs-lisp/rx.el')
-rw-r--r--lisp/emacs-lisp/rx.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index b4cab5715da..1ee5e8294a6 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -305,7 +305,7 @@ Return (REGEXP . PRECEDENCE)."
"Whether FORM looks like a charset, only consisting of character intervals
and set operations."
(or (and (consp form)
- (or (and (memq (car form) '(any 'in 'char))
+ (or (and (memq (car form) '(any in char))
(rx--every (lambda (x) (not (symbolp x))) (cdr form)))
(and (memq (car form) '(not or | intersection))
(rx--every #'rx--charset-p (cdr form)))))
@@ -450,6 +450,10 @@ classes."
(not negated))
(cons (list (regexp-quote (char-to-string (caar items))))
t))
+ ;; Negated newline.
+ ((and (equal items '((?\n . ?\n)))
+ negated)
+ (rx--translate-symbol 'nonl))
;; At least one character or class, possibly negated.
(t
(cons