[racket] Custom Key Bindings - Post Your File

From: Stephen De Gabrielle (stephen.degabrielle at acm.org)
Date: Tue May 15 07:56:08 EDT 2012

Is the 'Script Plugin' an option for keybindings?

S.

The Script Plugin for DrRacket may help to create simple plugins, like
automatic text (or snip%s) insertion, text selection replacement (and much
more), without needing to restart DrRacket :
http://planet.plt-scheme.org/display.ss?package=script-plugin.plt&owner=orseau
Docs:
http://planet.plt-scheme.org/package-source/orseau/script-plugin.plt/2/0/planet-docs/manual/index.html

On Friday, May 11, 2012, Nick Shelley wrote:

> So no, it does not allow you to enter arbitrary computations. I'm not
> saying that this should replace the current language-based approach, but I
> think that having this for all pre-defined actions (like new tab, run,
> complete, etc.) would make customizing (as apposed to augmenting) much more
> convenient.
>
> On Fri, May 11, 2012 at 1:39 PM, Nick Shelley <nickmshelley at gmail.com>wrote:
>
> Sorry to be imprecise. It lists all menu actions plus many standard text
> actions. Here's a screenshot of the last menu actions followed by some
> selection actions.
>
> On Fri, May 11, 2012 at 1:32 PM, Luke Vilnis <lvilnis at gmail.com> wrote:
>
> I assume Chaitin's constant is involved.
>
>
> On Fri, May 11, 2012 at 3:22 PM, Matthias Felleisen <matthias at ccs.neu.edu>wrote:
>
>
> [How] does Xcode allow you to enter arbitrary computations in response to
> key events? I don't understand how one can list "all possible actions"
> since there are infinitely many? -- Matthias
>
>
>
> On May 11, 2012, at 2:58 PM, Nick Shelley wrote:
>
> > On the topic of key bindings, is there a reason this can't be done in
> the preferences menu? Xcode has a key bindings section in the preferences
> menu that has all possible actions on the left and the current bindings on
> the right, and you can just click on the current binding and change it to
> whatever you want. I think something like that would be nice in DrRacket,
> but I have no idea how hard it would be to implement.
> >
> > Maybe that's on the list of "It would be nice, but..."
> >
> > On Fri, May 11, 2012 at 6:14 AM, Robby Findler <
> robby at eecs.northwestern.edu> wrote:
> > Ah, good point. I've added some example code to the docs that shows
> > how to bind menu items. Here's the code.
> >
> > Robby
> >
> > #lang s-exp framework/keybinding-lang
> >
> > (define (menu-bind key menu-item)
> >  (keybinding
> >   key
> >   (λ (ed evt)
> >     (define canvas (send ed get-canvas))
> >     (when canvas
> >       (define menu-bar (find-menu-bar canvas))
> >       (when menu-bar
> >         (define item (find-item menu-bar menu-item))
> >         (when item
> >           (define evt
> >             (new control-event%
> >                  [event-type 'menu]
> >                  [time-stamp
> >                   (send evt get-time-stamp)]))
> >           (send item command evt)))))))
> >
> > (define/contract (find-menu-bar c)
> >  (-> (is-a?/c area<%>) (or/c #f (is-a?/c menu-bar%)))
> >  (let loop ([c c])
> >    (cond
> >      [(is-a? c frame%) (send c get-menu-bar)]
> >      [(is-a? c area<%>) (loop (send c get-parent))]
> >      [else #f])))
> >
> > (define/contract (find-item menu-bar label)
> >  (-> (is-a?/c menu-bar%)
> >      string?
> >      (or/c (is-a?/c selectable-menu-item<%>) #f))
> >  (let loop ([o menu-bar])
> >    (cond
> >      [(is-a? o selectable-menu-item<%>)
> >       (and (equal? (send o get-plain-label) label)
> >            o)]
> >      [(is-a? o menu-item-container<%>)
> >       (for/or ([i (in-list (send o get-items))])
> >         (loop i))]
> >      [else #f])))
> >
> > (menu-bind "c:a" "Run")
> >
> >
> > On Thu, May 10, 2012 at 8:22 PM, Ray Racine <ray.racine at gmail.com>
> wrote:
> > > I'm caught in a bit of Catch-22.   From the doc.
> > >
> > > If you are most familiar with Emacs-style key bindings (especially on
> > > windows or some linux installations where the control key is, by
> default,
> > > for the menu shortcuts), you should uncheck the Enable keybindings in
> > > menus preference. Many of the keybindings below are inspired by Emacs.
> > >
> > > So I've disabled keybindings in menu and thereby lose crtl-r Run and
> crtl-i
> > > Reindent.  I'd like to re-bind but I've as of yet been unable to
> locate what
> > > functions Run and Reindent correspond to.
> > >
> > > I totally missed the online check syntax option, which sounds like a
> very
> > > good thing.  In fact I'm still totally missing
>
>

-- 

--
Stephen De Gabrielle
stephen.degabrielle at acm.org
Telephone +44 (0)20 85670911
Mobile        +44 (0)79 85189045
http://www.degabrielle.name/stephen
----
Professor: Oh God! I clicked without reading!
Cubert: And I slightly modified something I own!
Professor: We're monsters!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120515/8cb404d0/attachment.html>

Posted on the users mailing list.