20 drracket:module-language-tools
If the result of read-language for a language is a function, DrRacket will query it to determine if there are any new toolbar buttons to be used when editing files in this language (when DrRacket’s language is set to the Module language).
To implement functionality similar to the Run button, call the execute-callback method. You may also want to use the drracket:rep:after-expression parameter.
If 'drracket:toolbar-buttons is not recognized, DrRacket will also pass 'drscheme:toolbar-buttons; this is for backwards compatibility and new code should not use it.
(drracket:module-language-tools:add-opt-out-toolbar-button make-button id) → void?
make-button :
(-> (is-a?/c top-level-window<%>) (is-a?/c area-container<%>) (is-a?/c switchable-button%)) id : symbol?
(drracket:module-language-tools:add-online-expansion-handler mod-path id local-handler) → void? mod-path : path-string? id : symbol? local-handler : (-> (is-a?/c drracket:unit:definitions-text<%>) any/c any)
The first two arguments name a procedure in a module that is loaded by dynamic-require is a separate place. When DrRacket detects that the editor has been modified, it sends the contents of the editor over to that separate place, expands the program there, and then supplies the fully expanded object to that first procedure. (The procedure is called in the same context as the expansion process.)
Note that the thread that calls this procedure may be killed at anytime: DrRacket may kill it when the user types in the buffer (in order to start a new expansion), but bizarro code may also create a separate thread during expansion that lurks around and then mutates arbitrary things.
The result of the procedure is expected to be something that can be sent across a place-channel, which is then sent back to the original place where DrRacket itself is running and passed to the local-handler argument. At this point, the only code running is trusted code (DrRacket itself and other tools), but any long running computations may freeze DrRacket’s GUI, since this procedure is invoked on DrRacket’s eventspace’s handler thread.