Commit 7a6968b4 authored by Eli Zaretskii's avatar Eli Zaretskii

An even better fix for bug#21739

* src/window.c (set_window_buffer): If the window is the frame's
selected window, set update_mode_lines, not the window's
update_mode_line flag.  (Bug#21739)
* src/buffer.c (Fkill_buffer): Undo last change.
(set_update_modelines_for_buf): Function deleted.
parent 59a2ad3e
......@@ -1611,19 +1611,6 @@ compact_buffer (struct buffer *buffer)
}
}
/* Set the global update_mode_lines variable non-zero if the buffer
was displayed in some window. This is needed to catch the
attention of redisplay to changes that might require redisplay of
the frame title (which uses the same variables as mode lines) when
the buffer object cannot be used for recording that fact, e.g. if
the buffer is killed. */
static void
set_update_modelines_for_buf (bool disp)
{
if (disp)
update_mode_lines = 42;
}
DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
doc: /* Kill the buffer specified by BUFFER-OR-NAME.
The argument may be a buffer or the name of an existing buffer.
......@@ -1646,7 +1633,6 @@ cleaning up all windows currently displaying the buffer to be killed. */)
struct buffer *b;
Lisp_Object tem;
struct Lisp_Marker *m;
bool buffer_was_displayed = false;
if (NILP (buffer_or_name))
buffer = Fcurrent_buffer ();
......@@ -1661,8 +1647,6 @@ cleaning up all windows currently displaying the buffer to be killed. */)
if (!BUFFER_LIVE_P (b))
return Qnil;
buffer_was_displayed = buffer_window_count (b);
/* Run hooks with the buffer to be killed the current buffer. */
{
ptrdiff_t count = SPECPDL_INDEX ();
......@@ -1689,10 +1673,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* If the hooks have killed the buffer, exit now. */
if (!BUFFER_LIVE_P (b))
{
set_update_modelines_for_buf (buffer_was_displayed);
return unbind_to (count, Qt);
}
return unbind_to (count, Qt);
/* Then run the hooks. */
run_hook (Qkill_buffer_hook);
......@@ -1701,10 +1682,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* If the hooks have killed the buffer, exit now. */
if (!BUFFER_LIVE_P (b))
{
set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
return Qt;
/* We have no more questions to ask. Verify that it is valid
to kill the buffer. This must be done after the questions
......@@ -1732,10 +1710,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* Exit if we now have killed the base buffer (Bug#11665). */
if (!BUFFER_LIVE_P (b))
{
set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
return Qt;
}
/* Run replace_buffer_in_windows before making another buffer current
......@@ -1746,10 +1721,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* Exit if replacing the buffer in windows has killed our buffer. */
if (!BUFFER_LIVE_P (b))
{
set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
return Qt;
/* Make this buffer not be current. Exit if it is the sole visible
buffer. */
......@@ -1778,10 +1750,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* Killing buffer processes may run sentinels which may have killed
our buffer. */
if (!BUFFER_LIVE_P (b))
{
set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
return Qt;
/* These may run Lisp code and into infinite loops (if someone
insisted on circular lists) so allow quitting here. */
......@@ -1813,10 +1782,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* Deleting an auto-save file could have killed our buffer. */
if (!BUFFER_LIVE_P (b))
{
set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
return Qt;
if (b->base_buffer)
{
......@@ -1915,7 +1881,6 @@ cleaning up all windows currently displaying the buffer to be killed. */)
if (!NILP (Vrun_hooks))
call1 (Vrun_hooks, Qbuffer_list_update_hook);
set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
......
......@@ -3271,7 +3271,14 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
/* Maybe we could move this into the `if' but it's not obviously safe and
I doubt it's worth the trouble. */
wset_redisplay (w);
w->update_mode_line = true;
/* If this window is the selected window on its frame, set the
global variable update_mode_lines, so that x_consider_frame_title
will consider this frame's title for rtedisplay. */
Lisp_Object fselected_window = XFRAME (WINDOW_FRAME (w))->selected_window;
if (WINDOWP (fselected_window) && XWINDOW (fselected_window) == w)
update_mode_lines = 42;
else
w->update_mode_line = true;
/* We must select BUFFER to run the window-scroll-functions and to look up
the buffer-local value of Vwindow_point_insertion_type. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment