Declare the variable rx-constituents obsolete.

It has been effectively obsolete since Emacs 27, when the modern
extension mechanism was introduced.

* lisp/emacs-lisp/rx.el (rx-constituents): Make obsolete.
* test/lisp/emacs-lisp/rx-tests.el (rx-constituents): Suppress warning.
* etc/NEWS: Announce.
This commit is contained in:
Mattias Engdegård
2024-04-29 12:35:55 +02:00
parent f906ce5543
commit 3be382311f
3 changed files with 24 additions and 12 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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)."