Created
May 2, 2020 13:58
-
-
Save Metaxal/cfe71127092d2ec95013cc81a5b88cd6 to your computer and use it in GitHub Desktop.
Display a "All tabs" menu in DrRacket
This file contains 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 racket/gui/base | |
racket/class | |
quickscript) | |
;;; The default 'Tabs' menu in DrRacket lists only the first 10 tabs. | |
;;; This script displays all tabs, which is particularly convenient when | |
;;; there are many tabs and not all of them are visible. | |
(define-script all-tabs | |
#:label "All tabs" | |
(λ (str #:frame fr) | |
(define menu-bar (send fr get-menu-bar)) | |
(define menu | |
(new menu% [parent menu-bar] [label "All Tabs"] | |
[demand-callback | |
(λ (menu) | |
(send fr begin-container-sequence) | |
(for ([it (in-list (send menu get-items))]) | |
(send it delete)) | |
(new menu-item% [parent menu] [label "&Remove menu"] | |
[callback (λ _ (send menu delete))]) | |
(for ([t (in-range (send fr get-tab-count))] | |
[tab (in-list (send fr get-tabs))]) | |
(new menu-item% [parent menu] | |
[label (format "~a: ~a" t (send fr get-tab-filename t))] | |
[callback (λ _ (send fr change-to-tab tab))])) | |
(send fr end-container-sequence))])) | |
#f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have a Menu that displays all open tabs in DrRacket. (Currently, DrRacket displays only the first 10).
How to install: Click on
Scripts | Manage scripts | New script...
Enter "All tabs" (a new script opens filled with a template).
Replace the template with the code below. Save the file.
Click on
Scripts | All tabs
. A new menu "All tabs" appears in DrRacket!