# next-window(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

next-window - Move the cursor to the next window
previous-window - Move the cursor to the previous window

## SYNOPSIS

n next-window (C-x o)
n previous-window (C-x p)

## DESCRIPTION

next-window makes the next window down the current window, if the current window is the last one in the frame the first one is selected. The numeric argument n can be used to modify this default behaviour, it is a bitwise flag where the bits are defined as follows:

0x01

If there is no 'next' window because this is the last then if this bit is set the search for the next window is allow to continue with the first window of the frame. As the default argument n is `1` this is the default behaviour.

0x02

When this bit is set windows whose $window-flags(5) are set to be ignored by this command are not skipped. The setting of bit `0x010` of a windows $window-flags will make the default action of this command skip it which means the the command may not simply select the next window but the next window without this flag set. Setting this bit of the numeric argument will force the command to always select the next window.

0x04

When set the search for the next window starts at the first window instead of the current window, this can be used to find the first window in the current frame.

previous-window makes the next window up the current window. The numeric argument n has the same effect on this command as for next-window except bit 0x04 starts the search at the last window of the frame.

## EXAMPLE

The following example visits every window in the current frame printing the buffer it displays with a second pause between each one:

    ; go to the first window
    !force 6 next-window
    !while $status
        1000 ml-write $buffer-bname
        ; go to the next window - fail if this is the last
        !force 2 next-window
    !done

## NOTES

Both commands fail if a suitable window cannot be for, see the example on how this can be used.

## SEE ALSO

next-window-find-buffer(2), next-window-find-file(2), set-position(2), goto-position(2), $window-flags(5).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>