▼ |  | Dr Racket Plugins

1 | Implementing Dr Racket Plugins
2 | Adding Languages to Dr Racket
3 | Creating New Kinds of Dr Racket Frames
4 | Extending the Existing Dr Racket Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | Language-Specific Capabilities
8 | Check Syntax
9 | Teaching Languages
10 | drracket: get/ extend
11 | drracket: unit
12 | drracket: language
13 | drracket: language-configuration
14 | drracket: debug
15 | drracket: rep
16 | drracket: frame
17 | drracket: help-desk
18 | drracket: eval
19 | drracket: modes
20 | drracket: module-language-tools
21 | drracket: module-language
22 | Backwards Compatibility
| Index

► | 7 | Language-Specific Capabilities

7.1 | Customizing Dr Racket’s Behavior
7.2 | Customizing Dr Racket’s GUI

On this page:

7.1`` Customizing Dr Racket’s Behavior
7.2`` Customizing Dr Racket’s GUI

top ← prev up next →

### 7`` Language-Specific Capabilities

#### 7.1`` Customizing DrRacket’s Behavior

When using the language declared in the source, DrRacket queries that language via module-compiled-language-info to determine if an expression in the interactions window is ready to be submitted to the evaluator (when the user types return). The info procedure is passed 'drracket:submit-predicate and should return a function with this contract:

> (-> input-port?
> boolean?
> boolean?)

This function’s first argument is a port that contains the interactions window’s data, starting from the prompt position to the end of the editor. The second argument is a boolean indicating if the insertion point is followed only by whitespace. The results should be a boolean indicating if the expression should be evaluated. This function is called in sandbox, but with no filesystem or networking limits.

#### 7.2`` Customizing DrRacket’s GUI

DrRacket’s capability interface provides a mechanism for tools to allow languages to hide their GUI interface, if the tool does not apply to the language. Tools register capabilities keyed with symbols via. drracket:language:register-capability. Once registered, a tool can query a language, via the capability-value method. The result from this method controls whether or not the tool shows this part of the GUI for DrRacket.

See drracket:language:register-capability for a list of the capabilities registered by default.

top ← prev up next →