[racket] Need Help With Keybindings

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Sep 26 07:10:55 EDT 2011

Two built-in keys that do that are esc;backspace (and possibly
alt-backspace, depending on your platform), and control-shift-left,
which selects a word backwards (which you can then delete or cut or
select another one or whatever).

Robby

On Sun, Sep 25, 2011 at 10:59 PM, David G. Kay <dgkdgk at gmail.com> wrote:
>
> The most important thing I need at
> this point is a way to bind ^W to
> something like delete-word-backwards.
> Most of the other things I really wanted
> I could do with the 'move' command,
> but I can't find something like delete-
> word-backwards at
>      http://docs.racket-lang.org/gui/text_.html
> I see the delete command, but surely
> I don't have to build my own delete-
> word-backwards from there when that
> operation must already exist in the
> emacs-like bindings.
> Is there not a keybindings file
> somewhere already that does the
> emacs-style bindings, which I
> could just modify to use different
> keys?  Am I missing something
> fundamental in how this whole
> thing works?
> --DGK
>
> On Sun, Sep 11, 2011 at 12:24 PM, David G. Kay <dgkdgk at gmail.com> wrote:
>>
>> Thank you; that's great.   I'm most of the way
>> there now.
>> Still, I'm finding the text% documentation
>> tough sledding; the tools seem lower-level
>> than I need.
>> Is there a keybinding file somewhere for
>> emacs commands?  I think changing the
>> actual keystrokes in that file would be the
>> easiest way for me to do what I want.
>> Thanks,
>> --DGK
>>
>> On Sat, Sep 10, 2011 at 2:22 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>>>
>>> At Sat, 10 Sep 2011 12:56:29 -0700, "David G. Kay" wrote:
>>> > Hi, everyone;
>>> >
>>> > I'd like to rebind some of the DrRacket
>>> > editor keys.  (I'm trying to reproduce the
>>> > idiosyncratic editor layout I'm used to;
>>> > it has an emacs flavor but with different
>>> > keys.)
>>> >
>>> > To start, I just want to map ^t to move
>>> > up a line, ^v to move down, ^f to move
>>> > left, and ^g to move right.
>>> >
>>> > I created this file ("keys.rkt"):
>>> >
>>> > #lang s-exp framework/keybinding-lang
>>> >
>>> > (keybinding "c:t" (lambda (editor evt) (send editor previous-line)))
>>> > (keybinding "c:v" (lambda (editor evt) (send editor next-line)))
>>> > (keybinding "c:f" (lambda (editor evt) (send editor
>>> > backward-character)))
>>> > (keybinding "c:g" (lambda (editor evt) (send editor
>>> > forward-character)))
>>> >
>>> >
>>> > I add the file using "Add User-defined
>>> > Keybindings" in DrRacket.  But I get
>>> > this message as soon as I type one of
>>> > my rebound keys:
>>> >
>>> > Error running keybinding .../Scheme/keys.rkt:18:18
>>> >
>>> > send: no such method: previous-line for class:
>>> > ...engine/test-tool.scm:36:6
>>> >
>>> >
>>> > It's complaining about the previous-line
>>> > method, but that's listed in section 7
>>> > (Editor Functions) of the Racket Graphical
>>> > Interface Toolkit manual:
>>> >
>>> > http://docs.racket-lang.org/gui/Editor_Functions.html?q=Editor_Functions&q=edit
>>> > or%25&q=forward-select-word&q=key%20bindings
>>>
>>> I can see how it's confusing, but that isn't a list of methods. It's a
>>> list of strings that are mapped to functions in a keymap%, where the
>>> string is eventually converted to a function through the
>>> `call-function' method of keymap%. The extra level of indirection is an
>>> ugly artifact of the days when parts of the GUI toolkit were
>>> implemented in C++.
>>>
>>>
>>> For text-editor methods, look here:
>>>
>>>  http://docs.racket-lang.org/gui/text_.html
>>>
>>> I think you want to use the `move' method.
>>>
>>
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.