Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quickscript to move the current (saved) tab to a new DrRacket window
#lang racket/base
(require quickscript
quickscript/utils
racket/class
drracket/tool-lib
racket/gui/base)
(script-help-string "move the current (saved) tab to a new DrRacket window")
(define-script move-to-new-window
#:label "Move tab to new window"
#:menu-path ("&Utils")
(λ (selection #:definitions defs #:frame fr)
(define fname (send defs get-filename))
(cond
[(or (not fname)
(send defs is-modified?))
(message-box "Cannot move window"
"The editor must be saved before moving it to a new window")]
[else
(define fr2 (drracket:unit:open-drscheme-window #f))
(define txt (send fr2 get-definitions-text))
(smart-open-file fr2 fname)
(send fr close-current-tab)])
#f))
(module url2script-info racket/base
(provide filename url)
(define filename "move-to-new-window.rkt")
(define url "https://gist.github.com/Metaxal/bfef2b3ee77f3e40aa449d87851dbf81"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment