# cmdq_new_state

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L208
- **Page:** https://libtmux.org/en/tmux/latest/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

- [`cmdq_copy_state`](/en/tmux/latest/reference/c-function-cmdq_copy_state/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L242)
- [`cmdq_get_callback1`](/en/tmux/latest/reference/c-function-cmdq_get_callback1/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L694)
- [`cmdq_get_command`](/en/tmux/latest/reference/c-function-cmdq_get_command/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L505)
- [`key_bindings_dispatch`](/en/tmux/latest/reference/c-function-key_bindings_dispatch/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/key-bindings.c#L708)
- [`load_cfg`](/en/tmux/latest/reference/c-function-load_cfg/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cfg.c#L138)
- [`load_cfg_from_buffer`](/en/tmux/latest/reference/c-function-load_cfg_from_buffer/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cfg.c#L190)
- [`menu_key_cb`](/en/tmux/latest/reference/c-function-menu_key_cb/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/menu.c#L501)
- [`mode_tree_run_command`](/en/tmux/latest/reference/c-function-mode_tree_run_command/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/mode-tree.c#L1476)

## Calls

- [`cmd_find_clear_state`](/en/tmux/latest/reference/c-function-cmd_find_clear_state/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L224)
- [`cmd_find_copy_state`](/en/tmux/latest/reference/c-function-cmd_find_copy_state/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L222)
- [`xcalloc`](/en/tmux/latest/reference/c-function-xcalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L213)

## Other function references

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

## Referenced by

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

## Referenced declarations

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