Last active
August 2, 2021 16:15
-
-
Save Metaxal/bfef2b3ee77f3e40aa449d87851dbf81 to your computer and use it in GitHub Desktop.
Quickscript to move the current (saved) tab to a new DrRacket window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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