aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-04-18 18:25:16 +0800
committerSean Whitton2025-04-18 18:25:16 +0800
commit20b919cfb1b5861a91a57b5f0c27e6c6fc03aff5 (patch)
tree837e3616e7bc493fee8a30c693cf0b6ded70f81c
parenta731dd63fb259758fb52630f4f499357cbc727c0 (diff)
downloademacs-20b919cfb1b5861a91a57b5f0c27e6c6fc03aff5.tar.gz
emacs-20b919cfb1b5861a91a57b5f0c27e6c6fc03aff5.zip
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.
-rw-r--r--etc/NEWS12
-rw-r--r--lisp/window.el35
2 files changed, 41 insertions, 6 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 0918553c733..d57c118d9e7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -225,11 +225,13 @@ albeit as a variable, not a user option.
225** Windows 225** Windows
226 226
227+++ 227+++
228*** New functions to modify window layout. 228*** New commands to modify window layouts.
229Several functions to modify the window layout have been added: 229'C-x w t' and 'C-x w r <left>/<right>' rotate the window layout.
230'window-layout-rotate-clockwise', 'window-layout-rotate-anticlockwise', 230'C-x w o <left>/<right>' rotate the windows within the current layout.
231'window-layout-flip-topdown', 'window-layout-flip-leftright', 231'C-x w f <left>/<right>/<up>/<down>' flip window layouts.
232'window-layout-transpose', 'rotate-windows', and 'rotate-windows-back'. 232
233By default these commands operate on the selected frame's root window.
234With a prefix argument, they operate on the selected window's parent.
233 235
234+++ 236+++
235*** Windmove commands now move to skipped windows if invoked twice in a row. 237*** Windmove commands now move to skipped windows if invoked twice in a row.
diff --git a/lisp/window.el b/lisp/window.el
index cdd6b932502..e0e626e9500 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -11381,6 +11381,29 @@ Used in `repeat-mode'."
11381 ;; Additional keys: 11381 ;; Additional keys:
11382 "v" #'shrink-window) 11382 "v" #'shrink-window)
11383 11383
11384(defvar-keymap rotate-windows-repeat-map
11385 :doc "Keymap to repeat window-rotating commands.
11386Used in `repeat-mode'."
11387 :repeat t
11388 "<left>" #'rotate-windows-back
11389 "<right>" #'rotate-windows)
11390
11391(defvar-keymap window-layout-rotate-repeat-map
11392 :doc "Keymap to repeat window layout-rotating commands.
11393Used in `repeat-mode'."
11394 :repeat t
11395 "<left>" #'window-layout-rotate-anticlockwise
11396 "<right>" #'window-layout-rotate-clockwise)
11397
11398(defvar-keymap window-layout-flip-repeat-map
11399 :doc "Keymap to repeat window-flipping commands.
11400Used in `repeat-mode'."
11401 :repeat t
11402 "<left>" #'window-layout-flip-leftright
11403 "<right>" #'window-layout-flip-leftright
11404 "<up>" #'window-layout-flip-topdown
11405 "<down>" #'window-layout-flip-topdown)
11406
11384(defvar-keymap window-prefix-map 11407(defvar-keymap window-prefix-map
11385 :doc "Keymap for subcommands of \\`C-x w'." 11408 :doc "Keymap for subcommands of \\`C-x w'."
11386 "2" #'split-root-window-below 11409 "2" #'split-root-window-below
@@ -11391,7 +11414,17 @@ Used in `repeat-mode'."
11391 "^ t" #'tab-window-detach 11414 "^ t" #'tab-window-detach
11392 "-" #'fit-window-to-buffer 11415 "-" #'fit-window-to-buffer
11393 "0" #'delete-windows-on 11416 "0" #'delete-windows-on
11394 "q" #'quit-window) 11417 "q" #'quit-window
11418
11419 "o <left>" #'rotate-windows-back
11420 "o <right>" #'rotate-windows
11421 "t" #'window-layout-transpose
11422 "r <left>" #'window-layout-rotate-anticlockwise
11423 "r <right>" #'window-layout-rotate-clockwise
11424 "f <left>" #'window-layout-flip-leftright
11425 "f <right>" #'window-layout-flip-leftright
11426 "f <up>" #'window-layout-flip-topdown
11427 "f <down>" #'window-layout-flip-topdown)
11395(define-key ctl-x-map "w" window-prefix-map) 11428(define-key ctl-x-map "w" window-prefix-map)
11396 11429
11397(provide 'window) 11430(provide 'window)