Go to the first, previous, next, last section, table of contents.


Edwin

This chapter describes how to start Edwin, the MIT Scheme text editor. Edwin is very similar to GNU Emacs -- you should refer to the GNU Emacs manual for information about Edwin's commands and key bindings --- except that Edwin's extension language is MIT Scheme, while GNU Emacs extensions are written in Emacs Lisp. This manual does not discuss customization of Edwin.

Starting Edwin

To use Edwin, start Scheme with a world image containing Edwin (for example by giving the `-edwin' command-line option), then call the procedure edit:

procedure+: edit
procedure+: edwin
Enter the Edwin text editor. If entering for the first time, the editor is initialized (by calling create-editor with no arguments). Otherwise, the previously-initialized editor is reentered.

This procedure is sometimes evaluated from the command line to start Scheme with Edwin running:

scheme -edwin -eval (edit)

The procedure edwin is an alias for edit.

variable+: inhibit-editor-init-file?
When Edwin is first initialized, it loads your init file (called `~/.edwin' under Unix, `edwin.ini' on PCs) if you have one. If the Scheme variable inhibit-editor-init-file? is true, however, your init file will not be loaded even if it exists. By default, this variable is false.

procedure+: create-editor arg ...
Initializes Edwin, or reinitializes it if already initialized. create-editor is normally invoked automatically by edit.

If no args are given, the value of create-editor-args is used instead. In other words, the following are equivalent:

(create-editor)
(apply create-editor create-editor-args)

On the other hand, if args are given, they are used to update codecreate-editor-args, making the following equivalent:

(apply create-editor args)
(begin (set! create-editor-args args) (create-editor))

variable+: create-editor-args
This variable controls the initialization of Edwin. The following values are defined:

(#f)
This is the default. Creates a window of some default size, and uses that window as Edwin's main window. Under Unix, if X11 is not available or if the `DISPLAY' environment variable is undefined, Edwin will run on Scheme's console.
(x)
Unix only. Creates an X window and uses it as Edwin's main window. This requires the `DISPLAY' environment variable to have been set to the appropriate value before Scheme was started.
(x geometry)
Unix only. Like (x) except that geometry specifies the window's geometry in the usual way. Geometry must be a character string whose contents is an X geometry specification.
(console)
Unix only. Causes Edwin to run on Scheme's console, or in Unix terminology, the standard input and output. If the console is not a terminal device, or is not powerful enough to run Edwin, an error will be signalled at initialization time.
(pm)
OS/2 only. Creates a Presentation Manager window and uses it as Edwin's main window.
(win32)
Windows only. Creates a window and uses it as Edwin's main window.

Leaving Edwin

Once Edwin has been entered, it can be exited in the following ways:

C-x z
Stop Edwin and return to Scheme (suspend-edwin). The call to the procedure edit that entered Edwin returns normally. A subsequent call to edit will resume Edwin where it was stopped.
C-x c
Offer to save any modified buffers, then kill Edwin, returning to Scheme (save-buffers-kill-edwin). This is like the suspend-edwin command, except that a subsequent call to edit will reinitialize the editor.
C-x C-z
Stop Edwin and suspend Scheme, returning control to the operating system's command interpreter (suspend-scheme). When Scheme is resumed (using the command interpreter's job-control commands), Edwin is automatically restarted where it was stopped. This command is identical to the C-x C-z command of GNU Emacs.
C-x C-c
Offer to save any modified buffers, then kill both Edwin and Scheme (save-buffers-kill-scheme). Control is returned to the operating system's command interpreter, and the Scheme process is terminated. This command is identical to the C-x C-c command of GNU Emacs.

Last Resorts

When Scheme exits abnormally it tries to save any unsaved Edwin buffers. The buffers are saved in an auto-save file in case the original is more valuable than the unsaved version. You can use the editor command M-x recover-file to recover the auto-saved version. The name used to specify an auto-save file is operating-system dependent: under Unix, and on PC file systems with long file names, `foo.scm' will be saved as `#foo.scm#'; on PC file systems with short file names, it will be saved as `foo.sav'.

The following Scheme procedures are useful for recovering from bugs in Edwin's implementation. All of them are designed for use when Edwin is not running -- they should not be used when Edwin is running. These procedures are designed to help Edwin's implementors deal with bugs during the implementation of the editor; they are not intended for casual use, but as a means of recovering from bugs that would otherwise require reloading the editor's world image from the disk.

procedure+: save-editor-files
Examines Edwin, offering to save any unsaved buffers. This is useful if some bug caused Edwin to die while there were unsaved buffers, and you want to save the information without restarting the editor.

procedure+: reset-editor
Resets Edwin, causing it to be reinitialized the next time that edit is called. If you encounter a fatal bug in Edwin, a good way to recover is to first call save-editor-files, and then to call reset-editor. That should completely reset the editor to its initial state.

procedure+: reset-editor-windows
Resets Edwin's display structures, without affecting any of the buffers or their contents. This is useful if a bug in the display code causes Edwin's internal display data structures to get into an inconsistent state that prevents Edwin from running.


Go to the first, previous, next, last section, table of contents.