▼ |  | 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 | Signatures
11 | drracket: get/ extend
12 | drracket: unit
13 | drracket: language
14 | drracket: language-configuration
15 | drracket: debug
16 | drracket: rep
17 | drracket: frame
18 | drracket: help-desk
19 | drracket: eval
20 | drracket: modes
21 | drracket: module-language-tools
22 | drracket: module-language
23 | 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 →