[plt-scheme] keybinding and menus

From: Laurent (laurent.orseau at gmail.com)
Date: Wed Nov 25 10:39:04 EST 2009

Hi all,

DrScheme is a wonderful editor and the possibility to remap keys is great...
when you can make it work.
I'm struggling with my "mykeys.ss" and the net and the help desk could not
help me much.
There is of course the useful:
but it says nothing about the hereby problems.
I did not find anything about keybindings on planet (is there?).

First, in order to rebind some keys defined for menus, the
option"keybindings in menus"in menu preferences/editing/general must
be disabled (for me, and it seems that this behavior is different for other
people (?)).
My quick guess is that the menus keybindings are defined after "mykeys.ss"
file is loaded, which is not what I want.
This forces me to redefine some of the bindings of the menus by hand...

Thus, Second: How do I rebind a key to open a new tab?
Let's define (this is a untested simplification of my file):

> (define (keymap-fun fun-name)
>     (lambda (editor event)
>       (send (send editor get-keymap) call-function
>             fun-name
>             editor event #t)))

> (keybinding "c:n" (keymap-fun "New Tab"))
does not work (it does nothing, no error, not even printing "n").
"New tab", "Nouvel onglet", "Nouvel Onglet" (my DrScheme is in french, so I
don't know which is the good one) did not work either.
Where can I find information about this? (because there are other menu items
that I want to rebind)

I tried some experiments and there are some strange behaviors:

> (for-each (lambda (key-str) (keybinding (first key-str) (keymap-fun (second
> key-str))))
>   '(
>      ["c:semicolon" "comment-out"] ; works
>      ["c:s:semicolon" "uncomment"] ; does not work (on french layout, "."
> is ";" shifted)
>      ["c:s:." "uncomment"] ; does not work (also c:s:period does not exist)
>      ["c:." "uncomment"] ; does not work
>      ["c:s:q" "uncomment"] ; does not work, prints "Q"
>      ["c:q" "uncomment"] ; works
>      ["c:s:W" "uncomment"] ; does not work, prints "W"
>      ["c:W" "uncomment"] ; works, like c:w
>      ["c:m:r" "uncomment"] ; does not work, does nothing
>      ["m:s:r" "uncomment"] ; works
>      ["m:semicolon" "uncomment"] ; works
>      ["m:s:semicolon" "uncomment"] ; does not work, prints "."
>  ))

I would especially like the "c:s:semicolon" to work...

Also, reloading DrScheme for each test takes some time... isn't there a
faster way to test keybindings?

Thanks for reading this and helping me if possible.

Using DrScheme 4.2.2 french and (unfortunately) Vista SP1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091125/409cd51e/attachment.html>

Posted on the users mailing list.