]> git.eshelyaron.com Git - emacs.git/commitdiff
Declare the variable `rx-constituents` obsolete.
authorMattias EngdegÄrd <mattiase@acm.org>
Mon, 29 Apr 2024 10:35:55 +0000 (12:35 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 29 Apr 2024 19:48:27 +0000 (21:48 +0200)
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.

(cherry picked from commit 3be382311fa03b9ec9c571b5e5737ff2d51bc2d3)

etc/NEWS
lisp/emacs-lisp/rx.el
test/lisp/emacs-lisp/rx-tests.el

index 4a96d47c1e44b87422321793c3cd504a5e33595e..86492be8296c0c2ad7ba3f367c52bb326c847c13 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2771,6 +2771,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.
+
 
 \f
 * Changes in Emacs 30.1 on Non-Free Operating Systems
index 246e41cff0bc4ffd03e5c8d943cd3ceffe47bc29..7113d5a62415634eec4ca38d3d9cd82a0aec04f5 100644 (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:
index 072209bcbcc6b8b40009be0a3f72fba183a73d6f..1bb79f726710d349cfa5380ec6a821e954067996 100644 (file)
                    "[^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)."