From 0f4143d26b805f83c1dd47a8720f2db426800a05 Mon Sep 17 00:00:00 2001 From: Jared Finder Date: Fri, 13 Dec 2024 20:59:50 -0800 Subject: [PATCH] Fix for xt-mouse-tests.el broken in prior commit xt-mouse-tests not turning on xterm-mouse-mode if it was already on did not work with xterm-mouse-mode being set to t by default. It turns out that xt-mouse-tests already does not report proper results when called inside a running Emacs session so the code path is not useful anyways. * test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Always turn on xterm-mouse-mode, even if it is already on. --- test/lisp/xt-mouse-tests.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el index cfc8042f796..f64b3aed73e 100644 --- a/test/lisp/xt-mouse-tests.el +++ b/test/lisp/xt-mouse-tests.el @@ -25,6 +25,8 @@ (require 'xt-mouse) +;; FIXME: this doesn't work when called inside a non-batch mode Emacs +;; session. (defmacro with-xterm-mouse-mode (&rest body) "Run BODY with `xterm-mouse-mode' temporarily enabled." (declare (indent 0)) @@ -42,18 +44,16 @@ with-xterm-mouse-mode ((terminal-parameter nil 'xterm-mouse-y) nil) ((terminal-parameter nil 'xterm-mouse-last-down) nil) ((terminal-parameter nil 'xterm-mouse-last-click) nil)) - (if xterm-mouse-mode - ,(macroexp-progn body) - (unwind-protect - (progn - ;; `xterm-mouse-mode' doesn't work in the initial - ;; terminal. Since we can't create a second - ;; terminal in batch mode, fake it temporarily. - (cl-letf (((symbol-function 'terminal-name) - (lambda (&optional _terminal) "fake-terminal"))) - (xterm-mouse-mode)) - ,@body) - (xterm-mouse-mode 0))))) + (unwind-protect + (progn + ;; `xterm-mouse-mode' doesn't work in the initial + ;; terminal. Since we can't create a second + ;; terminal in batch mode, fake it temporarily. + (cl-letf (((symbol-function 'terminal-name) + (lambda (&optional _terminal) "fake-terminal"))) + (xterm-mouse-mode 1)) + ,@body) + (xterm-mouse-mode 0)))) (set-frame-width nil width) (set-frame-height nil height)))) -- 2.39.5