1

With emacs 28 everything worked fine. After installing emacs-29 I see the following: for example typing "Meta + w" creates "H-M-w" which is undefined. With emacs-28 I got "M-w runs the command kill-ring-save" when I invoke describe key via "C-h c".

There is no mention of hyper-key anywhere in my emacs setup. Also "xmodmap -pm" shows that I have no hyper-key modifier defined. Also xev shows that keyboard generates a Meta_L event, no mention of hyper either.

I run emacs in GNU/Linux (opensuse 15.4).

What happens here?

I had a very similar problem when going from emacs-27 to emacs-28. I had to add some keymap translations for some Alt combinations like "A-Y". These were bound to some special symbols by emacs-28. For example I added

(define-key key-translation-map (kbd "A-Y") (kbd "A-Y"))

which reads a bit silly but binds A-Y to what you expect it should bind to (without that I get the Yuan currency symbol).

Similary adding

(define-key key-translation-map (kbd "H-M-w") (kbd "M-w"))

restores the expected behaviour for the kill-ring-save binding.

Edit: After some fiddling with xmodmap I have an idea that emacs might get confused by my xmodmap setup during startup.

I added "add Mod3 = Hyper_L" to my Xmodmap (and put Hyper_L on some unused key on my keyboard), and now "M-w" is just "M-w". Here is the output from "xmodmap -pm":

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c)
mod2        Super_L (0x42),  Super_L (0xce)
mod3        Hyper_L (0x7f),  Hyper_L (0xcf)
mod4        Meta_L (0x85),  Meta_R (0x86)
mod5        Mode_switch (0x87)

Without mod3 (i.e. no Hyper_L) as it was originally, emacs translates "M-w" to "H-M-w" and similar. To further test the emacs behaviour I removed the mod1 definition (mod1 empty, no Alt_L and Alt_R, but I left the keycode definitions for those two keysyms), and with that emacs translates "A-y" to "A-s-y", smuggling in a Super key, wherever this comes from. Emacs seems to mix actual keycodes with the modifier bits?

Any idea what magic emacs is pulling here? My xmodmap modifier definitions looks about right, considering the many examples for how to remap/add modifiers like caps lock, super, meta, windows keys etc.

I still do not understand why emacs (since version 28) translates "A-Y" to the Yuan currency symbol (and many other similar mappings).

8
  • 1
    What kind of emacs build? Specifically, is this a '--with-pgtk' build? system-configuration-features will tell you.
    – rpluim
    Commented Jul 24, 2023 at 13:25
  • system-configuration-features is "CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB"
    – mscfd
    Commented Jul 25, 2023 at 4:10
  • emacs is self build of emacs-29.1-rc1 tag. Configure command was "./configure --prefix=/home/.../local --with-sound=no --with-gnutls=yes"
    – mscfd
    Commented Jul 25, 2023 at 4:11
  • This sounds like the effect of some changes made in emacs-29 for modifier keys that sometimes interact badly with Gnome. Can you report it as a bug with M-x report-emacs-bug?
    – rpluim
    Commented Jul 25, 2023 at 9:00
  • I guess this is in answer to my edit in the main post (add hyper as key and modifier), right? I will try to report it, but I was somewhat discouraged by not finding any bugzilla or public issue tracker, just some obscure mailing lists. Thanks!
    – mscfd
    Commented Jul 25, 2023 at 9:37

1 Answer 1

1

Very likely an incompatibility of xkb and xmodmap: xkb defines modifiers but xmodmap does not override them completely (even with clear Mod1 or so).

E.g. when your xmodmap assigns a key to Mod4 and xkb had it already in Mod1, it will end up as a key for both modifiers.

You can verify this by xkbcomp :0 /tmp/keymap && grep Mod /tmp/keymap.

emacs-29 seems to be confused by this and might generate duplicate events.

You will probably have to migrate the xmodmap based setup to an xkb one.

1
  • Thanks, this looks interesting. I will have a deeper look at this if I find some time and motivation. My xmodmap modifications have worked for 20 years or so. I do not feel like I want to descend that deeply into the system. From the xkbcomp output I can see that for example mod2 still lists CAPS and SUPR. But capslock is cleared in my xmodmap. So it looks like that your suggestion might really be the root of this problem.
    – mscfd
    Commented Nov 13, 2023 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.