emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0f561d0e5c: Pacify obsolete gv warnings in xt-mouse-tests.el


From: Basil L. Contovounesios
Subject: master 0f561d0e5c: Pacify obsolete gv warnings in xt-mouse-tests.el
Date: Fri, 26 Aug 2022 05:58:56 -0400 (EDT)

branch: master
commit 0f561d0e5c4e7c4fa1dbc70d55de935ebb04cdbb
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Pacify obsolete gv warnings in xt-mouse-tests.el
    
    * test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Replace
    deprecated generalized variables frame-width and frame-height with
    direct calls to set-frame-width and set-frame-height, respectively.
---
 test/lisp/xt-mouse-tests.el | 50 +++++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index 9318e8ef59..379ad7bf03 100644
--- a/test/lisp/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
@@ -28,28 +28,34 @@
 (defmacro with-xterm-mouse-mode (&rest body)
   "Run BODY with `xterm-mouse-mode' temporarily enabled."
   (declare (indent 0))
-  ;; Make the frame huge so that the test input events below don't hit
-  ;; the menu bar.
-  `(cl-letf (((frame-width nil) 2000)
-             ((frame-height nil) 2000)
-             ;; Reset XTerm parameters so that the tests don't get
-             ;; confused.
-             ((terminal-parameter nil 'xterm-mouse-x) nil)
-             ((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
-         (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)))))
+  `(let ((width (frame-width))
+         (height (frame-height)))
+     (unwind-protect
+         (progn
+           ;; Make the frame huge so that the test input events below
+           ;; don't hit the menu bar.
+           (set-frame-width nil (max width 2000))
+           (set-frame-height nil (max height 2000))
+           (cl-letf (;; Reset XTerm parameters so that the tests don't
+                     ;; get confused.
+                     ((terminal-parameter nil 'xterm-mouse-x) nil)
+                     ((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)))))
+       (set-frame-width nil width)
+       (set-frame-height nil height))))
 
 (ert-deftest xt-mouse-tracking-basic ()
   (should (equal (xterm-mouse-tracking-enable-sequence)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]