Function: uncombine-window
uncombine-window is a function defined in window.c.
Signature
(uncombine-window WINDOW)
Documentation
Uncombine specified WINDOW.
WINDOW should be an internal window whose parent window is an internal window of the same type. This means, that WINDOW and its parent should be either both horizontal or both vertical window combinations. If this is the case, make the child windows of WINDOW become child windows of WINDOW's parent and return t. Otherwise, leave the current configuration of WINDOW's frame unchanged and return nil.
Probably introduced at or before Emacs version 31.1.
Source Code
// Defined in /usr/src/emacs/src/window.c
{
struct window *w = decode_valid_window (window);
/* PARENT is WINDOW's parent and is supposed to be a combination of
the same type as WINDOW. */
Lisp_Object parent = w->parent;
if (MINI_WINDOW_P (w))
error ("Cannot uncombine a mini window");
if (WINDOW_INTERNAL_P (w) && !NILP (parent)
&& w->horizontal == XWINDOW (parent)->horizontal)
{
struct window *p = XWINDOW (w->parent);
/* WINDOW's first child. */
Lisp_Object first = w->contents;
struct window *f = XWINDOW (first);
/* WINDOW's last child. */
Lisp_Object last = Qnil;
struct window *l = f;
/* Find last child window of WINDOW. */
while (!NILP (l->next))
l = XWINDOW (l->next);
XSETWINDOW (last, l);
wset_prev (f, w->prev);
if (NILP (f->prev))
wset_combination (p, p->horizontal, first);
else
wset_next (XWINDOW (f->prev), first);
wset_next (l, w->next);
if (!NILP (l->next))
wset_prev (XWINDOW (w->next), last);
/* Fix parent slots for PARENT's new children and assign new normal
sizes. */
window_set_parent_and_normal_sizes (parent);
return Qt;
}
else
return Qnil;
}