I found ESC-prefix and Control-X-prefix defined in keymap.c:

initial_define_key (global_map, 033, "ESC-prefix");
initial_define_key (global_map, Ctl ('X'), "Control-X-prefix");

But no matter what I try I can't add a map for Super (Hyper) key.
And this isn't working

Lisp_Object s_map;
s_map = Fmake_keymap (Qnil);
Fset (intern_c_string ("s-map"), s_map);
Ffset (intern_c_string ("S-prefix"), s_map);
initial_define_key (global_map, 0xffeb, "S-prefix");  // tried many codes
initial_define_key (s_map, 'z', "my-function");


s-z is undefined

I also have a question what #define Ctl(c) ((c)&037) does? Because 037 is no a key code of any Control (left or right).

Can you provide a working example of adding a key map to the source code?

  • Are you asking how to add a keymap and a keymap variable to the Emacs C source code? Or do you just want to define a keymap and a keymap variable (e.g., in your own Lisp code)? – Drew Aug 28 '15 at 6:24
  • I want to understand how this is done in source code. Can't sleep well if I don't understand something). I just hack sources now and have questions. – Sergey Aug 28 '15 at 6:29
  • It may depend on the OS, e.g., it would likely be different for an OSX build --with-ns: Qsuper / ns_command_modifier / ns-command-modifier in nsterm.m and ns-win.el. You might also try grepping for Qsuper and super_modifier in xterm.c and w32fns.c and globals.h I hope you are able to get some sleep eventually -- obsessions and sleep seldom mix. – lawlist Aug 28 '15 at 7:25
  • 1
    By the way, super and hyper are two different keys. Not sure if you know it. – MatthewRock Aug 28 '15 at 8:18
  • @MatthewRock yes I know – Sergey Aug 28 '15 at 9:17

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.