File: windmove.el.html

This package defines a set of routines, windmove-{left,up,right, down}, for selection of windows in a frame geometrically. For example, windmove-right selects the window immediately to the right of the currently-selected one. This functionality is similar to the window-selection controls of the BRIEF editor of yore.

One subtle point is what happens when the window to the right has been split vertically; for example, consider a call to windmove-right in this setup:

                   -------------
                   | | A |
                   | | |
                   | |-----
                   | * | | (* is point in the currently
                   | | B | selected window)
                   | | |
                   -------------

There are (at least) three reasonable things to do:
(1) Always move to the window to the right of the top edge of the
    selected window; in this case, this policy selects A.
(2) Always move to the window to the right of the bottom edge of
    the selected window; in this case, this policy selects B.
(3) Move to the window to the right of point in the selected
    window. This may select either A or B, depending on the
    position of point; in the illustrated example, it would select
    B.

Similar issues arise for all the movement functions. Windmove resolves this problem by allowing the user to specify behavior through a prefix argument. The cases are thus:
* if no argument is given to the movement functions, or the
  argument given is zero, movement is relative to point;
* if a positive argument is given, movement is relative to the top
  or left edge of the selected window, depending on whether the
  movement is to be horizontal or vertical;
* if a negative argument is given, movement is relative to the
  bottom or right edge of the selected window, depending on whether
  the movement is to be horizontal or vertical.


Another feature enables wrap-around mode when the variable windmove-wrap-around is set to a non-nil value. In this mode, movement that falls off the edge of the frame will wrap around to find the window on the opposite side of the frame. Windmove does the Right Thing about the minibuffer; for example, consider:

                   -------------
                   | * |
                   |-----------|
                   | A |
                   |-----------| (* is point in the currently
                   | B | C | selected window)
                   | | |
                   -------------

With wraparound enabled, windmove-down will move to A, while windmove-up will move to the minibuffer if it is active, or to either B or C depending on the prefix argument.

A set of default keybindings is supplied: shift-{left,up,right,down} invoke the corresponding Windmove function. See the installation section if you wish to use these keybindings.

Installation:

Put the following line in your init file:

    (windmove-default-keybindings) ; shifted arrow keys

or

    (windmove-default-keybindings 'hyper) ; etc.

to use another modifier key.

If you wish to enable wrap-around, also add a line like:

   (setq windmove-wrap-around t)


Acknowledgments:

Special thanks to Julian Assange (proff@iq.org), whose change-windows-intuitively.el predates Windmove, and provided the inspiration for it. Kin Cho (kin@symmetrycomm.com) was the first to suggest wrap-around behavior. Thanks also to Gerd Moellmann
(gerd@gnu.org) for his comments and suggestions.

Defined variables (14)

windmove--default-keybindings-typeCustomization type for windmove modifiers.
windmove-allow-all-windowsWhether the windmove commands are allowed to target all type of windows.
windmove-allow-repeated-command-overrideIf non-nil, using windmove commands twice overrides ‘no-other-window’.
windmove-create-windowWhether movement off the edge of the frame creates a new window.
windmove-default-keybindingsDefault keybindings for regular windmove commands.
windmove-delete-default-keybindingsDefault keybindings for windmove directional window deletion commands.
windmove-display-default-keybindingsDefault keybindings for windmove directional buffer display commands.
windmove-display-no-selectWhether the window should be selected after displaying the buffer in it.
windmove-modeNon-nil if Windmove mode is enabled.
windmove-mode-hookHook run after entering or leaving ‘windmove-mode’.
windmove-mode-mapMap used by ‘windmove-install-defaults’.
windmove-swap-states-default-keybindingsDefault keybindings for windmove’s directional window swap-state commands.
windmove-window-distance-deltaHow far away from the current window to look for an adjacent window.
windmove-wrap-aroundWhether movement off the edge of the frame wraps around.

Defined functions (38)

windmove-constrain-around-range(N MIN-N MAX-N)
windmove-constrain-loc-for-movement(COORD WINDOW DIR)
windmove-constrain-to-range(N MIN-N MAX-N)
windmove-coord-add(COORD1 COORD2)
windmove-default-keybindings(&optional MODIFIERS)
windmove-delete-default-keybindings(&optional PREFIX MODIFIERS)
windmove-delete-down(&optional ARG)
windmove-delete-in-direction(DIR &optional ARG)
windmove-delete-left(&optional ARG)
windmove-delete-right(&optional ARG)
windmove-delete-up(&optional ARG)
windmove-display-default-keybindings(&optional MODIFIERS)
windmove-display-down(&optional ARG)
windmove-display-in-direction(DIR &optional ARG)
windmove-display-left(&optional ARG)
windmove-display-new-frame(&optional ARG)
windmove-display-new-tab(&optional ARG)
windmove-display-right(&optional ARG)
windmove-display-same-window(&optional ARG)
windmove-display-up(&optional ARG)
windmove-do-window-select(DIR &optional ARG WINDOW CALLING-COMMAND)
windmove-down(&optional ARG IS-INTERACTIVE)
windmove-find-other-window(DIR &optional ARG WINDOW)
windmove-frame-edges(WINDOW)
windmove-install-defaults(PREFIX MODIFIERS ALIST &optional UNINSTALL)
windmove-left(&optional ARG IS-INTERACTIVE)
windmove-mode(&optional ARG)
windmove-other-window-loc(DIR &optional ARG WINDOW)
windmove-reference-loc(&optional ARG WINDOW)
windmove-right(&optional ARG IS-INTERACTIVE)
windmove-swap-states-default-keybindings(&optional MODIFIERS)
windmove-swap-states-down()
windmove-swap-states-in-direction(DIR)
windmove-swap-states-left()
windmove-swap-states-right()
windmove-swap-states-up()
windmove-up(&optional ARG IS-INTERACTIVE)
windmove-wrap-loc-for-movement(COORD WINDOW)

Defined faces (0)