aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorGerd Möllmann2022-09-11 11:42:18 +0200
committerGerd Möllmann2022-09-17 15:33:10 +0200
commitcbac94b4aeecdf57e2a1f3e95e27ec76505ae964 (patch)
treed9f6c4bc4a5313849d57aa14bbb57e59f6564ff2 /src/term.c
parent5bf8f9cc0d2fb12071301f50f9b85640d240a1fc (diff)
downloademacs-cbac94b4aeecdf57e2a1f3e95e27ec76505ae964.tar.gz
emacs-cbac94b4aeecdf57e2a1f3e95e27ec76505ae964.zip
Optimize tty display updates (bug#57727)
* src/dispnew.c (update_frame_1): Don'f flush if tty's output_buffer_size is non-zero. * src/sysdep.c (init_sys_modes): Setvbuf depending on the tty's output_buffer_size. * src/term.c (Ftty__set_output_buffer_size, Ftty__output_buffer_size): Low-level interface for setting and retrieving a tty's output buffer size. (syms_of_term): Defsubr the new functions. * src/termchar.h (struct tty_display_info): New member output_buffer_size. * stc/NEWS: Describe the change.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index 2e43d89232f..231324d002a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2400,6 +2400,42 @@ frame's terminal). */)
2400 return Qnil; 2400 return Qnil;
2401} 2401}
2402 2402
2403DEFUN ("tty--set-output-buffer-size", Ftty__set_output_buffer_size,
2404 Stty__set_output_buffer_size, 1, 2, 0, doc:
2405 /* Set the output buffer size for a TTY.
2406
2407SIZE zero means use the system's default value. If SIZE is
2408non-zero, this also avoids flushing the output stream.
2409
2410TTY may be a terminal object, a frame, or nil (meaning the selected
2411frame's terminal).
2412
2413This function temporarily suspends and resumes the terminal
2414device. */)
2415 (Lisp_Object size, Lisp_Object tty)
2416{
2417 if (!TYPE_RANGED_FIXNUMP (size_t, size))
2418 error ("Invalid output buffer size");
2419 Fsuspend_tty (tty);
2420 struct terminal *terminal = decode_tty_terminal (tty);
2421 terminal->display_info.tty->output_buffer_size = XFIXNUM (size);
2422 return Fresume_tty (tty);
2423}
2424
2425DEFUN ("tty--output-buffer-size", Ftty__output_buffer_size,
2426 Stty__output_buffer_size, 0, 1, 0, doc:
2427 /* Return the output buffer size of TTY.
2428
2429TTY may be a terminal object, a frame, or nil (meaning the selected
2430frame's terminal).
2431
2432A value of zero means TTY uses the system's default value. */)
2433 (Lisp_Object tty)
2434{
2435 struct terminal *terminal = decode_tty_terminal (tty);
2436 return make_fixnum (terminal->display_info.tty->output_buffer_size);
2437}
2438
2403 2439
2404/*********************************************************************** 2440/***********************************************************************
2405 Mouse 2441 Mouse
@@ -4556,6 +4592,8 @@ trigger redisplay. */);
4556 defsubr (&Stty_top_frame); 4592 defsubr (&Stty_top_frame);
4557 defsubr (&Ssuspend_tty); 4593 defsubr (&Ssuspend_tty);
4558 defsubr (&Sresume_tty); 4594 defsubr (&Sresume_tty);
4595 defsubr (&Stty__set_output_buffer_size);
4596 defsubr (&Stty__output_buffer_size);
4559#ifdef HAVE_GPM 4597#ifdef HAVE_GPM
4560 defsubr (&Sgpm_mouse_start); 4598 defsubr (&Sgpm_mouse_start);
4561 defsubr (&Sgpm_mouse_stop); 4599 defsubr (&Sgpm_mouse_stop);