[racket] Custom Keybindings - Editor Insert Poofed

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Oct 27 21:23:16 EDT 2012

That is the frame. Generally speaking, the first argument is the
object that has the keyboard focus at the moment when you type the
key. I'm not sure why the frame would have the focus and not the
definitions text, tho. If you type other keys, do you see them appear
in the definitions text? And is the insertion point (a vertical bar of
the same height as a line of text) blinking?

FWIW, you can test for this with (is-a? editor frame%), but you
probably want to rename that variable if that's the right answer. :)

Robby

On Sat, Oct 27, 2012 at 8:16 PM, Ray Racine <ray.racine at gmail.com> wrote:
> Robby,
>
> OK, I reduced my keybindings.rkt file to exactly the below.
>
> #lang s-exp framework/keybinding-lang
> ;; insert λ
> (keybinding "c:\\" (λ (editor evt)
>      (pretty-print editor)
>      (send editor insert "λ")))
>
> When I run drracket from the command line what I see printed is
>
> ray at rpr:~$ /usr/local/racket/bin/drracket
> #(struct:object:...cts/version/tool.rkt:176:9 ...)
>
> This matches the popup box error as well.  Screenshot is here.
> https://plus.google.com/u/0/photos/108838931798929528241/albums/5804161505516624049
>
> So it doesn't appear to be an instance of editor% but I don't know why.  I'm
> running Linux Ubuntu 12.10.  It happens in #lang racket.
>
> Ray
>
> On Sat, Oct 27, 2012 at 8:12 PM, Robby Findler <robby at eecs.northwestern.edu>
> wrote:
>>
>> I've tried this and I see a lambda char inserted.
>>
>> Is it possible that the keyboard focus is not in an editor? That would
>> mean that the 'editor' argument wouldn't actually be an editor.
>>
>> Maybe try printing that out, and that'll shed some light on what's
>> going on here.
>>
>> Robby
>>
>> On Sat, Oct 27, 2012 at 12:37 PM, Ray Racine <ray.racine at gmail.com> wrote:
>> > I spoke to soon there still is something broken.  But I did find a work
>> > around.
>> >
>> > To reproduce:
>> >
>> > 1) Create a custom keybinding file.
>> > 2) Use emacs keybindings by unchecking Enable Menu Keybindings  in your
>> > Preferences (as in section 3.3 of the Racket doc)
>> > 3) Define a simple one-line keybinding in the keybinding file.
>> >   (keybinding "c:\\" (λ (editor evt) (send editor insert "λ")))
>> > 4) Set the keybinding file and attempt to do a ctr-\ and you see the
>> > error.
>> >
>> > The workaround I have is to use "menu-bind" method in your keybindings
>> > file.
>> > When I use that to bind to the "Insert λ" menu option, it works.
>> >
>> > Ray
>> >
>> > On Sat, Oct 27, 2012 at 10:21 AM, Robby Findler
>> > <robby at eecs.northwestern.edu> wrote:
>> >>
>> >> Sorry-- I had this on my list of things to look into (but it sounds
>> >> like I was missing a piece anyways). If you saved a copy of that
>> >> directory and don't mind sharing it, I'd be happy to try to look into
>> >> it more.
>> >>
>> >> Robby
>> >>
>> >> On Sat, Oct 27, 2012 at 9:14 AM, Ray Racine <ray.racine at gmail.com>
>> >> wrote:
>> >> > OK, sat down this morning to figure out why my custom Racket
>> >> > keybinding
>> >> > were
>> >> > failing.  No idea of the exact cause, but step 1, clearing out my
>> >> > .racket/preferences brought them back.  Working fine now.
>> >> >
>> >> > Ray
>> >> >
>> >> >
>> >> > On Tue, Oct 23, 2012 at 11:15 AM, Ray Racine <ray.racine at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> Up until recently the following worked for me.  Create a custom
>> >> >> keybindings file.  Add the following line.
>> >> >>
>> >> >> (keybinding "c:\\" (λ (editor evt) (send editor insert "λ")))
>> >> >>
>> >> >> And a Ctrl:\ would insert a λ for me.  Recently this has stopped
>> >> >> working
>> >> >> as reported below.  Any ideas on how to bring it back?
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >> Ray
>> >> >>>
>> >> >>>
>> >> >>> The key binding is invoked, however, I'm seeing the following in a
>> >> >>> pop-up.
>> >> >>>
>> >> >>> Error running keybinding
>> >> >>> send: no such method
>> >> >>> method name: insert
>> >> >>> class name: cts/version/tool.rkt:176:9
>> >> >>>
>> >> >
>> >> >
>> >> > ____________________
>> >> >   Racket Users list:
>> >> >   http://lists.racket-lang.org/users
>> >> >
>> >
>> >
>
>


Posted on the users mailing list.