# cmdq_new_state

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L206
- **Page:** https://libtmux.org/en/tmux/3.2a/reference/c-function-cmdq_new_state/

```c
struct cmdq_state * cmdq_new_state(struct cmd_find_state *current, struct key_event *event, int flags)
```

## Parameters

- `current` (`struct cmd_find_state *`)
- `event` (`struct key_event *`)
- `flags` (`int`)

## Called by

- [`cmd_if_shell_callback`](/en/tmux/3.2a/reference/c-function-cmd-if-shell-c-cmd_if_shell_callback/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-if-shell.c#L177)
- [`cmdq_copy_state`](/en/tmux/3.2a/reference/c-function-cmdq_copy_state/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L239)
- [`cmdq_get_callback1`](/en/tmux/3.2a/reference/c-function-cmdq_get_callback1/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L649)
- [`cmdq_get_command`](/en/tmux/3.2a/reference/c-function-cmdq_get_command/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L482)
- [`key_bindings_dispatch`](/en/tmux/3.2a/reference/c-function-key_bindings_dispatch/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/key-bindings.c#L666)
- [`load_cfg`](/en/tmux/3.2a/reference/c-function-load_cfg/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cfg.c#L142)
- [`load_cfg_from_buffer`](/en/tmux/3.2a/reference/c-function-load_cfg_from_buffer/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cfg.c#L196)
- [`menu_key_cb`](/en/tmux/3.2a/reference/c-function-menu-c-menu_key_cb/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/menu.c#L333)
- [`mode_tree_run_command`](/en/tmux/3.2a/reference/c-function-mode_tree_run_command/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/mode-tree.c#L1202)

## Calls

- [`cmd_find_clear_state`](/en/tmux/3.2a/reference/c-function-cmd_find_clear_state/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L222)
- [`cmd_find_copy_state`](/en/tmux/3.2a/reference/c-function-cmd_find_copy_state/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L220)
- [`xcalloc`](/en/tmux/3.2a/reference/c-function-xcalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/cmd-queue.c#L211)

## Other function references

- [`cmd_find_valid_state`](/en/tmux/3.2a/reference/c-function-cmd_find_valid_state/) (function)

## Referenced by

- [`cmd_parse_from_arguments`](/en/tmux/3.2a/reference/c-function-cmd_parse_from_arguments/) (function)
- [`cmdq_insert_hook`](/en/tmux/3.2a/reference/c-function-cmdq_insert_hook/) (function)
- [`control_read_callback`](/en/tmux/3.2a/reference/c-function-control-c-control_read_callback/) (function)
- [`notify_insert_hook`](/en/tmux/3.2a/reference/c-function-notify-c-notify_insert_hook/) (function)

## Referenced declarations

- [`cmd_find_state`](/en/tmux/3.2a/reference/c-struct-cmd_find_state/) (struct)
- [`cmdq_state`](/en/tmux/3.2a/reference/c-struct-cmdq_state/) (struct)
- [`cmdq_state.current`](/en/tmux/3.2a/reference/c-struct-cmdq_state-current/) (attribute)
- [`cmdq_state.event`](/en/tmux/3.2a/reference/c-struct-cmdq_state-event/) (attribute)
- [`cmdq_state.flags`](/en/tmux/3.2a/reference/c-struct-cmdq_state-flags/) (attribute)
- [`key_event.key`](/en/tmux/3.2a/reference/c-struct-key_event-key/) (attribute)
- [`key_event`](/en/tmux/3.2a/reference/c-struct-key_event/) (struct)
- [`KEYC_NONE`](/en/tmux/3.2a/reference/c-define-tmux-h-keyc_none/) (constant)
- [`cmdq_state.references`](/en/tmux/3.2a/reference/c-struct-cmdq_state-references/) (attribute)
