Subject: Re: bug#67070: 29.1; broken keybindings with emacs 29

From: Enrico Scholz <[email-masked]>
Date: Wed, 15 Nov 2023 18:55:58 +0100

Eshel Yaron <[email-masked]> writes:

>>> Emacs 29 seems to inject always a 'super' key event after 'meta'.
>>> E.g. when I try to press 'M-x', emacs reports
>>>
>>> | M-s-x is undefined
>>>
>>> Ditto with any other key combination which involves 'meta'.
>
> FWIW I had a similar issue a few weeks ago, with Emacs master.  I don't
> think it was an Emacs problem though, IIRC I ended up resolving it by
> tweaking my ~/.Xmodmap, adding or reordering a `clear` line.
>
> When you say that you press `M-x`, which key exactly are you pressing?

The key left of space (labeled "Alt") or right of it ("Alt Gr").

With xkbcomp from Fedora 38, I saw that '<SUPR>' was still assigned to
Mod4 ('xkbcomp :0 - | grep Mod4').  With Fedora 39 this is not the case
anymore (but problem still persists) and I can recover there by
reloading the xkb map

E.g. with xkbcomp-1.4.6:

1. setxkbmap && xmodmap ~/.Xmodmap

   --> emacs sees 'M-s-x'

2. xkbcomp :0 /tmp/bad && xkbcomp /tmp/bad :0

   --> emacs sees 'M-x' as expected

I solved to problem for me by switching to xkb; but this is much more
complicated than Xmodmap and because it seems to be impossible to clear a
'modifier_map' I have to copy & paste large parts of predefined keyboard
layouts.

> A good way to gain more insight here would be to start `xev` and note
> which keycodes it records when you say `M-x`.

KeyPress event, serial 30, synthetic NO, window 0xa600001,
    root 0x777, subw 0x0, time 196163413, (100,38), root:(2022,554),
    state 0x10, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0xa600001,
    root 0x777, subw 0x0, time 196169285, (100,38), root:(2022,554),
    state 0x50, keycode 53 (keysym 0x78, x), same_screen YES,
    XLookupString gives 1 bytes: (78) "x"
    XmbLookupString gives 1 bytes: (78) "x"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0xa600001,
    root 0x777, subw 0x0, time 196169413, (100,38), root:(2022,554),
    state 0x50, keycode 53 (keysym 0x78, x), same_screen YES,
    XLookupString gives 1 bytes: (78) "x"
    XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0xa600001,
    root 0x777, subw 0x0, time 196172045, (100,38), root:(2022,554),
    state 0x50, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

---

$ xmodmap -query
xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x42),  Control_R (0x69)
mod1        Alt_L (0x85),  Alt_R (0x87),  Alt_L (0xcc)
mod2        Num_Lock (0x4d)
mod3        ISO_Level5_Shift (0xcb)
mod4        Meta_L (0x40),  Meta_R (0x6c),  Meta_R (0x86),  Meta_L (0xcd)
mod5        ISO_Level3_Shift (0x5c)

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us

Enrico