Subject: Re: bug#74499: [PATCH] Avoid loading 'rx' at runtime in 'lua-ts-mode'

From: john muhl <[email-masked]>
Date: Sat, 23 Nov 2024 17:08:37 -0600

>From 309e80a336bce5c4a9191c87af636b8adfc04b97 Mon Sep 17 00:00:00 2001
From: john muhl <[email-masked]>
Date: Sat, 23 Nov 2024 14:08:21 -0600
Subject: [PATCH] Avoid loading 'rx' at runtime in 'lua-ts-mode'

* lisp/progmodes/lua-ts-mode.el (lua-ts-inferior-lua):
Replace 'rx-to-string' and substitution with 'rx' and 'literal'.

(Bug#74499)
---
 lisp/progmodes/lua-ts-mode.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index f88fe0e49af..828636f359d 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -659,9 +659,9 @@ lua-ts-inferior-lua
         (setq-local comint-input-ignoredups t
                     comint-input-ring-file-name lua-ts-inferior-history
                     comint-prompt-read-only t
-                    comint-prompt-regexp (rx-to-string `(: bol
-                                                           ,lua-ts-inferior-prompt
-                                                           (1+ space))))
+                    comint-prompt-regexp (rx bol
+                                             (literal lua-ts-inferior-prompt)
+                                             (1+ space)))
         (comint-read-input-ring t)
         (add-hook 'comint-preoutput-filter-functions
                   (lambda (string)
@@ -672,11 +672,11 @@ lua-ts-inferior-lua
                        ;; accumulate in the output when sending regions
                        ;; to the inferior process.
                        (replace-regexp-in-string
-                        (rx-to-string `(: bol
-                                          (* ,lua-ts-inferior-prompt
-                                             (? ,lua-ts-inferior-prompt)
-                                             (1+ space))
-                                          (group (* nonl))))
+                        (rx bol
+                            (* (literal lua-ts-inferior-prompt)
+                               (? (literal lua-ts-inferior-prompt))
+                               (1+ space))
+                            (group (* nonl)))
                         "\\1" string)
                        ;; Re-add the prompt for the next line.
                        lua-ts-inferior-prompt " ")))
-- 
2.47.0

john muhl <[email-masked]> writes:

> Tags: patch
>
> Philip mentioned changing these rx-to-string forms to use literal
> over in bug#74235. I meant to include them there but guess it
> slipped my mind.