# libtmux:set-environment

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

```
(set-environment client name value &key scope target format-p hidden cancel-token timeout output-limit)
```

Set one raw tmux environment entry and return its COMMAND-OUTCOME.
SCOPE is required: :GLOBAL rejects TARGET; :SESSION requires a captured session.
NAME must match [A-Za-z_][A-Za-z0-9_]*. VALUE is literal unless FORMAT-P
explicitly requests tmux format expansion. HIDDEN sets tmux's hidden flag.
This mutates one raw table, not an effective merged child environment. Never
retries or refreshes captured observations. See UNSET-ENVIRONMENT for deletion
and REMOVE-ENVIRONMENT for an explicit tombstone.

See also: `libtmux:remove-environment`, `libtmux:unset-environment`.

## Parameters

- `client`
- `name`
- `value`
- `scope?`
- `target?`
- `format-p?`
- `hidden?`
- `cancel-token?`
- `timeout?`
- `output-limit?`

## tmux command

The tmux commands behind `set-environment`.

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

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_set_environment_entry`](/en/tmux/latest/reference/c-variable-cmd_set_environment_entry/) (attribute)
- [`cmd_set_environment_exec`](/en/tmux/latest/reference/c-function-cmd-set-environment-c-cmd_set_environment_exec/) (function)

## Guides

Pages that discuss `set-environment`.

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