summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2026-05-22 19:33:57 +0200
committerMartin Rudalics <rudalics@gmx.at>2026-05-22 19:33:57 +0200
commitd6f7b2d99bdbcc29e8784185612282a508cc3e84 (patch)
treeeabc66747b6a75e8acf61949057df4ed77faf101
parente0fbecaf658b95d3c53aa9f1bc078a3326a3f77c (diff)
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.
-rw-r--r--src/window.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c
index 3dbf1530d78..792c43d0555 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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);