1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-07 20:54:32 +00:00

User option to select 'no-other-window' with windmove (bug#48916)

* lisp/windmove.el (windmove-wrap-around): Remove superfluous :group tag.
(windmove-create-window): Remove superfluous :group tag.
(windmove-window-distance-delta): Remove superfluous :group tag.
(windmove-allow-all-windows): Add new user option to allow the commands
of windmove to target windows with the 'no-other-window parameter.
(windmove-find-other-window): Use windmove-allow-all-windows.
(windmove-display-no-select): Remove superfluous :group tag.
(windmove-display-in-direction): Use windmove-allow-all-windows.
(windmove-delete-in-direction): Use windmove-allow-all-windows.
(windmove-swap-states-in-direction): Use windmove-allow-all-windows.
(windmove-default-keybindings): Remove superfluous :group tag.
(windmove-display-default-keybindings): Remove superfluous :group tag.
(windmove-delete-default-keybindings): Remove superfluous :group tag.
(windmove-swap-states-default-keybindings): Remove superfluous :group tag.
This commit is contained in:
pillule 2021-06-16 02:23:13 +03:00 committed by Juri Linkov
parent a8721a333d
commit 0367d17482

View File

@ -138,8 +138,7 @@ If this variable is set to t, moving left from the leftmost window in
a frame will find the rightmost one, and similarly for the other a frame will find the rightmost one, and similarly for the other
directions. The minibuffer is skipped over in up/down movements if it directions. The minibuffer is skipped over in up/down movements if it
is inactive." is inactive."
:type 'boolean :type 'boolean)
:group 'windmove)
(defcustom windmove-create-window nil (defcustom windmove-create-window nil
"Whether movement off the edge of the frame creates a new window. "Whether movement off the edge of the frame creates a new window.
@ -147,7 +146,6 @@ If this variable is set to t, moving left from the leftmost window in
a frame will create a new window on the left, and similarly for the other a frame will create a new window on the left, and similarly for the other
directions." directions."
:type 'boolean :type 'boolean
:group 'windmove
:version "27.1") :version "27.1")
;; If your Emacs sometimes places an empty column between two adjacent ;; If your Emacs sometimes places an empty column between two adjacent
@ -157,11 +155,18 @@ directions."
Measured in characters either horizontally or vertically; setting this Measured in characters either horizontally or vertically; setting this
to a value larger than 1 may be useful in getting around window- to a value larger than 1 may be useful in getting around window-
placement bugs in old versions of Emacs." placement bugs in old versions of Emacs."
:type 'number :type 'number)
:group 'windmove)
(make-obsolete-variable 'windmove-window-distance-delta (make-obsolete-variable 'windmove-window-distance-delta
"no longer used." "27.1") "no longer used." "27.1")
(defcustom windmove-allow-all-windows nil
"Whether the windmove commands are allowed to target all type of windows.
If this variable is set to non-nil, all windmove commmands will
ignore the `no-other-window' parameter applied by `display-buffer-alist'
or `set-window-parameter'."
:type 'boolean
:version "28.1")
;; Note: ;; Note:
;; ;;
@ -342,7 +347,8 @@ WINDOW must be a live window and defaults to the selected one.
Optional ARG, if negative, means to use the right or bottom edge of Optional ARG, if negative, means to use the right or bottom edge of
WINDOW as reference position, instead of `window-point'; if positive, WINDOW as reference position, instead of `window-point'; if positive,
use the left or top edge of WINDOW as reference point." use the left or top edge of WINDOW as reference point."
(window-in-direction dir window nil arg windmove-wrap-around t)) (window-in-direction dir window windmove-allow-all-windows
arg windmove-wrap-around t))
;; Selects the window that's hopefully at the location returned by ;; Selects the window that's hopefully at the location returned by
;; `windmove-find-other-window', or screams if there's no window there. ;; `windmove-find-other-window', or screams if there's no window there.
@ -480,7 +486,6 @@ Default value of MODIFIERS is `shift'."
(defcustom windmove-display-no-select nil (defcustom windmove-display-no-select nil
"Whether the window should be selected after displaying the buffer in it." "Whether the window should be selected after displaying the buffer in it."
:type 'boolean :type 'boolean
:group 'windmove
:version "27.1") :version "27.1")
(defun windmove-display-in-direction (dir &optional arg) (defun windmove-display-in-direction (dir &optional arg)
@ -517,7 +522,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
((eq dir 'same-window) ((eq dir 'same-window)
(selected-window)) (selected-window))
(t (window-in-direction (t (window-in-direction
dir nil nil dir nil windmove-allow-all-windows
(and arg (prefix-numeric-value arg)) (and arg (prefix-numeric-value arg))
windmove-wrap-around 'nomini))))) windmove-wrap-around 'nomini)))))
(unless window (unless window
@ -606,8 +611,8 @@ With `M-0' prefix, delete the selected window and
select the window at direction DIR. select the window at direction DIR.
When `windmove-wrap-around' is non-nil, takes the window When `windmove-wrap-around' is non-nil, takes the window
from the opposite side of the frame." from the opposite side of the frame."
(let ((other-window (window-in-direction dir nil nil arg (let ((other-window (window-in-direction dir nil windmove-allow-all-windows
windmove-wrap-around 'nomini))) arg windmove-wrap-around 'nomini)))
(cond ((null other-window) (cond ((null other-window)
(user-error "No window %s from selected window" dir)) (user-error "No window %s from selected window" dir))
(t (t
@ -680,8 +685,8 @@ Default value of PREFIX is `C-x' and MODIFIERS is `shift'."
"Swap the states of the selected window and the window at direction DIR. "Swap the states of the selected window and the window at direction DIR.
When `windmove-wrap-around' is non-nil, takes the window When `windmove-wrap-around' is non-nil, takes the window
from the opposite side of the frame." from the opposite side of the frame."
(let ((other-window (window-in-direction dir nil nil nil (let ((other-window (window-in-direction dir nil windmove-allow-all-windows
windmove-wrap-around 'nomini))) nil windmove-wrap-around 'nomini)))
(cond ((or (null other-window) (window-minibuffer-p other-window)) (cond ((or (null other-window) (window-minibuffer-p other-window))
(user-error "No window %s from selected window" dir)) (user-error "No window %s from selected window" dir))
(t (t
@ -761,8 +766,7 @@ See `windmove-default-keybindings' for more detail."
(null val)) (null val))
(set-default sym val)) (set-default sym val))
:type windmove--default-keybindings-type :type windmove--default-keybindings-type
:version "28.1" :version "28.1")
:group 'windmove)
(defcustom windmove-display-default-keybindings nil (defcustom windmove-display-default-keybindings nil
"Default keybindings for windmove directional buffer display commands. "Default keybindings for windmove directional buffer display commands.
@ -780,8 +784,7 @@ See `windmove-display-default-keybindings' for more detail."
(null val)) (null val))
(set-default sym val)) (set-default sym val))
:type windmove--default-keybindings-type :type windmove--default-keybindings-type
:version "28.1" :version "28.1")
:group 'windmove)
(defcustom windmove-delete-default-keybindings nil (defcustom windmove-delete-default-keybindings nil
"Default keybindings for windmove directional window deletion commands. "Default keybindings for windmove directional window deletion commands.
@ -796,8 +799,7 @@ See `windmove-delete-default-keybindings' for more detail."
(null val)) (null val))
(set-default sym val)) (set-default sym val))
:type windmove--default-keybindings-type :type windmove--default-keybindings-type
:version "28.1" :version "28.1")
:group 'windmove)
(defcustom windmove-swap-states-default-keybindings nil (defcustom windmove-swap-states-default-keybindings nil
"Default keybindings for windmove's directional window swap-state commands. "Default keybindings for windmove's directional window swap-state commands.
@ -812,8 +814,7 @@ See `windmove-swap-states-default-keybindings' for more detail."
(null val)) (null val))
(set-default sym val)) (set-default sym val))
:type windmove--default-keybindings-type :type windmove--default-keybindings-type
:version "28.1" :version "28.1")
:group 'windmove)
(provide 'windmove) (provide 'windmove)