homebrew-emacs-plus icon indicating copy to clipboard operation
homebrew-emacs-plus copied to clipboard

`--with-xwidgets` changes behavior of ESC in GUI

Open winmillwill opened this issue 3 years ago • 7 comments

I'm not heartbroken about this since, for my browser needs, the feature just isn't there yet, but I was surprised that evil escape just stopped working in the GUI. I was still able to use ESC in the terminal, ^[ in the GUI would work right, but maybe something about dipping into X made emacs go "oh, it's Linux" and stop seeing ESC? FWIW, karabiner event viewer shows HID code 41 for both my ctrl-press -> esc remap and for the "real" esc key.

winmillwill avatar Mar 17 '21 00:03 winmillwill

Curious issue. And I still don't know the answer. Maybe there are other xwidgets users who can help? @agzam as far as I remember you were the most active user of this feature 😸 Do you have this issue?

d12frosted avatar Apr 06 '21 07:04 d12frosted

I did notice - ESC key sometimes does strange things, and I'm not sure if that's core, xwidgets, Spacemacs, or my local config issue. Like for example:

  • when the frame is undecorated (borderless) ESC may stop working altogether. I have to switch to windowed-frame and back to undecorated to fix that
  • for some reason when I'm in full-screen mode with (setq ns-use-native-fullscreen t), pressing ESC switches back to non-fullscreen. That doesn't bother me, since I don't use native-fullscreen.

agzam avatar Apr 06 '21 17:04 agzam

Also having this issue which makes it unusable unfortunately (emacs 28 plus native comp + xwidgets, on M1 Monterey, Doom emacs) as esc stops working intermittently. Is this related to installing with xwidgets?

matteha avatar Nov 03 '21 02:11 matteha

xwidget has this bug (I'm not sure, this might be it https://github.com/veshboo/emacs/issues/4). The only workaround I have found, and it looks like works for me - you need to click somewhere within the frame manually, using the mouse (I know, I hate that too). All my attempts to resolve this with elisp: focusing programmatically, selecting objects, emulating mouse-clicks, using timers - they all were unsuccessful.

agzam avatar Nov 03 '21 04:11 agzam

@agzam thanks for the link. Looks like there is proposed solution, it's just no one brought it here.

I've no ability to test it myself, so the best course of action would be if someone tests this patch. I can guide you on this 😸 So if anyone wants to contribute this possible fix to Emacs+, just ping me and I will help with that. Maybe @matteha @agzam or @winmillwill ?

d12frosted avatar Nov 04 '21 07:11 d12frosted

I also have this annoying behavior when the Escape key is inaccessible after interacting with a xwidget.

you need to click somewhere within the frame manually, using the mouse (I know, I hate that too)

For me, this is also the only workaround to fix this which isn't too nice.


So I just tested the patch in https://github.com/veshboo/emacs/issues/4 on emacs-plus@30 on macOS 14.0 - and it works flawlessly. The Escape key behavior is not modified anymore.

I'd love to see this merged here, but maybe someone else can test this as well? 🙂

Dima-369 avatar Nov 05 '23 09:11 Dima-369

and it works flawlessly

The patch only works for the "escape" key, but I've noticed that the arrow keys are also stuck on interacting with an XWidget. And they can only be fixed when you click inside the Emacs window manually.

The linked patch does not help with that.

Dima-369 avatar Nov 07 '23 09:11 Dima-369