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

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Feb 18 16:10:51 EST 2008

On Feb 13, 2008 10:11 PM, Grant Rettke <grettke at acm.org> wrote:
> Hi folks,
>
> In v372 I want to modify the insert-lambda-template keybinding so that
> it will use the word lambda rather than the symbol. To do so I added
> this key binding:
>
> ; $LastChangedDate: 2008-02-13 22:05:25 -0600 (Wed, 13 Feb 2008) $
> ; $LastChangedRevision: 1260 $
> ; $HeadURL: svn://osiris/drscheme/tags/1.0/mykeys.ss $
> (module mykeys (lib "keybinding-lang.ss" "framework")
>
>   ; Use the word lambda rather than the lambda symbol
>   ; Source code
>   ;  Url: http://svn.plt-scheme.org/plt/tags/v372/collects/framework/private/keymap.ss
>   ;  Lines: 375-385 (insert-lambda-template)
>   (keybinding
>    "ESC;s:l"
>    (lambda (edit event)
>      (send edit begin-edit-sequence)
>      (let ([selection-start (send edit get-start-position)])
>        (send edit set-position (send edit get-end-position))
>        (send edit insert ")")
>        (send edit set-position selection-start)
>        (send edit insert ") ")
>        (send edit set-position selection-start)
>        (send edit insert "(lambda ("))
>      (send edit end-edit-sequence))))
>
> Is there an easier way to do it? Could/should I have modified
> keymap.ss and re-built DrScheme locally?

Yes, after you change a .ss file, you just need to run setup-plt so
the .zo files are all sync'd up.

> 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.

> Is that mapping loaded each time DrScheme starts or can I delete it?

It should be loaded if you see it in the Edit|Keybindings submenu.

Robby


Posted on the users mailing list.