Next: , Previous: , Up: Windows [Contents][Index]


29.11 Changing Window Layouts

Sometimes it can be useful to change the layout of windows such that two or more windows occupy the locations of each other. The commands described in this section do that in an orderly manner. Conceptually, these commands affect a rectangular subset of the windows on a frame. As a rule, they neither affect the location of a frame’s minibuffer window nor of any of its side windows (see Side Windows).

Common to all these commands is that they preserve the identity of windows by deleting them first and resurrecting them (see Resurrecting Windows) in their new locations afterwards. No window gets lost and no window is added or duplicated. Where possible, these commands try to preserve the relative size of windows as well as all other non-geometric properties including parameters. These commands will signal an error if windows about to change their locations are atomic or of fixed size. The option transpose-dedicated-windows described below decides whether dedicated windows may change their locations.

The window argument of all functions described in this section must specify a valid parent window (see Windows and Frames). If it is nil, it stands for the main window (see Side Windows) of the selected frame. Interactively, a prefix argument means to operate on the parent window of the selected window. In the examples given below, we shall always assume that the windows displayed constitute their frame’s main window and the window argument is nil unless stated otherwise.

The first two commands rotate a window layout either clockwise or counterclockwise.

Command: window-layout-rotate-clockwise &optional window

This command rotates the window layout clockwise by 90 degrees. Imagine a layout with three live windows A, B and C as depicted on the left below. Then this command will produce the layout on the right.

 ___________ ___________
 | | | | |
 | A | | B | |
 |___________| --> |_____| A |
 | | | | | |
 | B | C | | C | |
 |_____|_____| |_____|_____|
Command: window-layout-rotate-anticlockwise &optional window

This is like window-layout-rotate-clockwise but rotates the layout in the opposite direction as demonstrated in the example below.

 ___________ ___________
 | | | | |
 | A | | | C |
 |___________| --> | A |_____|
 | | | | | |
 | B | C | | | B |
 |_____|_____| |_____|_____|

The next two commands flip the window layout—rotate it around an imaginary horizontal or vertical axis. If the number of windows to be flipped is odd, the window in the middle remains in its original place.

Command: window-layout-flip-topdown &optional window

This command flips windows such that windows on the bottom become windows on the top and vice-versa as in the example below.

 ___________ ___________
 | | | | |
 | A | | B | C |
 |___________| --> |_____|_____|
 | | | | |
 | B | C | | A |
 |_____|_____| |___________|
Command: window-layout-flip-leftright &optional window

This command rearranges window in a way that the windows on the right become the windows on the left, and vice-versa.

 ___________ ___________
 | | | |
 | A | | A |
 |___________| --> |___________|
 | | | | | |
 | B | C | | C | B |
 |_____|_____| |_____|_____|

The next command can be used to transpose windows—changing horizontal splits to vertical ones and vice-versa.

Command: window-layout-transpose &optional window

This command reorganizes windows such that every horizontal split becomes a vertical split and vice versa.

 ___________ ___________
 | | | | |
 | A | | | B |
 |___________| --> | A |_____|
 | | | | | |
 | B | C | | | C |
 |_____|_____| |_____|_____|

The final two commands can be used to rotate windows within the existing layout. They are like the commands that rotate the layout but leave the underlying structure of the layout unchanged. What actually changes are the positions of windows within the existing layout. This happens in a way that the space formerly occupied by any window will be occupied by the window preceding (following if reverse is non-nil) it in the cyclic ordering of windows (see Cyclic Ordering of Windows) on window’s frame.

Command: rotate-windows &optional window reverse

This command rotates window’s child windows in cyclic ordering. The optional argument reverse means to rotate windows backwards, in reverse cyclic order.

 ___________ ___________
 | | | |
 | A | | C |
 |___________| --> |___________|
 | | | | | |
 | B | C | | A | B |
 |_____|_____| |_____|_____|
Command: rotate-windows-back &optional window

This command rotates window’s child windows backwards in cyclic ordering.

 ___________ ___________
 | | | |
 | A | | B |
 |___________| --> |___________|
 | | | | | |
 | B | C | | C | A |
 |_____|_____| |_____|_____|

All commands described above are subject to the following option.

User Option: transpose-dedicated-windows

If this is nil, the functions described in this section will report an error when they encounter a dedicated window (see Dedicated Windows). If this is t, they handle dedicated windows like non-dedicated ones.

The last two commands are subject to the following option.

User Option: rotate-windows-change-selected

If this is nil, the selected window will remain unaffected by rotate-windows and rotate-windows-back. If this is t (the default), the selected window will change to the window that appears at the location of the window selected before any of these commands were invoked.


Next: Cyclic Ordering of Windows, Previous: Resurrecting Windows, Up: Windows [Contents][Index]

AltStyle によって変換されたページ (->オリジナル) /