1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-05-31 01:32:00 -07:00

Save/restore old_buffer slot via window configurations (Bug#81097)

With Emacs 31 the old_buffer slot of a window gets overwritten
with the buffer unshown in that window when that window is
deleted.  Fset_window_configuration triggers that when calling
delete_all_child_windows.  If a window configuration gets saved
and restored in one and the same redisplay cycle, the change
time stamps of the window and its frame will be equal and
'window-buffer-change-functions' may wrongly decide that the
window's buffer has not changed because its buffer and
old_buffer slots refer to the same buffer (Bug#81097).  Fix that
by saving and restoring the old_buffer slot.

* src/window.c (struct saved_window): Add 'old_buffer' slot.
(Fset_window_configuration): Restore old_buffer slot.
(save_window_save): Save old_buffer slot.
This commit is contained in:
Martin Rudalics 2026-05-22 19:33:57 +02:00
parent e0fbecaf65
commit d6f7b2d99b

View file

@ -7611,7 +7611,7 @@ struct saved_window
{
union vectorlike_header header;
Lisp_Object window, buffer, start, pointm, old_pointm;
Lisp_Object window, buffer, old_buffer, start, pointm, old_pointm;
Lisp_Object pixel_left, pixel_top, pixel_height, pixel_width;
Lisp_Object left_col, top_line, total_cols, total_lines;
Lisp_Object normal_cols, normal_lines;
@ -7835,6 +7835,7 @@ the return value is nil. Otherwise the value is t. */)
/* If we squirreled away the buffer, restore it now. */
if (BUFFERP (w->combination_limit))
wset_buffer (w, w->combination_limit);
wset_old_buffer (w, p->old_buffer);
w->pixel_left = XFIXNAT (p->pixel_left);
w->pixel_top = XFIXNAT (p->pixel_top);
w->pixel_width = XFIXNAT (p->pixel_width);
@ -8221,6 +8222,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, ptrdiff_t i)
wset_temslot (w, make_fixnum (i)); i++;
p->window = window;
p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil);
p->old_buffer = w->old_buffer;
p->pixel_left = make_fixnum (w->pixel_left);
p->pixel_top = make_fixnum (w->pixel_top);
p->pixel_width = make_fixnum (w->pixel_width);