3

I recently decided to try Emacs. One of the things I found extremely frustrating about the software was that most of the time when I held down the spacebar, I would only get one space character inserted, and a message saying

<Hangul> is undefined

in the echo area. Pressing space once worked fine, and I could achieve multiple space characters by repeatedly pressing the spacebar, but holding down the spacebar did not work as expected. I went to Google to troubleshoot, but aside from this thread I couldn't find much information about it. I did luck onto the solution that hitting numlock seemed to fix the issue, however I needed to do that every time I opened Emacs (and perhaps every time I opened a new buffer -- I didn't play around with it too much.)

I opened up xev, and found that holding down the spacebar mostly produced space characters, as expected, however there were time it produced Hangul. Here is some sample output

KeyPress event, serial 34, synthetic NO, window 0x2800001,
    root 0x6c4, subw 0x0, time 2848166447, (-197,490), root:(767,510),
    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "
    XmbLookupString gives 1 bytes: (20) " "
    XFilterEvent returns: False

KeyPress event, serial 34, synthetic NO, window 0x2800001,
    root 0x6c4, subw 0x0, time 2848166463, (-197,490), root:(767,510),
    state 0x0, keycode 130 (keysym 0xff31, Hangul), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x2800001,
    root 0x6c4, subw 0x0, time 2848166511, (-197,490), root:(767,510),
    state 0x0, keycode 130 (keysym 0xff31, Hangul), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x2800001,
    root 0x6c4, subw 0x0, time 2848166567, (-197,490), root:(767,510),
    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "
    XFilterEvent returns: False

It was hard to reproduce this error, and I could not tell anything that I was doing differently when it happened, however whenever I did see that error it seemed to follow this Keypress Keypress Keyrelease Keyrelease pattern.

I used the command xkbcomp $DISPLAY my_keymap.xkb, and I've uploaded the file to github in case it is helpful. Hangul is defined there, but I still don't understand how it's being triggered.

Some additional information that I think might be helpful:

  • I am using a qwerty keyboard

  • I am using Linux Mint 19.2

  • Though apparently this is a system wide problem, since it's being detected by xev, I have not noticed this cause any weird behavior in applications that I am running with the exception of Emacs. If I had not run Emacs, I would probably not know about this.

  • The output of setxkbmap -query is

    rules: evdev model: pc105 layout: us

Any help resolving this would be appreciated.

6
  • Have you tested this with another keyboard? Might be good to rule out hardware.
    – 111---
    Oct 27, 2020 at 18:49
  • I think 111 is correct, it looks like a hardware issue. Test it with showkey in the virtual console and report back if two different keycodes are returned for each space bar press.
    – Quasímodo
    Oct 27, 2020 at 20:01
  • @Quasímodo Running showkey, I am, occasionally, getting two keycodes for a spacebar press (and release): 57 and 122. Mostly it's just 57. But sometimes I get 122 as well. I will see if I can find another keyboard to try this out with. Could this potentially be a driver issue? Oct 27, 2020 at 20:21
  • It may be, it may not. What if you remap hangul to space with Xmodmap?
    – Quasímodo
    Oct 28, 2020 at 11:44
  • @Quasímodo It works as it should be 75% of the time, but the other 25% of the time a spacebar press and release will enter two space characters or a spacebar press and hold will enter two spaces and nothing else. Oct 28, 2020 at 14:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.