# libtmux:set-buffer

- **Package:** libtmux
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/buffers.lisp#L64
- **Public owner:** libtmux
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-set-buffer/

```
(set-buffer client data &key name append cancel-token timeout output-limit)
```

Store literal DATA in a named or automatic buffer; return a COMMAND-OUTCOME.
DATA is a NUL-free string or an octet vector. Strings use tmux [set-buffer](/en/tmux/latest/manual/set-buffer/);
octets use its [load-buffer](/en/tmux/latest/manual/load-buffer/) stdin path and preserve NUL and invalid UTF-8.
APPEND is available only for strings. Empty DATA is tmux's no-op and preserves
an existing buffer. NAME is literal; omission creates an automatic name.
New names reject backslashes, ASCII controls and DEL before I/O because tmux
versions otherwise rewrite or reject them. Spaces and Unicode are supported.
Signals INVALID-ARGUMENT or an operational condition.

## Parameters

- `client`
- `data`
- `name?`
- `append?`
- `cancel-token?`
- `timeout?`
- `output-limit?`

## tmux command

The tmux commands behind `set-buffer`.

- [`load-buffer`](/en/tmux/latest/manual/load-buffer/)
- [`set-buffer`](/en/tmux/latest/manual/set-buffer/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_load_buffer_entry`](/en/tmux/latest/reference/c-variable-cmd_load_buffer_entry/) (attribute)
- [`cmd_load_buffer_exec`](/en/tmux/latest/reference/c-function-cmd-load-buffer-c-cmd_load_buffer_exec/) (function)
- [`cmd_set_buffer_entry`](/en/tmux/latest/reference/c-variable-cmd_set_buffer_entry/) (attribute)
- [`cmd_set_buffer_exec`](/en/tmux/latest/reference/c-function-cmd-set-buffer-c-cmd_set_buffer_exec/) (function)

## Guides

Pages that discuss `set-buffer`.

- [Explicit operations](/en/lisp/latest/guides/operations/)
