I have Emacs 26.1 from emacsformacosx.com set up to use left option as meta, and to ignore right option, so as to leave it available for accented characters etc.

It works fine on my MacBook Pro's built-in keyboard, and was working fine with an external PC keyboard in High Sierra. But since I installed Mojave (a reformat and clean install), the external keyboard is backwards — left option is ignored, right option is meta.

The keyboard is a CoolerMaster QuickFire Rapid. As a further complication, I have option and command switched via Keyboard Preferences / Keyboard / Modifier Keys.

  1. what else can I do to diagnose the problem? Is there a way I can tell what keycodes the keys are sending? (The Keyboard Viewer highlights both option keys whenever one is pressed, so it's no help.)
  2. is there a way to intentionally swap the keys, e.g. in ~/Library/KeyBindings/, but only for that specific keyboard?
  3. is there a way to at least detect what keyboard is installed, e.g. in a bash script, which might allow me to partially hack around the problem in my init.el? (It wouldn't be ideal to have to relaunch emacs when I switch keyboards, but it would be better than nothing.)

Note: I don't really want to install any third-party keyboard mapping software (Karabiner etc.) just to deal with this problem, although I suppose I'd be open to it for the diagnosis part.

Updated to add: Per @nohillside's comment, I tried disabling the option/command switch in Keyboard Preferences. This fixed the left/right problem. It's not a workable solution, but it does seem to isolate the problem to the modifier key customization.

Updated again: I upgraded an iMac that uses the same PC keyboard to Mojave, and it doesn't exhibit the problem; it may be specific to portables (or even to that particular MacBook Pro).

Updated yet again: Since updating to Catalina, the iMac now has the same problem.

  • 1
    Can you disable all the modifications and see how it works then? And afterwards add them step by step?
    – nohillside
    Oct 9 '18 at 15:42
  • @nohillside Good call, see update above. Oct 9 '18 at 16:20
  • I have the same problem, with both ThinkPad USB/BT keyboards. It happens since High Sierra.
    – amdyes
    Oct 10 '18 at 6:31
  • Mine was not reversed but the Windows lock was activated and I didn't realize that.
    – Tsuharesu
    Oct 10 '18 at 13:34
  • On the same boat with latest MBP 15" + Mojave. Internal/built-in keyboard is set to swap alt and cmd. Then, two alts are swapped with the alt-cmd swapping option on all external keyboards. (tried three different keyboards). Probably your iMac is not set to swap alt-cmd, as you never use an apple keyboard with it?
    – krim
    Dec 20 '18 at 3:39

You must log in to answer this question.

Browse other questions tagged .