[racket] closing tab in Unix?

From: Laurent (laurent.orseau at gmail.com)
Date: Wed Oct 2 13:15:58 EDT 2013

You can use Ctrl-W if you enable "Keyboard shortcuts in menus" (or whatever
the english string) in Edit/Preferences/General but then you may lose some
emacs keybindings.

Otherwise, you can get hold of the drracket-frame from a custom keybinding,
by first getting the editor from the callback argument, calling (send
editor get-top-level-window) to get the frame, then close the tab (only
partially tested):

(keybinding
   "c:s:w"
   (λ (ed evt)
   (when (is-a? ed text:basic<%>)
    (define fr (send ed get-top-level-window))
    (when fr (send fr close-current-tab)))))

Example partly taken from here:
http://docs.racket-lang.org/drracket/Keyboard_Shortcuts.html#%28part._defining-shortcuts%29

Laurent



On Wed, Oct 2, 2013 at 6:48 PM, John Clements <clements at brinckerhoff.org>wrote:

>
> On Sep 30, 2013, at 5:25 PM, Sam Tobin-Hochstadt wrote:
>
> > On Mon, Sep 30, 2013 at 8:18 PM, John Clements
> > <clements at brinckerhoff.org> wrote:
> >>
> >> On Sep 28, 2013, at 9:22 PM, Manfred Lotz wrote:
> >>
> >>> On Sat, 28 Sep 2013 13:55:34 -0700
> >>> John Clements <clements at brinckerhoff.org> wrote:
> >>>
> >>>> I feel as though the answer must be howlingly obvious, but I'm
> >>>> missing it somehow; how are UNIX-users supposed to close tabs without
> >>>> the mouse? After quite a bit of exploration I see that on the Mac,
> >>>> for instance, there are keybindings named "Close Tab"---but those
> >>>> aren't in the list of available keybindings under UNIX.
> >>>>
> >>>> Am I missing something obvious?
> >>>>
> >>>
> >>> You mean a tab in DrRacket? If yes then: Ctrl-W
> >>
> >> Nope, not bound for me under ubuntu. Further, there's no keybinding
> named "Close Tab", if I wanted to create it myself.
> >
> > Do you have the emacs keybindings on?
>
> Er... my understanding is that the emacs keybindings are always on, but
> are shadowed by the menu bindings, if those are enabled. So yes, I have
> ctrl-W and ctrl-Y for cut & pasted, Ctrl-X o changes windows... but there's
> no Ctrl-X k.
>
> John
>
>
> ____________________
>   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/20131002/50b4ff7b/attachment.html>

Posted on the users mailing list.