[racket] script-plugin for DrRacket from laurent

From: razo (r.tiefenthal at gmx.de)
Date: Thu Feb 19 14:56:08 EST 2015

Thank you very much Laurent,

I have gotten the behaviour I wanted by using the builtin functionality 
for keybindings (Edit/Keybindings/Add User-defined keybindings). For me 
personally the issue is solved, but for reference by whom it might 
concern (my english is awkward I think) I might add:

* If I click on the menu entry (Scripts/SCRIPTNAME SHORTCUT) and 
SHORTCUT is equal to Ö or any other key I try without prefix I get the 
behaviour I want, but when I press the key (ö) it inserts the letter 
itself in the editor. This is with "(shortcut-prefix . ())" in the .rktd 
file.
* "Edit/Preferences/Editing/General/"Enable keybindings in menus": The 
issue seems to persist, no matter if the option is on or off (it was on 
before I read your comment).
* For reference I might add the keybindings file I now use as is via 
"Edit/Keybindings/Add User-defined keybindings", i.e. nothing to with 
the plugin from Laurent. Basically I just wanted to insert brackets etc. 
without having to press shift+8 etc. with my german keyboard layout:

-------
#lang s-exp framework/keybinding-lang
(keybinding "c:#" (λ (editor evt) (send editor insert "(define ")))
(keybinding "c:#" (λ (editor evt) (send editor insert "(define x")))
(define cnt 0)
(keybinding "c:u" (λ (editor evt) (send editor insert (format "Count: 
~a." cnt)) (set! cnt (add1 cnt))))
(keybinding "c:+" (λ (ed evt)
                     (define a (send ed get-start-position))
                     (send ed move-sexp-out a)))
(keybinding "ö"
             (λ (text evt)
               (define a (send text get-start-position))
               (define b (send text get-end-position))
               (send text insert #\( a)
               (send text insert #\) (+ b 1))
               (send text move-position 'left)))
(keybinding "ä"
             (λ (text evt)
               (define a (send text get-start-position))
               (define b (send text get-end-position))
               (send text insert #\[ a)
               (send text insert #\] (+ b 1))
               (send text move-position 'left)))
-------


Am 19.02.2015 um 19:35 schrieb Laurent:
> The script plugin uses the menus to define the keybindings, because 
> each script is one entry in the menu. And I don't think it's possible 
> to enable keybindings in menus without prefixes. If you use #f, it 
> just uses the default prefix which is Control. Not sure the following 
> works without prefixes, but maybe you can get the behaviour you want 
> by defining your own keybinding file:
> http://docs.racket-lang.org/drracket/Keyboard_Shortcuts.html?q=keybinding#%28part._defining-shortcuts%29
>
> Also, having Edit/Preferences/Editing/General/"Enable keybindings in 
> menus" can make a difference in some cases.
>
> Laurent
>
>
>
> On Mon, Feb 16, 2015 at 8:48 PM, razo <r.tiefenthal at gmx.de 
> <mailto:r.tiefenthal at gmx.de>> wrote:
>
>     Am 16.02.2015 um 21:37 schrieb Jens Axel Søgaard:
>
>         Do you happen to be on OS X?
>
>         Which keyboard layout do you have?
>
>     Sorry, I forgot, I am on windows 7.
>
>     ____________________
>      Racket Users list:
>     http://lists.racket-lang.org/users
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150219/f86419d1/attachment.html>

Posted on the users mailing list.