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.
- 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.)
- is there a way to intentionally swap the keys, e.g. in
~/Library/KeyBindings/, but only for that specific keyboard?
- 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).