▼ |  | 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

► | 6 | Editor Modes

6.1 | Color Schemes
6.2 | General-purpose Modes

On this page:

6.1`` Color Schemes
6.2`` General-purpose Modes

top ← prev up next →

### 6`` Editor Modes

#### 6.1`` Color Schemes

DrRacket uses the framework’s color schemes to colorize source text and other aspects of itself. See color-prefs:register-info-based-color-schemes for details on how to add new color schemes via "info.rkt" files.

#### 6.2`` General-purpose Modes

DrRacket provides support for multiple editor modes based on the #lang line at the beginning of the editor. If the Modes submenu of the Edit menu has the Racket mode chosen (which is the default if the Language dialog’s “The Racket Language” is chosen), then DrRacket calls the language’s get-info procedure (see read-language for more about how to set up a language’s get-info procedure) with 'definitions-text-surrogate. This is expected to return a quoted module path (in the sense of module-path?) that names a module that exports surrogate%. It is expected to be bound to a class implementing the mode:surrogate-text<%> interface. Assuming so, it is used as the surrogate for the definitions text.

Additionally, plugins can register modes via drracket:modes:add-mode. Each mode is visible in the Modes submenu of the Edit menu. Initially, DrRacket only supports two modes: Racket mode and text mode.

DrRacket automatically selects a mode for each open file based on the file’s extension (and the language chosen as described above). If the file ends with .txt, DrRacket uses text mode. Otherwise, DrRacket uses Racket mode.

top ← prev up next →