6 Editor Modes

▼ |  | 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 | Cooperating with Background Check Syntax
10 | Teaching Languages
11 | Signatures
12 | drracket: get/ extend
13 | drracket: unit
14 | drracket: language
15 | drracket: language-configuration
16 | drracket: debug
17 | drracket: rep
18 | drracket: frame
19 | drracket: help-desk
20 | drracket: eval
21 | drracket: modes
22 | drracket: module-language-tools
23 | drracket: module-language
24 | drracket: tracing
25 | 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 →