The other day I wrote about using the Mac’s virtual keypad to get some additional key sequences for Emacs. That didn’t work out as well as I’d hoped because, unlike my MacBook Pro, the keyboard for my iMac doesn’t have a virtual keypad. I thought about getting an add-on Bluetooth keypad for my iMac but that seemed like unnecessary expense and clutter for something that I might not use all that much.
All was not lost, though, because Magnar Sveen popped up in the comments to suggest that I map the 【fn】key to 【hyper】. I’d considered doing that before but the 【fn】 key is used to control music functions such as start/stop and volume and I sometimes want to use those functions while I’m in Emacs. Sveen replied that if you map 【fn】 to 【hyper】 it will still work properly when you use it to modify a function key, which is where the music controls are.
So, this is a note to all Emacs users working on a Mac. Just map 【fn】 to 【hyper】 and you have the best of both worlds: easy access to all the controls living on the function keys and an easy-to-use 【hyper】 key that opens up a bunch of key sequences that you can map to your favorite commands. I implemented it by adding
(setq ns-function-modifier 'hyper)
to my darwin.el file, which is where all my Mac specific configurations live.
Thanks to Magnar for setting me straight on this. I’m already loving having the 【hyper】 key in an easy to use place.