From fa8a67e67454a900e4cf7b93fed96f27ea41b1b8 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Tue, 7 Jun 2011 14:51:07 +0200 Subject: [PATCH] Make delete_all_subwindows argument a Lisp_Object. * window.c (delete_window, Fset_window_configuration): Call delete_all_subwindows with window as argument. (delete_all_subwindows): Take a window as argument and not a structure. Rewrite. * window.h: delete_all_subwindows now takes a Lisp_Object as argument. * frame.c (delete_frame): Call delete_all_subwindows with root window as argument. --- src/ChangeLog | 10 +++++++++- src/frame.c | 2 +- src/window.c | 51 +++++++++++++++++++++++++++++---------------------- src/window.h | 2 +- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5e51d8c6a76..c7bcdec0512 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,13 +6,21 @@ (window_box_text_cols): Replace with window_body_cols. (Fwindow_width, Fscroll_left, Fscroll_right): Use window_body_cols instead of window_box_text_cols. + (delete_window, Fset_window_configuration): Call + delete_all_subwindows with window as argument. + (delete_all_subwindows): Take a window as argument and not a + structure. Rewrite. * window.h: Extern window_body_cols instead of - window_box_text_cols. + window_box_text_cols. delete_all_subwindows now takes a + Lisp_Object as argument. * indent.c (compute_motion, Fcompute_motion): Use window_body_cols instead of window_box_text_cols. + * frame.c (delete_frame): Call delete_all_subwindows with root + window as argument. + 2011-06-07 Daniel Colascione * fns.c (Fputhash): Document return value. diff --git a/src/frame.c b/src/frame.c index 68984a68d52..71881265b44 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1336,7 +1336,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* Mark all the windows that used to be on FRAME as deleted, and then remove the reference to them. */ - delete_all_subwindows (XWINDOW (f->root_window)); + delete_all_subwindows (f->root_window); f->root_window = Qnil; Vframe_list = Fdelq (frame, Vframe_list); diff --git a/src/window.c b/src/window.c index 43635fe5a6b..ee62f57ee07 100644 --- a/src/window.c +++ b/src/window.c @@ -2001,9 +2001,9 @@ delete_window (register Lisp_Object window) /* Since we may be deleting combination windows, we must make sure that not only p but all its children have been marked as deleted. */ if (! NILP (p->hchild)) - delete_all_subwindows (XWINDOW (p->hchild)); + delete_all_subwindows (p->hchild); else if (! NILP (p->vchild)) - delete_all_subwindows (XWINDOW (p->vchild)); + delete_all_subwindows (p->vchild); /* Mark this window as deleted. */ p->buffer = p->hchild = p->vchild = Qnil; @@ -6260,7 +6260,7 @@ the return value is nil. Otherwise the value is t. */) Save their current buffers in their height fields, since we may need it later, if a buffer saved in the configuration is now dead. */ - delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); + delete_all_subwindows (FRAME_ROOT_WINDOW (f)); for (k = 0; k < saved_windows->header.size; k++) { @@ -6448,31 +6448,38 @@ the return value is nil. Otherwise the value is t. */) return (FRAME_LIVE_P (f) ? Qt : Qnil); } -/* Mark all windows now on frame as deleted - by setting their buffers to nil. */ - +/* Delete all subwindows reachable via the next, vchild, and hchild + slots of WINDOW. */ void -delete_all_subwindows (register struct window *w) +delete_all_subwindows (Lisp_Object window) { + register struct window *w; + + w = XWINDOW (window); + if (!NILP (w->next)) - delete_all_subwindows (XWINDOW (w->next)); - if (!NILP (w->vchild)) - delete_all_subwindows (XWINDOW (w->vchild)); - if (!NILP (w->hchild)) - delete_all_subwindows (XWINDOW (w->hchild)); + /* Delete WINDOW's siblings (we traverse postorderly). */ + delete_all_subwindows (w->next); w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ - if (!NILP (w->buffer)) - unshow_buffer (w); - - /* We set all three of these fields to nil, to make sure that we can - distinguish this dead window from any live window. Live leaf - windows will have buffer set, and combination windows will have - vchild or hchild set. */ - w->buffer = Qnil; - w->vchild = Qnil; - w->hchild = Qnil; + if (!NILP (w->vchild)) + { + delete_all_subwindows (w->vchild); + w->vchild = Qnil; + } + else if (!NILP (w->hchild)) + { + delete_all_subwindows (w->hchild); + w->hchild = Qnil; + } + else if (!NILP (w->buffer)) + { + unshow_buffer (w); + unchain_marker (XMARKER (w->pointm)); + unchain_marker (XMARKER (w->start)); + w->buffer = Qnil; + } Vwindow_list = Qnil; } diff --git a/src/window.h b/src/window.h index 7f937e92284..37d22bd7a76 100644 --- a/src/window.h +++ b/src/window.h @@ -770,7 +770,7 @@ EXFUN (Fwindow_dedicated_p, 1); extern void set_window_height (Lisp_Object, int, int); extern void set_window_width (Lisp_Object, int, int); extern void change_window_heights (Lisp_Object, int); -extern void delete_all_subwindows (struct window *); +extern void delete_all_subwindows (Lisp_Object); extern void freeze_window_starts (struct frame *, int); extern void grow_mini_window (struct window *, int); extern void shrink_mini_window (struct window *); -- 2.39.2