dsemy.com [Up]

4.2 Window commands

Window commands are used to perform operations on specific windows, chosen by their ID (or the next window, if less than wincom-minimum (3 by default) windows are currently in scope). Alternatively, other commands available in wincom-command-map can be chosen. Not all commands in wincom-command-map are window commands (by default). For more information about included window commands, See Usage.

Window commands can easily be defined using wincom-define-window-command. For more complex use cases, the lower level wincom-run-window-command can be used.

User Option: wincom-minimum

Minimum number of tracked windows for which interactive selection occurs when using window commands. In practice, only window commands defined using wincom-define-window-command automatically adhere to this rule.

Variable: wincom--id-map

Key map which is populated automatically with elements corresponding to all tracked windows. The ID of each window is converted to a vector (to serve as a key sequence), and is bound to a command which calls last-command with the window corresponding to the ID as the sole argument. There should be no reason to modify it directly; it is reset whenever window configuration is updated.

Variable: wincom-command-map

Key map which holds bindings to window commands. This key map is set as the parent of wincom--id-map, so all window commands are available when it’s active (unless they are shadowed by a window ID).

Variable: wincom-window-count

Amount of windows currently tracked, including the minibuffer (if it’s active). It can be used to change the behavior of window commands (or display functions, See ID display).

Macro: wincom-define-window-command name (window [prefix]) [docstring] [keyword-arg...] body...

Define NAME as a window command with DOCSTRING as its documentation string. PREFIX (a symbol) is passed as an argument to the command (when not omitted or nil), with its value being the raw prefix argument.

BODY is used as the body of an anonymous function which receives WINDOW (a symbol) as an argument, with its value being a selected window. If there are less than wincom-minimum (3 by default) windows in the current scope (See Customization), the function is called with the window returned by next-window. In this case, if MINIBUFFER is non-nil, it can be selected if it’s active. Otherwise, the function is run using wincom-run-window-command.

Function: wincom-run-window-command fun

Run FUN as a window command. Run wincom-before-command-hook, set this-command to FUN, and set wincom--id-map as a transient map which runs wincom-after-command-hook on exit. The hooks run by this function are expected by Window Commander to run for any window command which requires ID selection; they should be run even if this function isn’t used when defining a new window command.