summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-10-27 09:54:54 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2019-10-27 09:54:54 +0100
commitcbd439e785cd1e72c3eae39ed987fda357014bf8 (patch)
tree4a10729f3ce701b2d4827259d2bedcb1bcb21cd8 /lisp/emacs-lisp
parent6e66d9a95c49f867da26ca897635f5e57561d0c7 (diff)
downloademacs-cbd439e785cd1e72c3eae39ed987fda357014bf8.tar.gz
emacs-cbd439e785cd1e72c3eae39ed987fda357014bf8.tar.bz2
emacs-cbd439e785cd1e72c3eae39ed987fda357014bf8.zip
Expand rx definitions inside (not ...)
* lisp/emacs-lisp/rx.el (rx--translate-not): * test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-def-in-not): * doc/lispref/searching.texi (Rx Constructs, Extending Rx): Allow user-defined rx constructs to be expanded inside (not ...) forms, for better composability (bug#37849).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/rx.el3
1 files changed, 3 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index d7677f14443..52a35ffa2a7 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -477,6 +477,9 @@ If NEGATED, negate the sense (thus making it positive)."
((eq arg 'word-boundary)
(rx--translate-symbol
(if negated 'word-boundary 'not-word-boundary)))
+ ((let ((expanded (rx--expand-def arg)))
+ (and expanded
+ (rx--translate-not negated (list expanded)))))
(t (error "Illegal argument to rx `not': %S" arg)))))
(defun rx--atomic-regexp (item)