[OS X Emacs] Keypad mapping

Win Treese treese at acm.org
Fri Jul 10 21:22:52 EDT 2020


> On Jun 19, 2020, at 4:08 PM, Jerry Leichter <leichter at lrw.com> wrote:
> 
> I have a bunch of things linked to keypad keys.  (So, kill me.  Long trained fingers.)  At some point, binding to the keypad '=' become impossible:  At a low level, this just comes through a '='.
> 
> I don't have a complete history, but as of Aquamacs 1.5, it came through as
> <kp-equal>.  As of Aquamacs 3.2, it came through as just '='.  I kept putting off trying to understand exactly why, but it's still the same in Aquamacs 3.4.
> 
> There is one other key that's been treated oddly for as long as I can determine:  The keypad 'clear' key at some very low level gets translated to C-l.  This I can live with though it would be nice for it come through as <kp-clear>.
> 
> I'm seeing this on Sierra though it doesn't seem to be OS-related.  I'm using an Apple keyboard though other keyboards that have keypads seem to behave the same.
> 
> Am I missing something, or is there really a bug here?

Hi, Jerry. Seems like there’s a bug here, but I so far don’t see where the code goes wrong.

My Macs all have small keyboards without the keypad, so I didn’t look much at this until I was able to borrow a USB keyboard that had one. Except that it was the PC layout, and doesn’t have = on the keypad. So then I tried to chase the keypad C code, and it looks like the keypad = is handled just like the other keypad keys, so it should work.

Then it occurred to me that I have Karabiner Elements installed, so I can use that to fake out having a keypad = key. I can remap a key to keypad + and it comes through in Aquamacs as kp-plus. But it doesn’t work on keypad =, although the code flow seems to be basically the same. In any case, I can try to get at it with a debugger sometime. In the source code history, there was a big enough change in the relevant code between 1.5 and 3.x that it’s not surprising that some things are different.

The keypad Clear key, on the other hand, is not handled in the code. The Mac key inputs are translated to X11 keysyms so that the rest of the keyboard machinery works, and (as far as I can tell) there was never an X11 keysym defined for a Clear key. If we figure out the problem with handling =, I suppose it’s possible to put in a hack to translate Clear to a X11 keysym that’s not otherwise used.

 - Win



More information about the MacOSX-Emacs mailing list