▼ |  | Plugins: Extending Dr Scheme

1 | Implementing Dr Scheme Tools
2 | Adding Languages to Dr Scheme
3 | Creating New Kinds of Dr Scheme Frames
4 | Extending the Existing Dr Scheme Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | #lang-specific tools
8 | Language-specific capabilities
9 | drscheme: get/ extend
10 | drscheme: unit
11 | drscheme: language
12 | drscheme: language-configuration
13 | drscheme: debug
14 | drscheme: rep
15 | drscheme: frame
16 | drscheme: help-desk
17 | drscheme: eval
18 | drscheme: modes
| Index

On this page:

drscheme: modes: add-mode
drscheme: modes: mode?
drscheme: modes: get-modes
drscheme: modes: mode-name
drscheme: modes: mode-surrogate
drscheme: modes: mode-repl-submit
drscheme: modes: mode-matches-language

top← prev up next →

### 18`` drscheme:modes

(drscheme:modes:add-mode |  | name |
|  | surrogate |
|  | repl-submit |
|  | matches-language) |

→ drscheme:modes:mode?
name : string?
surrogate : (or/c false/c (is-a?/c mode:surrogate-text<%>))
repl-submit : ((is-a?/c drscheme:rep:text%) number? . -> . boolean?)
matches-language : ((or/c false/c (listof string?)) . -> . boolean?)

Adds a mode to DrScheme. Returns a mode value that identifies the mode.

The first argument, name, is the name of the mode, used in DrScheme’s GUI to allow the user to select this mode.

The surrogate argument is set to the definitions text and the interactions text (via the mode:host-text set-surrogate<%> method) whenever this mode is enabled.

The repl-submit procedure is called whenever the user types a return in the interactions window. It is passed the interactions editor and the position where the last prompt occurs. If it returns #t, the text after the last prompt is treated as a program fragment and evaluated, according to the language settings. If it returns #f, the text is assumed to be an incomplete program fragment, and the keystroke is not treated specially.

The matches-language predicate is called whenever the language changes. If it returns #t this mode is installed. It is passed the list of strings that correspond to the names of the language in the language dialog.

Modes are tested in the opposite order that they are added. That is, the last mode to be added gets tested first when the filename changes or when the language changes.

See also drscheme:modes:get-modes.

(drscheme:modes:mode? val) → boolean?
val : any/c

Determines if val is a mode.

(drscheme:modes:get-modes) → (listof drscheme:modes:mode?)

Returns all of the modes currently added to DrScheme.

See also drscheme:modes:add-mode.

(drscheme:modes:mode-name mode) → string?
mode : drscheme:modes:mode?

Extracts the name of the mode.

See also drscheme:modes:add-mode.

(drscheme:modes:mode-surrogate mode)
→ (or/c false/c (is-a?/c mode:surrogate-text<%>))
mode : drscheme:modes:mode?

Extracts the surrogate of the mode.

See also drscheme:modes:add-mode.

(drscheme:modes:mode-repl-submit mode) → any
mode : drscheme:modes:mode?

Extracts the repl submission predicate of the mode.

See also drscheme:modes:add-mode.

(drscheme:modes:mode-matches-language mode)
→ ((or/c false/c (listof string?)) . -> . boolean?)
mode : drscheme:modes:mode?

Extracts the language matching predicate of the mode.

See also drscheme:modes:add-mode.

top← prev up next →