3

I'd like to use the same custom keybindings when I'm using Windows and a Mac. In particular, I'd like to use the modifier key that is closest to the space bar.

I have set up Emacs on a Mac, and many of my bindings are set to cmd-1 (s-1) because it's closest to the space bar.

On Windows, the closest key to the space bar is alt (M-1), so all my bindings are mapped to the windows key, which is harder to press.

How would I set up my bindings so that the key closest to the spacebar is the one Emacs uses across the two systems?

2

I'm not sure I completely follow what you're trying to do. However, I take it to mean that you'd like the keys at analogous physical positions on a keyboard work the same (in a "DWIM" sense) when you're on your PC and your Mac.

I don't think Emacs enables you to choose how to interpret the different modifier keys on a Windows system (someone correct me if I'm wrong), but the Mac version of Emacs has the nifty ability to interpret your command, control, and option keys as you like (see the bottom tip on emacsforosx for more information).

Hence, one option would be to bind your keys to the Windows key (which I believe is interpreted as super?) as you've done on your Windows machine, and then tell Emacs to interpret the command key as super on your Mac:

(when (eq system-type 'darwin)
  (setq ns-command-modifier 'super
        ns-option-modifier  'meta))

This example also tells Emacs to use your option key as the meta key, as you'd be crippled without it.

  • Doooooh, in re-reading your question, it looks like the core problem is with Windows rather than the Mac. I'm not sure you've got an option to re-interpret your modifier keys within Emacs on Windows, so if you really want to do that, you may need to go to the OS level to swap the keys. – Dan Jul 29 '15 at 12:52
  • 1
    Windows modifiers are mostly compatible with linux ones (or is it the other way round?), so the best bet of the OP is probably to use your tips to make modifiers in mac OS the same as on the other major systems (that is, mostly, meta instead of cmd and super instead of alt). – T. Verron Jul 29 '15 at 13:09
  • yes i think that's a good idea. – Jason Mirk Jul 29 '15 at 14:12

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.