emacs-evil / evil

The extensible vi layer for Emacs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to rebind "C-g" with "M-g"

hc36123 opened this issue · comments

Issue type

  • Question
  • Help wanted

Environment

Emacs version: <28.2>
Operating System: <Windows 10+Cygwin>
Evil version: <1.15.0>
Evil installation type: ELPA
Graphical/Terminal: Graphical
Tested in a make emacs session: No

Reproduction steps

  • Start Emacs
  • M-x eval-expression, type (define-key key-translation-map (kbd "M-g") (kbd "C-g"))
  • M-x xxxxxx, type M-g or C-g, return Quit successfully
  • :w xxxxxx, type M-g or C-g, return Quit successfully
  • C-x, type C-g return Quit, however, it doesn't work with M-g

Expected behavior

C-x, then M-g should result a successful Quit

Actual behavior

Further notes

@hc36123 what does this have to do with evil? I can't see any calls to evil fns in your repro steps. Are you just saying this behaviour occurs with evil-mode enabled, but not when it isn't?

In evil mode, C-g after C-x helps to quit the C-x, which is fantastic if I want to cancel a mistyped C-x. This feature doesn't work in the normal emacs state (when evil-mode is disabled), and I guess it may be a feature provided by Evil. After rebinding M-g to C-g, I found M-g can not cancel the prefix argument C-x. This is not an Evil bug. I just need help to figure out why this rebinding does not work.