emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3be382311fa 5/5: Declare the variable `rx-constituents` obsolete.


From: Mattias Engdegård
Subject: master 3be382311fa 5/5: Declare the variable `rx-constituents` obsolete.
Date: Mon, 29 Apr 2024 08:31:43 -0400 (EDT)

branch: master
commit 3be382311fa03b9ec9c571b5e5737ff2d51bc2d3
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    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.
---
 etc/NEWS                         |  4 ++++
 lisp/emacs-lisp/rx.el            |  7 +++++++
 test/lisp/emacs-lisp/rx-tests.el | 25 +++++++++++++------------
 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)."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]