[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2719dccbe57 1/2: Fix for xt-mouse-tests.el broken in prior commit
From: |
Michael Albinus |
Subject: |
master 2719dccbe57 1/2: Fix for xt-mouse-tests.el broken in prior commit |
Date: |
Sat, 14 Dec 2024 03:38:02 -0500 (EST) |
branch: master
commit 2719dccbe5797dd8fcf1ce013df2ff71161b6f55
Author: Jared Finder <jared@finder.org>
Commit: Michael Albinus <michael.albinus@gmx.de>
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 @@
((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))))