Sometimes when moving windows around in emacs, it will get to a state where there is a horizontal or vertical stack of windows which appears to be a single list, but is actually made up of multiple nested window lists.
For example, what appears on the screen is a single horizontal line of windows:
A B C D
but what is stored in emacs is
(A (B C) D)
Is there a function that will remove this unnecessary nesting? I couldn't figure out any good way to do it.