Some Emacs bindings don't work in the terminal, a big example is `C-M-%` , `query-replace-regexp` https://stackoverflow.com/questions/71302860/emacs-terminal-... to do a regex find and replace.
Some Emacs bindings don't work in the terminal, a big example is `C-M-%` , `query-replace-regexp` https://stackoverflow.com/questions/71302860/emacs-terminal-... to do a regex find and replace.
Yeah, that is one of the main reasons I don't use emacs in a terminal much (the main exception being that I use emacsclient with -t for terminal mode as $EDITOR and for quick editing). Some key bindings just don't work properly.
Works fine for me. Is it your terminal configuration that needs tweaking?
The reason is listed at the bottom of the page: "You can't type C-M-% on the terminal is because C-% is not part of the standard control codes." This page lists the standard control codes https://en.wikipedia.org/wiki/C0_and_C1_control_codes (e.g., `^_`). There are only a few special characters that are recognized by a terminal with control (while all the letter keys are [although I think shift and lowercase are combined?]).
Everything is recognized with the meta, because meta just sends an escape sequence followed by the key code for the other characters.
With all that said, there are thousands of reasons it could be working for you "it's just software" so anything can be programmed, but I'm not aware of say a terminal spec that supports more control codes. Usually when this works it's because the user has implemented one of the many workarounds available online (e.g., change the terminal emulator to send a different key code, and change Emacs to use that key code for the command). It's also possible the terminal emulator you're using has custom support built-in specially for Emacs.
I could fix this myself if I wanted to, but I've just found it's better for my sanity to work with terminal emulators as a clear spec (which includes only the limited set of control character codes) rather than work against that. For an example of how much work this can be to maintain, this is fixing all the discrepancies I've found in Alacritty where it doesn't send the correct key code by default https://github.com/robenkleene/Dotfiles/blob/4d06e9855465c00... I mainly did that to make terminal Emacs usable in Alacritty.
With all that said, if you have another terminal emulator handy, I'd be super curious if it works with that one as well.
Regarding your last sentence, I don't know the answer. If you really want to find out I would make an educated guess that it is one of the more feature-rich modern terminal applications (like kitty, wezterm, alacritty, ghostty)
Oh it's also possible it's triggering `M-%` instead of `C-M-%`, `M-%` definitely usually works (just an escape sequence followed by percent character). `C-h k` followed by the binding will of course show what command is triggered, `M-%` is the non-regex variant `query-replace`.