diff options
| author | James Thomas | 2025-06-16 01:20:31 +0530 |
|---|---|---|
| committer | Eli Zaretskii | 2025-08-02 17:25:14 +0300 |
| commit | cd31c3cb423baaaa9f7f3fa9eab274c09f2db1e9 (patch) | |
| tree | 57dadad87d5cafe5acb123a6f9ff180af49417c7 /lisp/window.el | |
| parent | e52ed1b5d1531e7dc15f3f8ddf7042b0a7e71f50 (diff) | |
| download | emacs-cd31c3cb423baaaa9f7f3fa9eab274c09f2db1e9.tar.gz emacs-cd31c3cb423baaaa9f7f3fa9eab274c09f2db1e9.zip | |
Add 'other-window-backward' for a default binding (bug#78803)
This moves in the opposite direction to 'other-window' by
default, and is consistent with its repeat map.
* lisp/window.el (other-window-backward): New function bound to
'C-x O'.
(ctl-x-map): Update definition.
* doc/emacs/windows.texi (Other Window): Update docs.
* etc/NEWS: Annouce the new command.
Diffstat (limited to 'lisp/window.el')
| -rw-r--r-- | lisp/window.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/window.el b/lisp/window.el index 44cb682d6dd..512e85dc29a 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -4073,6 +4073,14 @@ nil, which considers all windows on the selected frame." | |||
| 4073 | ;; Always return nil. | 4073 | ;; Always return nil. |
| 4074 | nil)))) | 4074 | nil)))) |
| 4075 | 4075 | ||
| 4076 | (defun other-window-backward (count &optional all-frames interactive) | ||
| 4077 | "Select another window in the reverse cyclic ordering of windows. | ||
| 4078 | COUNT specifies the number of windows to skip, (by default) backward, | ||
| 4079 | starting with the selected window, before making the selection. Like | ||
| 4080 | `other-window', but moves in the opposite direction." | ||
| 4081 | (interactive "p\ni\np") | ||
| 4082 | (other-window (- (or count 1)) all-frames interactive)) | ||
| 4083 | |||
| 4076 | (defun other-window-prefix () | 4084 | (defun other-window-prefix () |
| 4077 | "Display the buffer of the next command in a new window. | 4085 | "Display the buffer of the next command in a new window. |
| 4078 | The next buffer is the buffer displayed by the next command invoked | 4086 | The next buffer is the buffer displayed by the next command invoked |
| @@ -11373,6 +11381,7 @@ found by the provided context." | |||
| 11373 | (define-key ctl-x-map "2" 'split-window-below) | 11381 | (define-key ctl-x-map "2" 'split-window-below) |
| 11374 | (define-key ctl-x-map "3" 'split-window-right) | 11382 | (define-key ctl-x-map "3" 'split-window-right) |
| 11375 | (define-key ctl-x-map "o" 'other-window) | 11383 | (define-key ctl-x-map "o" 'other-window) |
| 11384 | (define-key ctl-x-map "O" 'other-window-backward) | ||
| 11376 | (define-key ctl-x-map "^" 'enlarge-window) | 11385 | (define-key ctl-x-map "^" 'enlarge-window) |
| 11377 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) | 11386 | (define-key ctl-x-map "}" 'enlarge-window-horizontally) |
| 11378 | (define-key ctl-x-map "{" 'shrink-window-horizontally) | 11387 | (define-key ctl-x-map "{" 'shrink-window-horizontally) |
| @@ -11386,10 +11395,7 @@ found by the provided context." | |||
| 11386 | :doc "Keymap to repeat `other-window'. Used in `repeat-mode'." | 11395 | :doc "Keymap to repeat `other-window'. Used in `repeat-mode'." |
| 11387 | :repeat t | 11396 | :repeat t |
| 11388 | "o" #'other-window | 11397 | "o" #'other-window |
| 11389 | "O" (lambda () | 11398 | "O" #'other-window-backward) |
| 11390 | (interactive) | ||
| 11391 | (setq repeat-map 'other-window-repeat-map) | ||
| 11392 | (other-window -1))) | ||
| 11393 | 11399 | ||
| 11394 | (defvar-keymap resize-window-repeat-map | 11400 | (defvar-keymap resize-window-repeat-map |
| 11395 | :doc "Keymap to repeat window resizing commands. | 11401 | :doc "Keymap to repeat window resizing commands. |