[plt-scheme] Overriding insert-lambda-template keybinding?
On Feb 19, 2008 8:13 AM, Robby Findler <robby at cs.uchicago.edu> wrote:
> Did you write something like this:
>
> (define (my-func text event) ...)
> (keybinding "ESC;s:l" my-func)
Yes. I pasted it below. Maybe I am obviously doing something very wrong...?
; $LastChangedDate: 2008-02-19 14:57:46 -0600 (Tue, 19 Feb 2008) $
; $LastChangedRevision: 1364 $
; $HeadURL: svn://osiris/drscheme/trunk/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)
(define insert-lambda-template
(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)))
(keybinding "ESC;s:l" insert-lambda-template))