[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bd44f39d6d 04/14: Restart tick counting every command
From: |
Eli Zaretskii |
Subject: |
master bd44f39d6d 04/14: Restart tick counting every command |
Date: |
Fri, 24 Jun 2022 03:54:18 -0400 (EDT) |
branch: master
commit bd44f39d6d4900e406f87d6f4df1ee015dd21300
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Restart tick counting every command
* src/keyboard.c (command_loop_1): Reinitialize the tick count
before executing each command in the loop.
* src/xdisp.c (update_redisplay_ticks): Be more defensive to W
being NULL and to its buffer being nil. Set
'windows_or_buffers_changed' to avoid trusting stale window data
like w->window_end_valid.
---
src/keyboard.c | 5 +++++
src/xdisp.c | 26 ++++++++++++++++++++------
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/keyboard.c b/src/keyboard.c
index 55d710ed62..7d7dd2dba0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1501,6 +1501,11 @@ command_loop_1 (void)
point_before_last_command_or_undo = PT;
buffer_before_last_command_or_undo = current_buffer;
+ /* Restart our counting of redisplay ticks before
+ executing the command, so that we don't blame the new
+ command for the sins of the previous one. */
+ update_redisplay_ticks (0, NULL);
+
call1 (Qcommand_execute, Vthis_command);
#ifdef HAVE_WINDOW_SYSTEM
diff --git a/src/xdisp.c b/src/xdisp.c
index 27041cb162..ae428f4b40 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17176,7 +17176,10 @@ redisplay_window_1 (Lisp_Object window)
redisplay of the window takes "too long".
TICKS is the amount of ticks to add to the W's current count; zero
- means to initialize the count to zero. */
+ means to initialize the tick count to zero.
+
+ W can be NULL if TICKS is zero: that means unconditionally
+ re-initialize the current tick count to zero. */
void
update_redisplay_ticks (int ticks, struct window *w)
{
@@ -17184,9 +17187,9 @@ update_redisplay_ticks (int ticks, struct window *w)
static struct window *cwindow;
static EMACS_INT window_ticks;
- /* We only initialize the count if this is a different window.
- Otherwise, this is a call from init_iterator for the same window
- we tracked before, and we should keep the count. */
+ /* We only initialize the count if this is a different window or
+ NULL. Otherwise, this is a call from init_iterator for the same
+ window we tracked before, and we should keep the count. */
if (!ticks && w != cwindow)
{
cwindow = w;
@@ -17195,8 +17198,19 @@ update_redisplay_ticks (int ticks, struct window *w)
if (ticks > 0)
window_ticks += ticks;
if (max_redisplay_ticks > 0 && window_ticks > max_redisplay_ticks)
- error ("Window showing buffer %s takes too long to redisplay",
- SSDATA (BVAR (XBUFFER (w->contents), name)));
+ {
+ /* In addition to a buffer, this could be a window (for non-leaf
+ windows, not expected here) or nil (for pseudo-windows like
+ the one used for the native tool bar). */
+ Lisp_Object contents = w ? w->contents : Qnil;
+ char *bufname =
+ BUFFERP (contents)
+ ? SSDATA (BVAR (XBUFFER (contents), name))
+ : (char *) "<none>";
+
+ windows_or_buffers_changed = 177;
+ error ("Window showing buffer %s takes too long to redisplay", bufname);
+ }
}
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, (continued)
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, Eli Zaretskii, 2022/06/24
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, Lars Ingebrigtsen, 2022/06/24
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, Eli Zaretskii, 2022/06/24
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, Lars Ingebrigtsen, 2022/06/24
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, Eli Zaretskii, 2022/06/24
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, Lars Ingebrigtsen, 2022/06/24
master f1e1392868 03/14: Change the API of 'update_redisplay_ticks', Eli Zaretskii, 2022/06/24
master 82626e62ab 08/14: Allow aborting redisplay stuck in 'parse-partial-sexp', Eli Zaretskii, 2022/06/24
master a82af5ae78 09/14: Don't count ticks too eagerly in syntax.c, Eli Zaretskii, 2022/06/24
master 5a596bbed5 02/14: Fix a typo in a doc string., Eli Zaretskii, 2022/06/24
master bd44f39d6d 04/14: Restart tick counting every command,
Eli Zaretskii <=
master 264472a507 05/14: Handle W = NULL in 'update_redisplay_ticks', Eli Zaretskii, 2022/06/24
master b89b23079c 12/14: Show warnings about aborted redisplay, Eli Zaretskii, 2022/06/24
master 287e714fe0 11/14: Update redisplay ticks for more operations, and misc modifications, Eli Zaretskii, 2022/06/24
master 94e1185369 06/14: Support callers which sometimes run unrelated to display code, Eli Zaretskii, 2022/06/24
master 94672c2936 07/14: Handle too long syntactic fontifications, Eli Zaretskii, 2022/06/24
master 4b00bc47c7 10/14: Update documentation, Eli Zaretskii, 2022/06/24
master 289b457cac 14/14: Merge branch 'abort-redisplay', Eli Zaretskii, 2022/06/24
master 6fcd8ca743 13/14: ; * etc/NEWS: Minor update of description of 'max-redisplay-ticks'., Eli Zaretskii, 2022/06/24