}
}
-/* 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.
struct buffer *b;
Lisp_Object tem;
struct Lisp_Marker *m;
- bool buffer_was_displayed = false;
if (NILP (buffer_or_name))
buffer = Fcurrent_buffer ();
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 ();
/* 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);
/* 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
/* 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
/* 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. */
/* 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. */
/* 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)
{
if (!NILP (Vrun_hooks))
call1 (Vrun_hooks, Qbuffer_list_update_hook);
- set_update_modelines_for_buf (buffer_was_displayed);
return Qt;
}
\f
/* 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. */