doomemacs / doomemacs/core

doom/escape is not bound in insert mode

Open
#6,304 2 comments 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### What did you expect to happen?

- When `C-g/ESC` is pressed in insert mode, I thought the `doom/escape` will run, and if none of the functions in `doom-escape-hook` return non-nil value `keyboard-quit` will be executed eventually.

Is there anyway to trigger `doom/escape` when `C-g/ESC` is pressed in insert mode. I want to use `doom-escape-hook` to close the current corfu completion box when the first time `ESC` is clicked and only go to normal state when `ESC` is pressed the second time.

### What actually happened?

- It seems `escape` is bound to `evil-normal-state` in insert mode, which doesn't seem to call `doom/escape`
```
runs the command evil-normal-state (found in evil-insert-state-map),
which is an interactive native compiled Lisp function in ‘evil-states.el’.

It is bound to .

(evil-normal-state &optional ARG)
```

- `escape` is bound to `evil-force-normal-state` in normal mode, which do call seem to call `doom/escape`
```
evil-force-normal-state is an interactive and byte-compiled function
defined in evil-commands.el.

Signature
(evil-force-normal-state)
```

```
115,173 2% - evil-force-normal-state
115,173 2% - apply
115,093 2% - #
115,093 2% - apply
86,045 1% - +evil-escape-a
86,045 1% + if
29,048 0% + #
80 0% evil-snipe--cleanup
87,364 1% - evil-normal-state
18,816 0% - evil-normalize-keymaps
18,816 0% - evil-state-keymaps
9,408 0% - evil-state-keymaps
4,704 0% evil-state-auxiliary-keymaps
4,704 0% evil-state-intercept-keymaps
4,704 0% evil-state-auxiliary-keymaps
4,704 0% evil-state-intercept-keymaps
2,048 0% - evil-change-state
2,048 0% - evil-insert-state
2,048 0% evil-normalize-keymaps
1,016 0% evil-refresh-mode-line
```

### Describe your attempts to resolve the issue

_No response_

### Steps to reproduce

1. Press `ESC` in insert mode
2. Press `ESC` in normal mode

### System Information

https://pastebin.com/0QyCuUSj

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.