When I am editing text, if I press and release the spacebar it works as expected. However, if I hold down the spacebar I get the following message in the echo area.

<Hangul> is undefined

I saw this thread, which suggested that it may be a keyboard layout issue.

setxkbmap -query in my terminal gives me

rules:      evdev
model:      pc105
layout:     us

I'm fairly new to Emacs and not sure what to try here?

I tried this with emacs -Q and the problem persisted. I'm using Emacs 27.1 with Linux Mint 19.2.

Adding some more information based on the comments.

1.) Starting Emacs as env -u XMODIFIERS emacs did not fix the issue.

2.) xev does detect spacebars as expected. Here is an example of the output

KeyPress event, serial 34, synthetic NO, window 0x2e00001,
    root 0x6c4, subw 0x0, time 2814496416, (-585,698), root:(379,718),
    state 0x10, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "
    XmbLookupString gives 1 bytes: (20) " "
    XFilterEvent returns: False

I noticed that the state goes to 0x0 after hitting numlock. I fired up Emacs and after hitting numlock the spacebar worked properly. However, it seems I need to hit numlock every time I start up Emacs.

I created the following file: xkbcomp $DISPLAY my_keymap.xkb. I found the following lines containing something Hangul related:

 <HNGL> = 130;
key <HNGL> {         [          Hangul ] };

 <HJCV> = 131;
key <HJCV> {         [    Hangul_Hanja ] };

Additionally, here are the modifier maps:

modifier_map Control { <LCTL> };
modifier_map Shift { <LFSH> };
modifier_map Shift { <RTSH> };
modifier_map Mod1 { <LALT> };
modifier_map Lock { <CAPS> };
modifier_map Mod2 { <NMLK> };
modifier_map Mod5 { <LVL3> };
modifier_map Control { <RCTL> };
modifier_map Mod1 { <RALT> };
modifier_map Mod4 { <LWIN> };
modifier_map Mod4 { <RWIN> };
modifier_map Mod5 { <MDSW> };
modifier_map Mod1 { <META> };
modifier_map Mod4 { <SUPR> };
modifier_map Mod4 { <HYPR> };

I'm still not sure why Emacs is reading Hangul anywhere, so I'm still lost. But at least I can hit numlock at the beginning.

3.) C-h k brings up the following in Emacs:

SPC runs the command evil-forward-char (found in
evil-motion-state-map), which is an interactive compiled Lisp function
in ‘evil-commands.el’.

It is bound to <right>, SPC, l.

(evil-forward-char &optional COUNT CROSSLINES NOERROR)

Move cursor to the right by COUNT characters.
Movement is restricted to the current line unless CROSSLINES is non-nil.
If NOERROR is non-nil, don’t signal an error upon reaching the end
of the line or the buffer; just return nil.
  • 1
    Do you have the same problem if you start Emacs without your init file (emacs -Q)?
    – Dan
    Oct 26, 2020 at 19:01
  • Yes, I should have mentioned this. I'll add that in to my OP. Oct 26, 2020 at 19:01
  • Can you try starting Emacs as "$ env -u XMODIFIERS emacs"? See debbugs.gnu.org/db/19/19487.html . It's also good to include 3 other info: For the troublesome key (chord) (1) C-h k inside emacs (2) xev outside (3) input method settings in between
    – Rusi
    Oct 27, 2020 at 3:35
  • Hi @Rusi, thanks for looking. I tried your first three suggestions, and edited the OP accordingly. However, I'm not sure what you mean by (3) input method settings in between. Thank you! Oct 27, 2020 at 5:25
  • At shell what does $ echo $XMODIFIERS show? If it's set it (could be) your input method . Run a web search for (eg) xim uim fcitx ibus
    – Rusi
    Oct 27, 2020 at 5:34

1 Answer 1


sorry for kinda necro posting, but someone might find this useful. I stuck into Hangul_Hanja problem after installing emacs as well. After some research and conclusion, that's it's a hardware problem, I decided to look inside hardware. And voila. It is a hardware problem, because keyboard manufacturer didn't remove the rubber button beneath the spacebar which in fact is hangul_hanja key, and it naturally gets pressed when someone presses spacebar!!! After removing the rubber button from the hangul_hanja key hole, everything is working as expected. cheap keyboard with hangul keys

  • What a fantastic and definitive answer! Thank you. Jan 30, 2022 at 19:36

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.