]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix for xt-mouse-tests.el broken in prior commit
authorJared Finder <jared@finder.org>
Sat, 14 Dec 2024 08:30:43 +0000 (09:30 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 15 Dec 2024 16:39:21 +0000 (17:39 +0100)
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.

(cherry picked from commit 2719dccbe5797dd8fcf1ce013df2ff71161b6f55)

test/lisp/xt-mouse-tests.el

index cfc8042f79636d5929e8ce9ff413f03acdbf95ae..f64b3aed73e838d50018901edcff303704fc3211 100644 (file)
@@ -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))
                      ((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))))