]> git.eshelyaron.com Git - emacs.git/commitdiff
; Clean up 'xterm-mouse-mode' auto-enabling vars
authorJared Finder <jared@finder.org>
Sun, 19 Jan 2025 05:06:00 +0000 (21:06 -0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 25 Jan 2025 17:48:40 +0000 (18:48 +0100)
* lisp/term/xterm.el (xterm--auto-xt-mouse-allowed-names)
(xterm--auto-xt-mouse-allowed-types): Use `rx' macro and
update docstring.  (Bug#74833)

(cherry picked from commit 0f3d4e157fb9e638f568128096c818d4485b60fa)

lisp/term/xterm.el

index 23e29400c2f521eb86c3ecc67d8c065bc2435105..15101ebd59db2cb5db796ef300d952ff99b40056 100644 (file)
@@ -84,13 +84,13 @@ capabilities, and only when that terminal understands bracketed paste."
   "Characters sent by the terminal to end a bracketed paste.")
 
 (defconst xterm--auto-xt-mouse-allowed-names
-  (mapconcat (lambda (s) (concat "^" s "\\>"))
-             '("Konsole"
-               "WezTerm"
-               ;; "XTerm"   ;Disabled because OSC52 support is opt-in only.
-               "iTerm2"     ;OSC52 support has opt-in/out UI on first usage
-               "kitty")
-             "\\|")
+  (rx string-start
+      (or "Konsole"
+          "WezTerm"
+          ;; "XTerm"   ;Disabled because OSC52 support is opt-in only.
+          "iTerm2"     ;OSC52 support has opt-in/out UI on first usage
+          "kitty")
+      word-end)
   "Regexp for terminals that automatically enable `xterm-mouse-mode' at startup.
 This will get matched against the terminal's XTVERSION string.
 
@@ -105,14 +105,16 @@ functionality:
 \"Mouse motion mode\" (DECSET1003): Allows Emacs to get event on mouse
     motion.
 
-Also see `xterm--auto-xt-mouse-allowed-types' which mtches against the
-value of TERM instead.")
+Also see `xterm--auto-xt-mouse-allowed-types' which matches against the
+value of TERM instead.  If either `xterm--auto-xt-mouse-allowed-names'
+or `xterm--auto-xt-mouse-allowed-types' matches, then `xterm-mouse-mode'
+will get enabled automatically.")
 
 (defconst xterm--auto-xt-mouse-allowed-types
-  (mapconcat (lambda (s) (concat "^" s "$"))
-             '("alacritty"
-               "contour")
-             "\\|")
+  (rx string-start
+      (or "alacritty"
+          "contour")
+      string-end)
   "Like `xterm--auto-xt-mouse-allowed-names', but for the terminal's type.
 This will get matched against the environment variable \"TERM\".")