Subject: bug#79056: tab-bar-tests-quit-restore-window sometimes fails in *compilation* buffer

From: Eli Zaretskii <[email-masked]>
Date: Wed, 23 Jul 2025 14:44:05 +0300

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Wed, 23 Jul 2025 09:51:22 +0300
> 
> >> > +  (skip-when (or noninteractive (null (getenv "TERM"))))
> >> 
> >> If there is no reliable way to create terminal frames in noninteractive
> >> tests, then probably such tests should be skipped by default to be used
> >> only manually when someone will remember to run them periodically.
> >
> > Why not allow them in interactive runs, as the patch above does?
> 
> What are interactive runs?

When you start Emacs, load the test file, then say

  M-x ert-run-tests-interactively RET

> >> I wonder how it would be possible to implement headless mode in Emacs?
> >
> > It should be possible, if someone writes the headless back-end for the
> > display engine, akin to xterm.c+xfns.c for X, just much simpler.
> 
> Probably in such headless mode X calls can be replaced with stubs or mocks
> unless they are stateful.

There should be no X calls at all.  Emacs only calls X functions when
the frame is an X frame.  In other case, the display code calls a
suitable method that corresponds to the frame kind.  See the
initialization of these methods in x_create_terminal and a similar
initialization for TTY frames in set_tty_hooks.  We need something
like that for the so-called "initial" frames created by the
noninteractive session.