Subject: bug#57727: 29.0.50; Optimize tty display updates

From: Gerd Möllmann <[email-masked]>
Date: Sun, 18 Sep 2022 07:34:54 +0200

"Basil L. Contovounesios" <[email-masked]> writes:

> What should tty--output-buffer-size do when called from a graphical
> terminal (i.e. when decode_tty_terminal returns NULL)?
>
> It currently crashes, but that's what every other C program is doing,
> very banal.  Maybe Emacs should do something more eccentric, like return
> 0 or -1, signal an error, or do my taxes as consolation.

Oops, it should signal.

> Just curious: given this is an internal "--" function, do we want to
> tell the user what a valid size would be?  E.g. along the lines of:
>
>   size_t sz = check_uinteger_max (size, min (MOST_POSITIVE_FIXNUM, SIZE_MAX));
>
> Or would that be too much?
>
> BTW, is there a known upper limit for the buffer size in the OS?

I didn't want to do that because I don't know how to determine SIZE_MAX,
so I let users do what the like, as long as it doesn't make Emacs crash
:-).

>
>> +  Fsuspend_tty(tty);
>> +  struct terminal *terminal = decode_tty_terminal (tty);
>
> Here, terminal should theoretically be non-NULL, as Fsuspend_tty would
> have otherwise signalled.  Maybe we should eassert this assumption, or
> explicitly check for NULL?

I don't think that's necessary, or in other words, I think eassert
wouldn't give as valuable addtional information here.