#
Chapter 3
Interface Reference

## 3.1 Menus

### 3.1.1 `File`

- `New` Creates a new DrScheme window.

- `New Test Suite` Creates a new test suite window (see section 2.10)

- `Open...` Opens a find-file dialog for choosing a file to load into a definitions window.

- `Open Recent` Lists recently opened files. Choosing one of them opens that file for editing.

- `Open Test Suite...` Opens a test suite file (see section 2.10).

- `Install PLT File...` Opens a dialog asking for the location of the PLT file (either on the local disk or on the web) and installs the contents of the PLT file.

- `Revert` Re-loads the file that is currently in the definitions window. All changes since the file was last saved will be lost.

- `Save Definitions` Saves the program in the definitions window. If the program has never been saved before, a save-file dialog appears.

- `Save Definitions As...` Opens a save-file dialog for choosing a destination file to save the program in the definitions window. Subsequent saves write to the newly-selected file.

- `Save Other` Contains these sub-items

  - `Save Definitions As Text...` Like `Save Definitions As...`, but the file is saved in plain-text format (see DrScheme Files). Subsequent saves also write in plain-text format.

  - `Save Interactions` Saves the contents of the interactions window to a file. If the interaction constants have never been saved before, a save-file dialog appears.

  - `Save Interactions As...` Opens a save-file dialog for choosing a destination file to save the contents of the interactions window. Subsequent saves write to the newly-selected file.

  - `Save Interactions As Text...` Like `Save Interactions As...`, but the file is saved in plain-text format (see DrScheme Files). Subsequent saves are write in plain-text format.

- `Log Definitions and Interactions...` Starts a running of log of the text in the interactions and definitions windows, organized by executions. In a directory of your choosing, DrScheme saves files with the names 01-definitions, 01-interactions, 02-definitions, 02-interactions, etc as you execute and interact with various programs.

- `Print Definitions...` Opens a dialog for printing the current program in the definitions window.

- `Print Interactions...` Opens a dialog for printing the contents of the interactions window.

- `Close` Closes this DrScheme window. If this window is the only open DrScheme window, DrScheme quits.

- `Quit` or `Exit` Exits DrScheme (under Mac OS X this menu item is in the apple menu).

### 3.1.2 `Edit`

All `Edit` menu items operate on either the definitions or interactions window, depending on the location of the selection or blinking caret. Each window maintains its own Undo and Redo history.

- `Undo` Reverses an editing action. Each window maintains a history of actions, so multiple `Undo` operations can reverse multiple editing actions.

- `Redo` Reverses an `Undo` action. Each window (and boxed-subwindow) maintains its own history of `Undo` actions, so multiple `Redo` operations can reverse multiple `Undo` actions.

- `Cut` Copies the selected text to the clipboard and deletes it from the window.

- `Copy` Copies the selected text to the clipboard.

- `Paste` Pastes the current clipboard contents into the window.

- `Delete` or `Clear` Deletes the selected text.

- `Select All` Highlights the entire text of the buffer.

- `Wrap Text` Toggles between wrapped text and unwrapped text in the window.

- `Find` Opens a search dialog or, depending on the preferences, an interactive searching window attached to the frame.

- `Find Again` Finds the next occurrence of the text that was last searched for.

- `Replace & Find Again` Replaces the selection with the replace string (if it matches the find string) and finds the next occurrence of the text that was last searched for.

- `Search in Files...` Opens a dialog where you can specify the parameters of a multi-file search. The results of the search are displayed in a separate window.

- `Keybindings` Shows all of the keybindings available in the current window.

- `Preferences...` opens the preferences dialog. See section 3.2 (In Mac OS X, this menu item is under the apple menu)

### 3.1.3 `Show`

One each of the following show/hide pairs of menu items appears at any time.

- `Show Definitions` Shows the definitions window.

- `Hide Definitions` Hides the definitions window.

- `Show Interactions` Shows interactions window.

- `Hide Interactions` Hides interactions window.

- `Show Contour` Shows a ``20,000 foot'' overview window along the edge of the DrScheme window. Each pixel in this window corresponds to a letter in the program text.

- `Hide Contour` Hides the contour window.

- `Show Profile` Shows the current profiling report. This menu is only useful if you have enabled profiling in the Language dialog. Profiling does not apply to all languages. When it does, the checkbox that enables it is in the details portion of the dialog.

- `Hide Profile` Hides any profiling information currently displayed in the DrScheme window.

- `Split` Splits the current window in half to allow for two different portions of the current window to be visible simultaneously.

- `Collapse`

  If the window has been split before, this menu item becomes enabled, allowing you to collapse the split window.

Note: whenever a program is executed, the interactions window is made visible if it is hidden.

### 3.1.4 `Language`

- `Choose Language` Opens a dialog for selecting the current evaluation language. Click `Execute` to make the language active in the interactions window. See section 2.5 for more information about the languages.

- `Add Teachpack...` Opens a find-file dialog for choosing a teachpack to extend the current language. Click `Execute` to make the teachpack available in the interactions windows. See Extending DrScheme for information on creating teachpacks.

- `Clear All Teachpacks` Clears all of the current teachpacks. Click `Execute` to clear the teachpack from the interactions window.

In addition to the above menus, there is a menu item for each teachpack that clears only that one teachpack.

### 3.1.5 `Scheme`

- `Execute` Resets the interactions window and executes the program in the definitions window.

- `Break` Breaks the current evaluation.

- `Kill` Terminates the current evaluation.

- `Clear Error Highlight` Removes the red background that signals the source location of an error.

- `Create Executable...` Creates a separate launcher for running your program. See Executables for more info.

- `Create Servlet...` Creates a servlet with the contents of the current definitions window, for use in the web server.

- `Module Browser...` Prompts for a file and then opens a window showing the module import structure for the module import DAG starting at the selected module.

  The module browser window contains a square for each module. The squares are colored based on the number of lines of code in the module. If a module has more lines of code, it gets a darker color.

  In addition, for each normal import, a blue line drawn is from the module to the importing module. Similarly, purple lines are drawn for each for-syntax import. In the initial module layout, modules to the left import modules to the right, but since modules can be moved around interactively, that property might not be preserved.

  To open the file corresponding to the module, right click on the box for that module (control-click under Mac OS).

- `Reindent` Indents the selected text according to the standard Scheme formatting conventions. (Pressing the Tab key has the same effect.)

- `Reindent All` Indents all of the text in either the definitions or interactions window, depending on the location of the selection or blinking caret.

- `Comment Out with Semicolons` Puts ``;'' characters at each of the the beginning of each selected line of text.

- `Comment Out with a Box` Boxes the selected text with a comment box.

- `Uncomment` Removes all ``;'' characters at the start of each selected line of text or removes a comment box around the text. Uncommenting only removes a ``;'' if it appears at the start of a line and it only removes the first ``;'' on each line.

### 3.1.6 `Special`

- `Insert Comment Box` Inserts a box that is ignored by DrScheme; use it to put comments to people reading your program.

- `Insert Image...` Opens a find-file dialog for selecting an image file in GIF, BMP, XBM, or XPM format. The image is treated as a value.

- `Insert Fraction...` OPENS a dialog prompting for a mixed-notation fraction and inserts that into the current editor.

- `Insert Large Letters...` Opens a dialog asking for a line of text and inserts a large version of that (made with semicolons and spaces) into the current editor.

- `Insert Lambda` Inserts the symbol lambda into the program. This has the same behavior as if `lambda` were typed at this point, except that the lambda symbol is implicitly delimited from neighboring characters.

- `Insert Delta (define)` Inserts the symbol delta into the program. This has the same behavior as if `define` were typed at this point, except that the delta symbol is implicitly delimited from neighboring characters.

- `Insert XML Box`

  This menu item inserts an XML box. XML boxes must contain XML's concrete syntax and they evaluate to x-expressions, which are s-expressions representing the XML expression. See also XML in DrScheme.

- `Insert Scheme Box`

  Inserts a Scheme box. These boxes contain Scheme code and are meant to be inside XML boxes. See also XML in DrScheme.

- `Insert Scheme Splice Box`

  Inserts a Scheme splice box. These boxes are intended to be inside XML boxes. The Scheme expression inside must evaluate to a list and that list is spliced into the containing XML box. See also XML in DrScheme.

### 3.1.7 `Windows`

- `Bring Frame to Front...`

  Opens a window that lists all of the opened DrScheme frames. Selecting one of them brings the window to the front.

- `Most Recent Window` Toggles between the currently focused window and the one that most recently had the focus.

- `Next Window`

  Brings the next window to the front.

- `Previous Window`

  Brings the previous window to the front.

Additionally, after the above menu items, this menu contains an entry for each window in DrScheme. Selecting a menu item brings the corresponding window to the front.

### 3.1.8 `Help`

- `Help Desk` Opens the Help Desk. This is the clearing house for all documentation about DrScheme and its language.

- `About DrScheme...` Shows the credits for DrScheme.

- `Check for Updates...`

  Opens an internet connection to check if there have been any updates to various installed DrScheme packages.

- `Related Web Sites`

  This submenu has a list of related web sites. Choosing one of them sends a message to an external browser to visit the web site.

- `Is English your mother tongue?`

  This and the related menu items at the end of the `Help` menu switch DrScheme's interface (natural) language.

## 3.2 Preferences

The preferences dialog comprises several panels:

- `Editing`

  The `Editing` panel consists of several sub-panels:

  - `Font`

    This panel controls the main font used by DrScheme.

  - `Indenting`

    This panel controls which keywords DrScheme recognizes for indenting, and how each keyword is treated.

  - `General`

    - `Auto-save files` -- If checked, the editor generates autosave files (see DrScheme Files) for files that have not been saved after five minutes.

    - `Backup files` -- If checked, when saving a file for the first time in each editing session, the original copy of the file is copied to a backup file in the same directory. The backup files have the same name as the original, except that they end in either `.bak` or `~`.

    - `Map delete to backspace` -- If checked, the editor treats the Delete key like the Backspace key.

    - `Show status-line` -- If checked, DrScheme shows a status line at the bottom of each window.

    - `Count line and column numbers from one` -- If checked, the status line's line:column counter counts from one. Otherwise, it counts from zero.

    - `Display line numbers in buffer; not character offsets` -- If checked, the status line shows a line:column display for the current selection rather than the character offset into the text.

    - `Wrap words in editor buffers` -- If checked, DrScheme editors auto-wrap text lines by default. Changing this preference affects new windows only.

    - `Use separate dialog for searching` -- If checked, then selecting the `Find` menu item opens a separate dialog for searching and replacing. Otherwise, selecting `Find` opens an interactive search-and-replace panel at the bottom of a DrScheme window.

    - `Reuse existing frames when opening new files` -- If checked, new files are opened in the same DrScheme window, rather than creating a new DrScheme window for each new file.

    - `Enable keybindings in menus` -- If checked, some DrScheme menu items have keybindings. Otherwise, no menu items have key bindings. This preference is designed for people who are comfortable editing in Emacs and find the standard menu keybindings interfere with the Emacs keybindings.

    - `Automatically print to postscript file` -- If checked, printing will automatically save postscript files. If not, printing will use the standard printing mechanisms for your computer.

  - `Scheme`

    - `Highlight between matching parens` -- If checked, the editor marks the region between matching parenthesis with a gray background (in color) or a stipple pattern (in monochrome) when the flashing caret is next to a parenthesis.

    - `Correct parens` -- If checked, the editor automatically converts a typed ``)'' to ``]'' to match ``['', or it converts a typed ``]'' to ``)'' to match ``(``.

    - `Flash paren match` -- If checked, typing a closing parenthesis, square bracket, or quotation mark flashes the matching open parenthesis/bracket/quote.

    - `Parenthesis highlight color` - configures the color used to highlight matching parenthesis.

- `Warnings`

  - `Ask before changing save format` -- If checked, DrScheme consults the user before saving a file in non-text format (see DrScheme Files).

  - `Verify exit` -- If checked, DrScheme consults the user before exiting.

  - `Only warn once when executions and interactions are not synchronized` -- If checked, DrScheme warns the user on the first interaction after the definitions window, language, or teachpack is changed without a corresponding click on `Execute`. Otherwise, the warning appears on every interaction.

- `HTTP Proxy`

  This preferences panel allows you to configure your HTTP proxy. Contact your system administrator for details.

- `Profiling`

  This preference panel configures the profiling report. The band of color shows the range of colors that profiled functions take on. Colors near the right are used for code that is not invoked often and colors on the right are used for code that is invoked often.

  If you are interested in more detail at the low end, choose the ``Square root'' check box. If you are interested in more detail at the upper end, choose the ``Square'' check box.

- `Check Syntax`

  This panel controls the font and color styles used by the `Check Syntax` colorizations.

- `Browser`

  This panel contains a single choice, allowing you to either read the help with an external, platform-specific browser, or to use PLT's (relatively poor, but stable) built in browser.

## 3.3 Keyboard Shortcuts

Most key presses simply insert a character into the editor (``a'', ``3'', ``('', etc.). Other keys and key combinations act as keyboard shortcuts that move the blinking caret, delete a line, copy the selection, etc. Keyboard shortcuts are usually trigger by key combinations using the Control, Meta, or Command key.

C-`key` = This means press the Control key, hold it down and then press `key` and then release them both. For example: C-e (Control-E) moves the blinking caret to the end of the current line.

M-`key` = Same as C-`key`, except with the Meta key. Depending on your keyboard, Meta may be called ``Left'', ``Right'' or have a diamond symbol, but it's usually on the bottom row next to the space bar. M-`key` can also be performed as a two-character sequence: first, strike and release the Escape key, then strike `key`. Under Windows and Mac OS, Meta is only available through the Escape key.

DEL = The Delete key.

SPACE = The Space bar.

Note: On most keyboards, ``<'' and ``>'' are shifted characters. So, to get M->, you actually have to type Meta-Shift->. That is, press and hold down both the Meta and Shift keys, and then strike ``>''.

Note: Many of the key bindings can also be done with menu items.

Under Windows, some of these keybindings are actually standard menu items. Those keybindings will behave according to the menus, unless the `Enable keybindings in menus` preference is unchecked.

If you are most familiar with Emacs-style key bindings, you should uncheck the `Enable keybindings in menus` preference. Many of the keybindings below are inspired by Emacs.

### 3.3.1 Moving Around

- C-f move forward one character

- C-b move backward one character

- M-f move forward one word

- M-b move backward one word

- C-v move forward one page

- M-v move backward one page

- M-< move to beginning of file

- M-> move to end of file

- C-a move to beginning of line (left)

- C-e move to end of line (right)

- C-n move to next line (down)

- C-p move to previous line (up)

- M-C-f move forward one S-expression

- M-C-b move backward one S-expression

- M-C-u move up out of an S-expression

- M-C-d move down into a nested S-expression

- M-C-SPACE select forward S-expression

- M-C-p match parentheses backward

- M-C-left move backwards to the nearest editor box

- A-C-left move backwards to the nearest editor box

- M-C-right move forward to the nearest editor box

- A-C-right move forward to the nearest editor box

- M-C-up move up out of an embedded editor

- A-C-up move up out of an embedded editor

- M-C-down move down into an embedded editor

- A-C-down move down into an embedded editor

### 3.3.2 Editing Operations

- C-d delete forward one character

- C-h delete backward one character

- M-d delete forward one word

- M-DEL delete backward one word

- C-k delete forward to end of line

- M-C-k delete forward one S-expression

- M-w copy selection to clipboard

- C-w delete selection to clipboard (cut)

- C-y paste from clipboard (yank)

- C-t transpose characters

- M-t transpose words

- M-C-t transpose sexpressions

- M-C-m toggle dark green marking of matching parenthesis

- M-C-k cut complete sexpression

- C-_ undo

- C-+ redo

- C-x u undo

- M-o toggle overwrite mode

### 3.3.3 File Operations

- C-x C-s save file

- C-x C-w save file under new name

### 3.3.4 Searching

- C-s search for string forward

- C-r search for string backward

### 3.3.5 Miscellaneous

- f5 Execute

### 3.3.6 Interactions

The interactions window has all of the same keyboard shortcuts as the definitions window plus a few more:

- M-p bring the previously executed expression down to the prompt.

- M-n bring the expression after the current expression in the expression history down to the prompt.

## 3.4 DrScheme Files

### 3.4.1 Program Files

The standard extension for a Scheme program file is `.scm`. The extensions `.ss` and `.sch` are also acceptable.

DrScheme's editor can saves a program file in two different formats:

- Plain-text format -- All text editors can read this format. DrScheme saves a program in plain-text format by default, unless the program contains images or text boxes. (Plain-text format does not preserve images or text boxes.)

  Plain-text format is platform-specific because different platforms have different newline conventions. However, most tools for moving files across platforms support a ``text'' transfer mode that adjusts newlines correctly.

- Multimedia format -- This format is specific to DrScheme, and no other editor recognizes it. DrScheme saves a program in multimedia format by default when the program contains images, text boxes, or formatted text.

  Multimedia format is platform-independent. Use a ``binary'' transfer mode when moving multimedia-format files across platforms. (Using ``text'' mode may corrupt the file.)

### 3.4.2 Backup and Autosave Files

When you modify an existing file in DrScheme and save it, DrScheme copies the old version of the file to a special backup file if no backup file exists. The backup file is saved in the same directory as the original file, and the backup file's name is generated from the original file's name:

- Under Unix and Mac OS, a tilde (~) is added to the end of the file's name.

- Under Windows, the file's extension is replaced with `.bak`.

When a file in an active DrScheme editor is modified but not saved, DrScheme saves the file to a special autosave file after five minutes (in case of a power failure or catastrophic error). If the file is later saved, or if the user exists DrScheme without saving the file, the autosave file is removed. The autosave file is saved in the same directory as the original file, and the autosave file's name is generated from the original file's name:

- Under Unix and Mac OS, a pound sign (#) is added to the start and end of the file's name, then a number is added after the ending pound sign, and then one more pound sign is appended to the name. The number is selected to make the autosave filename unique.

- Under Windows, the file's extension is replaced with a number to make the autosave filename unique.

### 3.4.3 Preference Files

On start-up, DrScheme reads configuration information from a preferences file. The name and location of the preferences file depends on the platform and user:2

- Under Unix, preferences are stored in `.plt-prefs.ss` in the user's home directory.

- Under Windows, if the HOMEDRIVE and HOMEPATH environment variables are defined, preferences are stored in `%HOMEDRIVE%`\`%HOMEPATH%`\`plt-prefs.ss`, otherwise preferences are stored in `plt-prefs.ss` in the directory containing the MrEd executable.

  Windows NT, XP, 2000: When DrScheme is launched under Windows NT, XP, or 2000 and HOMEDRIVE and HOMEPATH are not set, Windows automatically sets the variables to indicate the root directory of the main disk. Therefore, when HOMEDRIVE and HOMEPATH are not set, the preferences file `plt-prefs.ss` is saved in the root directory of the main disk.

- Under Mac OS X, preferences are stored in `.plt-prefs.ss` in the user's preferences folder. Under Mac OS Classic, preferences are stored in `plt-prefs.ss` in the system preferences folder.

A lock file is used while modifying the preferences file, in the same directory as the preferences file. Under Windows and Mac OS Classic, the lock file is named `.LOCKplt-prefs.ss`, and on other platforms, it is `.LOCK.plt-prefs.ss`.

If the user-specific preferences file does not exist, and the file `plt-prefs.ss` in the `defaults` collection does exist, then it is used for the initial preference settings. (See Library Collections and MzLib for more information about collections.) This file thus allows site-specific configuration for preference defaults. To set up such a configuration, start DrScheme and configure the preferences to your liking. Then, exit DrScheme and copy your preferences file into the `defaults` collection as `plt-prefs.ss`. Afterward, users have no preferences will get the preference settings you chose.

2 The MzScheme procedure `find-system-path` returns the platform-specific path when given the argument `'pref-file`.