I never use the left control key, so I'd like to rebind it as Hyper, but ONLY inside Emacs. Is there a way to do this?

EDIT: I'm running Emacs on a linux system.

  • Interesting, you don't use C-n and C-p for motion? Mar 8 '17 at 4:49
  • @eflanigan00 - I do, but I have C mapped to Caps Lock.
    – Alex
    Mar 8 '17 at 5:51
  • I've never done it but is xmodmap the way to go? emacs.stackexchange.com/questions/21892/… Mar 8 '17 at 7:15
  • @eflanigan00 - thanks, but I can't use that as it modifies the key system wide rather than just in Emacs. xmodmap also doesn't work on Wayland.
    – Alex
    Mar 8 '17 at 7:51

You'll be able to change what the control modifier is mapped to in the upcoming major Emacs release. While this isn't as fine-grained as it could be to remap only one of both control modifiers, it allows remapping them to hyper in Emacs only:

(setq x-ctrl-keysym 'hyper)

Feel free to open a bug report for individual modifier remappings.


If you are on a Mac you can try adding the following to your init.el

(setq mac-control-modifier 'hyper)

I believe (setq ns-control-modifier 'hyper) would be the general solution for other OSes, I wouldn't know it, though.

To change the right control key you'd similarly use (setq mac-right-control-modifier 'hyper). To control the behaviour of other "meta" keys change control for either option, command or function, e.g., mac-command-modifier.

  • 1
    ns is the prefix used by the official Emacs for macOS. mac is used by another macOS Emacs port. However, in this case, the official macOS Emacs also understands the mac prefix, probably because the feature originated on the other Emacs port. Mar 8 '17 at 5:11
  • Thanks, but I'm not on a mac (linux, I'll edit the original question). I don't seem to have any variables called anything like control-modifier.
    – Alex
    Mar 8 '17 at 5:53
  • @Lindydancer The ns prefix is from NeXT and dates back to early 1990s OSX was based on NeXTStep so I think you have it the wrong way round
    – mmmmmm
    Apr 17 '19 at 18:00
  • @Mark, you're absolutely correct in that "ns" stands for NextSTEP. The "ns" prefix is still used to refer to the official macOS port of Emacs, as it's based on the Emacs port for NextSTEP. All macOS-specific variables and functions are prefixed with ns-, e.g. ns-popup-font-panel and ns-auto-hide-menu-bar. Apr 19 '19 at 18:31

Your Answer

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

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