# cmdq_insert_hook

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L353
- **Page:** https://libtmux.org/en/tmux/latest/reference/c-function-cmdq_insert_hook/

```c
void cmdq_insert_hook(struct session *s, struct cmdq_item *item, struct cmd_find_state *current, const char *fmt,...)
```

## Parameters

- `s` (`struct session *`)
- `item` (`struct cmdq_item *`)
- `current` (`struct cmd_find_state *`)
- `fmt` (`const char *`)
- `` (`...`)

## Called by

- [`cmd_new_session_exec`](/en/tmux/latest/reference/c-function-cmd-new-session-c-cmd_new_session_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-new-session.c#L362)
- [`cmd_new_window_exec`](/en/tmux/latest/reference/c-function-cmd-new-window-c-cmd_new_window_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-new-window.c#L163)
- [`cmd_select_pane_exec`](/en/tmux/latest/reference/c-function-cmd-select-pane-c-cmd_select_pane_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-select-pane.c#L242)
- [`cmd_select_window_exec`](/en/tmux/latest/reference/c-function-cmd-select-window-c-cmd_select_window_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-select-window.c#L125)
- [`cmd_split_window_exec`](/en/tmux/latest/reference/c-function-cmd-split-window-c-cmd_split_window_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-split-window.c#L235)
- [`cmdq_fire_command`](/en/tmux/latest/reference/c-function-cmd-queue-c-cmdq_fire_command/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L662)

## Calls

- [`args_first`](/en/tmux/latest/reference/c-function-args_first/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L405)
- [`args_first_value`](/en/tmux/latest/reference/c-function-args_first_value/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L417)
- [`args_get`](/en/tmux/latest/reference/c-function-args_get/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L407)
- [`args_next`](/en/tmux/latest/reference/c-function-args_next/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L425)
- [`args_next_value`](/en/tmux/latest/reference/c-function-args_next_value/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L422)
- [`args_print`](/en/tmux/latest/reference/c-function-args_print/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L397)
- [`cmd_get_args`](/en/tmux/latest/reference/c-function-cmd_get_args/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L358)
- [`cmdq_add_format`](/en/tmux/latest/reference/c-function-cmdq_add_format/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L395)
- [`cmdq_append`](/en/tmux/latest/reference/c-function-cmdq_append/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L436)
- [`cmdq_free_state`](/en/tmux/latest/reference/c-function-cmdq_free_state/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L441)
- [`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#L432)
- [`cmdq_insert_after`](/en/tmux/latest/reference/c-function-cmdq_insert_after/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L434)
- [`log_debug`](/en/tmux/latest/reference/c-function-log_debug/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L388)
- [`options_array_first`](/en/tmux/latest/reference/c-function-options_array_first/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L428)
- [`options_array_item_value`](/en/tmux/latest/reference/c-function-options_array_item_value/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L430)
- [`options_array_next`](/en/tmux/latest/reference/c-function-options_array_next/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L438)
- [`options_get`](/en/tmux/latest/reference/c-function-options_get/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L383)
- [`xsnprintf`](/en/tmux/latest/reference/c-function-xsnprintf/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L402)
- [`xvasprintf`](/en/tmux/latest/reference/c-function-xvasprintf/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-queue.c#L380)

## Other function references

- [`args_count`](/en/tmux/latest/reference/c-function-args_count/) (function)
- [`args_string`](/en/tmux/latest/reference/c-function-args_string/) (function)
- [`cmdq_new_state`](/en/tmux/latest/reference/c-function-cmdq_new_state/) (function)

## Referenced declarations

- [`cmdq_item.cmd`](/en/tmux/latest/reference/c-struct-cmdq_item-cmd/) (attribute)
- [`cmd_find_state`](/en/tmux/latest/reference/c-struct-cmd_find_state/) (struct)
- [`options_value.cmdlist`](/en/tmux/latest/reference/c-union-options_value-cmdlist/) (attribute)
- [`cmdq_item`](/en/tmux/latest/reference/c-struct-cmdq_item/) (struct)
- [`CMDQ_STATE_NOHOOKS`](/en/tmux/latest/reference/c-define-tmux-h-cmdq_state_nohooks/) (constant)
- [`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)
- [`global_s_options`](/en/tmux/latest/reference/c-variable-global_s_options/) (attribute)
- [`session.options`](/en/tmux/latest/reference/c-struct-session-options/) (attribute)
- [`session`](/en/tmux/latest/reference/c-struct-session/) (struct)
- [`cmdq_item.state`](/en/tmux/latest/reference/c-struct-cmdq_item-state/) (attribute)
