[racket-dev] change default binding of c:x; c:w to "save definitions as..." ?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Mar 22 12:55:56 EDT 2011

On Tue, Mar 22, 2011 at 11:40 AM, John Clements
<clements at brinckerhoff.org> wrote:
>
> On Mar 21, 2011, at 2:33 PM, Robby Findler wrote:
>
>> Not from me.
>
> I just spent a few minutes fussing with my own private keymap, and I've hit a (minor?) roadblock. This code:
>
>  (when (eq? (system-type) 'macosx)
>    ;; first, let's try the one we think is there...
>    (kb "d:s:s" "Save Definitions"))
>
> ...doesn't have the desired effect, presumably because "Save Definitions" (& "Save Definitions As...") aren't found in the keymap's list of function names. I just checked out the docs for keymap%, and it doesn't look like I can extract that list of names programmatically.  Also, five minutes of grepping located the save-definitions string constant, but not the place in the code where it's added to a keymap (if it is).  The "show current keymap" includes the binding for "Save Definitions", which suggests that it's in there.
>
> So, it looks like either
>
> 1) The binding is there, I just haven't guessed the right name for it,
> 2) the binding is not there, and I would have to roll it myself by adding gui code, or
> 3) I'm barking up the wrong tree entirely :).

The binding is a menu level binding. If you wanted to add things like
that, you'd need to find a way to get a hold of the menu keybinding.
In this case, you can call the file-menu:save-callback method of the
frame, I believe.

Robby



Posted on the dev mailing list.