On 2025-01-06 10:25, Stefan Monnier wrote: Thanks for the feedback. Patch attached with most feedback attached. Not addressed feedback follows: > - The above enables `xterm-mouse-mode` which will > then proceed to *not* obey `xterm--auto-xt-mouse-allowed-*` on any > further ttys used in the same session. > > IOW, I think the above test belongs in > `turn-on-xterm-mouse-tracking-on-terminal` rather than here. > > - Maybe instead of `xterm-mouse-mode-called` we should test > > (eq xterm-mouse-mode 'when-safe) > > or maybe rename the var to something more explicit like > `xterm-mouse-mode-only-when-safe`. Yeah, I wanted to implement auto enabling like this, but could not figure out a way that seemed ergonomic to a user. The problem I could not solve is that I wanted to ensure that a user running M-x xterm-mouse-mode still toggled from whatever auto-enabling logic ended up choosing. That is, if xterm-mouse-mode was auto-enabled, running M-x xterm-mouse-mode should disable it and if xterm-mouse-mode was not auto-enabled, running M-x xterm-mouse-mode should enable it. > - Of course, the previous code was also very weird: > > (when xterm-mouse-mode (xterm-mouse-mode 1)) > > says to enable the mode, but only when it's already enabled?! Yeah, it's weird. I followed the pattern from term/linux.el. That file has the exact same pattern for gpm-mouse-mode, for the exact same purpose. -- MJF