GNU bug report logs - #66558
29.1; .Xmodmap Win-key configurations cause keybinding issues

Previous Next

Package: emacs;

Reported by: Dev Null <patriot.game <at> gmail.com>

Date: Sun, 15 Oct 2023 14:49:01 UTC

Severity: normal

Found in version 29.1

To reply to this bug, email your comments to 66558 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#66558; Package emacs. (Sun, 15 Oct 2023 14:49:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dev Null <patriot.game <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 15 Oct 2023 14:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dev Null <patriot.game <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; .Xmodmap Win-key configurations cause keybinding issues
Date: Sun, 15 Oct 2023 04:44:18 -0400
[Message part 1 (text/plain, inline)]
The following lines of my '~/.Xmodmap' file remap my left Win key
to Ctrl:

remove mod4 = Super_L
add control = Super_L

When I run GUI Emacs with this in place, entering any keybinding 'C-s-X
is undefined', where X is the key that I pressed. E.g. if I press 'C-n',
I get the following:

'C-s-n is undefined'

In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.17.8)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Arch Linux

Configured using:
 'configure --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib
 --with-tree-sitter --localstatedir=/var --with-cairo
 --disable-build-details --with-harfbuzz --with-libsystemd
 --with-modules --with-x-toolkit=gtk3 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2
 -Wformat -Werror=format-security -fstack-clash-protection
 -fcf-protection -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 36436 12851)
 (symbols 48 5151 0)
 (strings 32 13179 1298)
 (string-bytes 1 373971)
 (vectors 16 9324)
 (vector-slots 8 148882 13860)
 (floats 8 21 23)
 (intervals 56 234 0)
 (buffers 984 10))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66558; Package emacs. (Mon, 16 Oct 2023 00:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 66558 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Dev Null <patriot.game <at> gmail.com>
Cc: 66558 <at> debbugs.gnu.org
Subject: Re: bug#66558: 29.1; .Xmodmap Win-key configurations cause
 keybinding issues
Date: Mon, 16 Oct 2023 08:56:09 +0800
Dev Null <patriot.game <at> gmail.com> writes:

> The following lines of my '~/.Xmodmap' file remap my left Win key
> to Ctrl:
>
> remove mod4 = Super_L
> add control = Super_L
>
> When I run GUI Emacs with this in place, entering any keybinding 'C-s-X
> is undefined', where X is the key that I pressed. E.g. if I press 'C-n',
> I get the following:
>
> 'C-s-n is undefined'

My powers of clairvoyance enable me to deduce that another key is bound
to control, in all likelihood Control_L.  You must remove _every_ key
from a real modifier you rebind, or Emacs will rightly attribute to
events with it pressed the detritus of previous bindings that remains.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66558; Package emacs. (Mon, 16 Oct 2023 10:44:01 GMT) Full text and rfc822 format available.

Message #11 received at 66558 <at> debbugs.gnu.org (full text, mbox):

From: Dev Null <patriot.game <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 66558 <at> debbugs.gnu.org
Subject: Re: bug#66558: 29.1;
 .Xmodmap Win-key configurations cause keybinding issues
Date: Mon, 16 Oct 2023 05:52:16 -0400
[Message part 1 (text/plain, inline)]
Sorry, I’m a little confused. The Win key appears to be recognized by Emacs
as the ’S’ modifier. If I run Emacs without that .Xmodmap file, and I hit
the left win key + n, I get ’S-n’. If I use an Xmodmap file consisting of
just those two lines and hit the left win key + n, I get 'C-s-n'. So it
appears that after the Xmodmap is read, Emacs is still recognizing my Win
key as being bound to super, while other programs on my system don't seem
to have that issue. I'm having trouble understanding why keys bound to
control are the issue here.

On Sun, Oct 15, 2023 at 8:56 PM Po Lu <luangruo <at> yahoo.com> wrote:

> Dev Null <patriot.game <at> gmail.com> writes:
>
> > The following lines of my '~/.Xmodmap' file remap my left Win key
> > to Ctrl:
> >
> > remove mod4 = Super_L
> > add control = Super_L
> >
> > When I run GUI Emacs with this in place, entering any keybinding 'C-s-X
> > is undefined', where X is the key that I pressed. E.g. if I press 'C-n',
> > I get the following:
> >
> > 'C-s-n is undefined'
>
> My powers of clairvoyance enable me to deduce that another key is bound
> to control, in all likelihood Control_L.  You must remove _every_ key
> from a real modifier you rebind, or Emacs will rightly attribute to
> events with it pressed the detritus of previous bindings that remains.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66558; Package emacs. (Mon, 16 Oct 2023 11:01:01 GMT) Full text and rfc822 format available.

Message #14 received at 66558 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Dev Null <patriot.game <at> gmail.com>
Cc: 66558 <at> debbugs.gnu.org
Subject: Re: bug#66558: 29.1; .Xmodmap Win-key configurations cause
 keybinding issues
Date: Mon, 16 Oct 2023 18:59:45 +0800
Dev Null <patriot.game <at> gmail.com> writes:

> Sorry, I’m a little confused. The Win key appears to be recognized by
> Emacs as the ’S’ modifier. If I run Emacs without that .Xmodmap file,
> and I hit the left win key + n, I get ’S-n’. If I use an Xmodmap file
> consisting of just those two lines and hit the left win key + n, I get
> 'C-s-n'. So it appears that after the Xmodmap is read, Emacs is still
> recognizing my Win key as being bound to super, while other programs
> on my system don't seem to have that issue. I'm having trouble
> understanding why keys bound to control are the issue here.

My mistake.  When you rebind Super to a non-virtual modifier bit such as
control through xmodmap, the XKB virtual modifier Super is also assigned
to that bit.

Emacs 29 no longer respects such misconfigurations when the XKB
extension is enabled on the X server.  Since the control modifier bit is
furthermore uniformly interpreted as Control, any event arriving with
ControlMask set always matches both the predefined Control modifier and
the Super virtual modifier established during display setup.  I think
the solution is for you to assign the Super keysyms to Control through
XKB, while I devise a fix for Emacs 30.




This bug report was last modified 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.