summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/emacs-lisp/rx.el7
-rw-r--r--test/lisp/emacs-lisp/rx-tests.el25
3 files changed, 24 insertions, 12 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 3908c492253..4b0106fcb07 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2615,6 +2615,10 @@ buffer edits.
This function helps user to add custom font-lock rules to a tree-sitter
major mode.
+---
+** The variable 'rx-constituents' is now obsolete.
+Use 'rx-define', 'rx-let' and 'rx-let-eval' instead.
+
* Changes in Emacs 30.1 on Non-Free Operating Systems
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 246e41cff0b..7113d5a6241 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -149,6 +149,13 @@ If DEF is a list on the form (FUN MIN-ARGS MAX-ARGS PRED), then
If PRED is non-nil, it is a predicate that all actual arguments must
satisfy.")
+(make-obsolete-variable
+ 'rx-constituents
+ "use `rx-let', `rx-let-eval', or `rx-define' instead."
+ ;; Effectively obsolete since Emacs 27 but only formally declared
+ ;; obsolete in Emacs 30.
+ "30.1")
+
(defvar rx--local-definitions nil
"Alist of dynamic local rx definitions.
Each entry is:
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index 072209bcbcc..1bb79f72671 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -619,18 +619,19 @@
"[^amz]\\S_"))))
(ert-deftest rx-constituents ()
- (let ((rx-constituents
- (append '((beta . gamma)
- (gamma . "a*b")
- (delta . ((lambda (form)
- (regexp-quote (format "<%S>" form)))
- 1 nil symbolp))
- (epsilon . delta))
- rx-constituents)))
- (should (equal (rx-to-string '(seq (+ beta) nonl gamma) t)
- "\\(?:a*b\\)+.\\(?:a*b\\)"))
- (should (equal (rx-to-string '(seq (delta a b c) (* (epsilon d e))) t)
- "\\(?:<(delta a b c)>\\)\\(?:<(epsilon d e)>\\)*"))))
+ (with-suppressed-warnings ((obsolete rx-constituents))
+ (let ((rx-constituents
+ (append '((beta . gamma)
+ (gamma . "a*b")
+ (delta . ((lambda (form)
+ (regexp-quote (format "<%S>" form)))
+ 1 nil symbolp))
+ (epsilon . delta))
+ rx-constituents)))
+ (should (equal (rx-to-string '(seq (+ beta) nonl gamma) t)
+ "\\(?:a*b\\)+.\\(?:a*b\\)"))
+ (should (equal (rx-to-string '(seq (delta a b c) (* (epsilon d e))) t)
+ "\\(?:<(delta a b c)>\\)\\(?:<(epsilon d e)>\\)*")))))
(ert-deftest rx-compat ()
"Test old symbol retained for compatibility (bug#37517)."