summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-08-15 14:11:23 +0300
committerEli Zaretskii <eliz@gnu.org>2021-08-15 14:11:23 +0300
commitfdf148cab4c0b74028b34dd4d3a2cd9e4efa8c19 (patch)
tree43b3415cedb5cde3495d74456e61b5e4c9eaf8d1 /src
parente2eb58c4874bc8dedb7f3da9f9e0626ccfe74cdf (diff)
downloademacs-fdf148cab4c0b74028b34dd4d3a2cd9e4efa8c19.tar.gz
Fix unwarranted point movement after C-g
When the same buffer is displayed in more than one window, redisplay temporarily moves point to the window-point when it works on non-selected windows. If we allow C-g to quit out of redisplay_window in this situation, point will appear to have moved to the window-point of that non-selected window, which is unwarranted. These changes prevent quitting in strategic places, so that we never quit out of redisplay_window. * src/xdisp.c (run_window_scroll_functions): Prevent quitting while running window-scroll-functions, so that we don't quit out of redisplay_window with temporarily moved point. (redisplay_window): While redisplaying the mode line, prevent quitting, to avoid exiting while point is temporarily moved. (decode_mode_spec): Use safe_call1 instead of call1, to trap any errors instead of letting them throw out of redisplay. (Bug#44448)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index e62f7e3df6e..ac80827bc3d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17275,8 +17275,11 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
if (!NILP (Vwindow_scroll_functions))
{
+ ptrdiff_t count = SPECPDL_INDEX ();
+ specbind (Qinhibit_quit, Qt);
run_hook_with_args_2 (Qwindow_scroll_functions, window,
make_fixnum (CHARPOS (startp)));
+ unbind_to (count, Qnil);
SET_TEXT_POS_FROM_MARKER (startp, w->start);
/* In case the hook functions switch buffers. */
set_buffer_internal (XBUFFER (w->contents));
@@ -19269,7 +19272,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
w->start_at_line_beg = (CHARPOS (startp) == BEGV
|| FETCH_BYTE (BYTEPOS (startp) - 1) == '\n');
- /* Display the mode line, if we must. */
+ /* Display the mode line, header line, and tab-line, if we must. */
if ((update_mode_line
/* If window not full width, must redo its mode line
if (a) the window to its side is being redone and
@@ -19288,8 +19291,11 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
|| window_wants_header_line (w)
|| window_wants_tab_line (w)))
{
+ ptrdiff_t count1 = SPECPDL_INDEX ();
+ specbind (Qinhibit_quit, Qt);
display_mode_lines (w);
+ unbind_to (count1, Qnil);
/* If mode line height has changed, arrange for a thorough
immediate redisplay using the correct mode line height. */
@@ -19337,7 +19343,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
finish_menu_bars:
/* When we reach a frame's selected window, redo the frame's menu
- bar and the frame's title. */
+ bar, tool bar, tab-bar, and the frame's title. */
if (update_mode_line
&& EQ (FRAME_SELECTED_WINDOW (f), window))
{
@@ -25428,8 +25434,8 @@ redisplay_mode_lines (Lisp_Object window, bool force)
}
-/* Display the mode and/or header line of window W. Value is the
- sum number of mode lines and header lines displayed. */
+/* Display the mode and/or header line of window W. Value is the sum
+ number of mode lines, header lines, and tab lines actually displayed. */
static int
display_mode_lines (struct window *w)
@@ -27009,7 +27015,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
Lisp_Object val = Qnil;
if (STRINGP (curdir))
- val = call1 (intern ("file-remote-p"), curdir);
+ val = safe_call1 (intern ("file-remote-p"), curdir);
val = unbind_to (count, val);