# next-buffer(2)

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

## NAME

next-buffer - Switch to the next buffer
find-buffer - Switch to the next buffer

## SYNOPSIS

n next-buffer (C-x x)
n find-buffer "buffer-name" (C-x b)

## DESCRIPTION

next-buffer switches to the nth next buffer in the buffer list in the current window, the default n is `1`, if n is negative then the `0-`nth previous buffer is selected. If `0` or a number greater than the number of buffers is specified then the command fails.

find-buffer switches to buffer "buffer-name" in the current window. If the buffer does not exist and a zero argument n is supplied then the command fails. If the buffer does not exist but no argument or a positive argument n is specified then a new buffer is created, at which point the file-hook is evaluated.

If a negative argument n is given to find-buffer then the buffer will be hidden. Any window displaying "buffer-name" will find another buffer to display. This functionality is often used with the hide(2m) buffer mode. If a value of -1 is given then the buffer will not be hidden in a window whose $window-flags(5) are set to lock the buffer to the window. If a value of less than -1 is given then the buffer is hidden from all windows.

The numeric argument of find-buffer is treated as a bit mask as follows:

`0x01`

Bit set then the buffer is created if it does not exist. Bit clear then the command fails if the buffer does not exist.

`0x02`

Locate the buffer whose buffer file name matches the argument buffer-name.

`0x04`

Bit set then an inactive buffer (i.e. a buffer whose contents have not been loaded) shall remain inactive and the buffer contents shall not be restored from file. This bit setting is used to allow the buffer variables to be interrogated without causing the file to load. Setting of this bit must be used with care.

`0x08`

Bit set causes the buffer to be hidden.

`0x10`

Forces the buffer to be hidden from all windows.

`0x20`

Stop the history of the outgoing buffer from being incremented.

If the current buffer has an $buffer-ehook command set then this command is executed before the new buffer is switched in. If the new buffer has a $buffer-bhook command set then this command is automatically executed after the new buffer is switched in but before control returns to the user.

## SEE ALSO

next-window-find-buffer(2), hide(2m).

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

</HMTL>