16 drracket:language-configuration

▼ |  | Dr Racket Plugins

1 | Tool support for #lang-based Languages
2 | Implementing Dr Racket Plugins
3 | Adding Languages to Dr Racket
4 | Creating New Kinds of Dr Racket Frames
5 | Extending the Existing Dr Racket Classes
6 | Expanding the User’s Program Text and Breaking
7 | Editor Modes
8 | Plugin Capabilities
9 | Check Syntax
10 | Cooperating with Background Check Syntax
11 | Teaching Languages
12 | Signatures
13 | drracket: get/ extend
14 | drracket: unit
15 | drracket: language
16 | drracket: language-configuration
17 | drracket: debug
18 | drracket: rep
19 | drracket: frame
20 | drracket: help-desk
21 | drracket: eval
22 | drracket: modes
23 | drracket: module-language-tools
24 | drracket: module-language
25 | drracket: tracing
26 | drracket: init
27 | Backwards Compatibility
| Index

On this page:

drracket: language-configuration: get-languages
drracket: language-configuration: add-language
drracket: language-configuration: get-settings-preferences-symbol
drracket: language-configuration: language-settings
drracket: language-configuration: struct: language-settings
drracket: language-configuration: make-language-settings
drracket: language-configuration: language-dialog
drracket: language-configuration: fill-language-dialog

top contents ← prev up next →

### 16`` drracket:language-configuration🔗ℹ

> procedure (drracket:language-configuration:get-languages)
> → (listof (is-a?/c drracket:language:language<%>))

This can only be called after all of the tools initialization phases have completed.

Returns the list of all of the languages installed in DrRacket.

> > procedure
> > (drracket:language-configuration:add-language |
> > |  | language |
> > | [ | #:allow-executable-creation? allow-executable-creation?]) |
> → void?
> | language |  | : |  |
> (and/c (is-a?/c drracket:language:language<%>)
> drracket:language:object/c)
> allow-executable-creation? : boolean? = #f

This function can only be called in phase 2 (see Implementing DrRacket Plugins for details).

Adds language to the languages offered by DrRacket.

If allow-executable-creation? is #f, then choosing the Create Executable... menu item results in a dialog box saying that executable creation is disabled. If it is #t, then the create-executable is called when that menu item is selected (after checking to make sure the file is saved).

> procedure (drracket:language-configuration:get-settings-preferences-symbol)
> → symbol?

Returns the symbol that is used to store the user’s language settings. Use as an argument to either preferences:get or preferences:set.

> > struct
> > (struct |  | drracket:language-configuration:language-settings
> > |  | (language
> > |  | settings)
> #:extra-constructor-name
> make-drracket:language-configuration:language-settings)
> | language |  | : |  |
> (or/c (is-a?/c drracket:language:language<%>)
> drracket:language:object/c)
> settings : any/c

This struct pairs together a language and some specific settings for the language.

The settings is a language-specific record that holds a value describing a parameterization of the language.

> value drracket:language-configuration:struct:language-settings
> : struct-type?

An alias for struct:drracket:language-configuration:language-settings.

> value drracket:language-configuration:make-language-settings
> : procedure?

An alias for make-drracket:language-configuration:language-settings.

> > procedure
> > (drracket:language-configuration:language-dialog |
> > |  | show-welcome? |
> > |  | language-settings-to-show |
> > | [ | parent]) |
> → (or/c false/c drracket:language-configuration:language-settings?)
> show-welcome? : boolean?
> language-settings-to-show : drracket:language-configuration:language-settings?
> parent : (or/c false/c (is-a?/c top-level-window<%>)) = #t

Opens the language configuration dialog. See also drracket:language-configuration:fill-language-dialog.

The show-welcome? argument determines if if a “Welcome to DrRacket” message and some natural language buttons are shown.

The language-settings-to-show argument must be some default language settings that the dialog is initialized to. If unsure of a default, the currently set language in the user’s preferences can be obtained via:

> (preferences:get
> (drracket:language-configuration:get-settings-preferences-symbol))

The parent argument is used as the parent to the dialog.

The result if #f when the user cancells the dialog, and the selected language if they hit ok.

> > procedure
> > (drracket:language-configuration:fill-language-dialog |
> > |  | panel |
> > |  | button-panel |
> > |  | language-setting |
> > | [ | re-center |
> > |  | ok-handler]) |
> | → |  |
> (-> (is-a?/c drracket:language:language<%>))
> (-> any/c)
> (-> any/c (is-a?/c mouse-event%) any)
> panel : (is-a?/c vertical-panel%)
> button-panel : (is-a?/c area-container<%>)
> language-setting : drracket:language-configuration:language-settings?
> re-center : (or/c false/c (is-a?/c top-level-window<%>)) = #f
> ok-handler : (-> symbol? void?) = void

This procedure accepts two parent panels and fills them with the contents of the language dialog. It is used to include language configuration controls in some larger context in another dialog.

The panel argument is the main panel where the language controls will be placed. The function adds buttons to the button-panel to revert a language to its default settings and to show the details of a language.

The language-setting is the default language to show in the dialog.

The re-center argument is used when the Show Details button is clicked. If that argument is a top-level-window<%>, the Show Details callback will recenter the window each time it is clicked. Otherwise, the argument is not used.

ok-handler is a function that is in charge of interfacing the OK button. It should accept a symbol message: 'enable and 'disable to toggle the button, and 'execute to run the desired operation. (The language selection dialog also uses an internal 'enable-sync message.)

The first two results of the function return a language object and a settings for that language, as chosen by the user using the dialog. The final function should be called when keystrokes are typed in the enclosing frame. It is used to implement the shortcuts that choose the two radio buttons in the language dialog.

top contents ← prev up next →