Bind new window layout commands under C-x w

* lisp/window.el (rotate-windows-repeat-map)
(window-layout-rotate-repeat-map, window-layout-flip-repeat-map):
New keymaps.
(window-prefix-map): Bind new window layout commands.
* etc/NEWS: Rewrite entry for the new commands.
This commit is contained in:
Sean Whitton 2025-04-18 18:25:16 +08:00
parent a731dd63fb
commit 20b919cfb1
2 changed files with 41 additions and 6 deletions

View file

@ -225,11 +225,13 @@ albeit as a variable, not a user option.
** Windows
+++
*** New functions to modify window layout.
Several functions to modify the window layout have been added:
'window-layout-rotate-clockwise', 'window-layout-rotate-anticlockwise',
'window-layout-flip-topdown', 'window-layout-flip-leftright',
'window-layout-transpose', 'rotate-windows', and 'rotate-windows-back'.
*** New commands to modify window layouts.
'C-x w t' and 'C-x w r <left>/<right>' rotate the window layout.
'C-x w o <left>/<right>' rotate the windows within the current layout.
'C-x w f <left>/<right>/<up>/<down>' flip window layouts.
By default these commands operate on the selected frame's root window.
With a prefix argument, they operate on the selected window's parent.
+++
*** Windmove commands now move to skipped windows if invoked twice in a row.

View file

@ -11381,6 +11381,29 @@ Used in `repeat-mode'."
;; Additional keys:
"v" #'shrink-window)
(defvar-keymap rotate-windows-repeat-map
:doc "Keymap to repeat window-rotating commands.
Used in `repeat-mode'."
:repeat t
"<left>" #'rotate-windows-back
"<right>" #'rotate-windows)
(defvar-keymap window-layout-rotate-repeat-map
:doc "Keymap to repeat window layout-rotating commands.
Used in `repeat-mode'."
:repeat t
"<left>" #'window-layout-rotate-anticlockwise
"<right>" #'window-layout-rotate-clockwise)
(defvar-keymap window-layout-flip-repeat-map
:doc "Keymap to repeat window-flipping commands.
Used in `repeat-mode'."
:repeat t
"<left>" #'window-layout-flip-leftright
"<right>" #'window-layout-flip-leftright
"<up>" #'window-layout-flip-topdown
"<down>" #'window-layout-flip-topdown)
(defvar-keymap window-prefix-map
:doc "Keymap for subcommands of \\`C-x w'."
"2" #'split-root-window-below
@ -11391,7 +11414,17 @@ Used in `repeat-mode'."
"^ t" #'tab-window-detach
"-" #'fit-window-to-buffer
"0" #'delete-windows-on
"q" #'quit-window)
"q" #'quit-window
"o <left>" #'rotate-windows-back
"o <right>" #'rotate-windows
"t" #'window-layout-transpose
"r <left>" #'window-layout-rotate-anticlockwise
"r <right>" #'window-layout-rotate-clockwise
"f <left>" #'window-layout-flip-leftright
"f <right>" #'window-layout-flip-leftright
"f <up>" #'window-layout-flip-topdown
"f <down>" #'window-layout-flip-topdown)
(define-key ctl-x-map "w" window-prefix-map)
(provide 'window)