From: Gerd Möllmann Date: Fri, 20 Dec 2024 06:03:59 +0000 (+0100) Subject: Allow xt-mouse-tests to run X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=008953b774015eb0033c2f1889b3b3dde0e0c294;p=emacs.git Allow xt-mouse-tests to run This is basically a workaround for running a test in batch mode which should have a tty frame available but doesn't. * src/frame.c (check_tty): Relax check if noninteractive. * lisp/xt-mouse.el (xterm-mouse-event): Don't use frame-at if noninteractive. (cherry picked from commit 82c3fcd17e3eb3756bd3533c39d89c21ec7fdce5) --- diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 4f1ac4f2b16..2ba60ded899 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -295,7 +295,10 @@ which is the \"1006\" extension implemented in Xterm >= 277." (progn (setq xt-mouse-epoch (float-time)) 0) (car (time-convert (time-since xt-mouse-epoch) 1000)))) - (frame (frame-at x y)) + ;; FIXME: The test for running in batch mode is here solely + ;; for the sake of xt-mouse-tests where the only frame is + ;; the initial frame. + (frame (unless noninteractive (frame-at x y))) ;;(_ (message (format "*** %S" frame))) (frame-pos (frame-position frame)) ;;(_ (message (format "*** %S" frame-pos))) diff --git a/src/frame.c b/src/frame.c index 8c41f0fa7c7..5d9551c0c93 100644 --- a/src/frame.c +++ b/src/frame.c @@ -152,6 +152,13 @@ check_window_system (struct frame *f) void check_tty (struct frame *f) { + /* FIXME: the noninteractive case is here because some tests running + in batch mode, like xt-mouse-tests, test with the initial frame + which is no tty frame. It would be nicer if the test harness + would allow testing with real tty frames. */ + if (f && noninteractive) + return; + if (!f || !FRAME_TERMCAP_P (f)) error ("tty frame should be used"); }