[plt-scheme] Overriding insert-lambda-template keybinding?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue Feb 19 09:13:33 EST 2008

On Feb 18, 2008 11:56 PM, Grant Rettke <grettke at acm.org> wrote:
> On Feb 18, 2008 3:10 PM, Robby Findler <robby at cs.uchicago.edu> wrote:
> > > In the keybindings display window the custom mapping shows up as
> > > "ESC;c:l (C:\drscheme\mykeys.ss:10.2:1). What do those numbers mean?
> > > Is there any way to make this more meaningful?
> >
> > Those numbers are teh source location of the "lambda" expression
> > above. If you give that function a name, the name will appear there
> > instead.
>
> I see. I tried specifying the function name and got the same result.

Did you write something like this:

 (define (my-func text event) ...)
 (keybinding "ESC;s:l" my-func)

?

> Looking at keybinding.ss in collects/framework/private, it looks like
> mappings are added in two steps:
>
> 1. (send kmap add-function name func)
> 2. (send kmap map-function key func)
>
> Does this make any difference?

I don't think so. You can read up on those in help desk -- they are
both necessary. What's important here is how "name" is calculated (in
the first line).

> How does one get a reference to that kmap object?

I tried to hide that reference so that it would be hard for keymap
users to mutate it. Of course, you can get to it if you try hard
enough (it will be attached somewhere to the keymap that the editor
has when a key is actually pushed).

Robby


Posted on the users mailing list.