MX — User Commands
NAME
mx − Mouse-oriented editor for X
SYNOPSIS
mx [options] [file file file ...]
mxsync [options] [file file file ...]
OPTIONS
−bd colorUse color as the border color for the window. If this switch isn’t given then the borderColor X default is used. If it isn’t given either, then the foreground color is used.
−bg colorUse color as the background color for the window. If this switch isn’t given then the background X default is used. If it isn’t given either, or if the display is a black-and-white one, then White is used.
−DCauses mx not to detach itself from its parent process. Useful when mx is invoke from programs that wait for it to finish, like mail programs. If mx is invoked under the name mxsync then mx acts as if this switch had been given.
−display host:display
Use host and display as an indication of the display on which to open the window. The display defaults to the one specified in the DISPLAY environment variable.
−fTreat all remaining arguments as file names. This option must be used to edit a file if its name starts with “−” or “=” or “+” or contains a “:” character.
−fg colorUse color as the foreground color for the window. If this switch isn’t given then the foreground X default is used. If it isn’t given either, or if the display is a black-and-white one, then Black is used.
−fn fontUse font as the font for the window. If this switch isn’t given, then the font X default is used as the font. If it isn’t given either, then the Sx default font is used.
−geometry geometry
Use geometry as the geometry for the window. If no geometry is specified on the command line, it the geometry defaults to the value of the geometry X default. If no default is specified, then mx picks a geometry.
−helpPrint out a list of the command-line options (and brief descriptions of their functions) and exit without opening a window.
−icon fileFile is the name of a file in bitmap format. Read the file and use it as the icon for the window. If file is localhost, then mx chooses the default icon file corresponding to the local host.
−ix xcoordDisplay the icon at x-coordinate xcoord.
−iy ycoordDisplay the icon at y-coordinate ycoord.
−sb colorUse color as the background color for the window’s scrollbar. If this switch isn’t given then the scrollbar.background X default is used. If it isn’t given either, then the background color for the text window is used.
−sf colorUse color as the foreground color for the window’s scrollbar. If this switch isn’t given then the scrollbar.foreground X default is used. If it isn’t given either, then the foreground color for the text window is used.
−se colorUse color as the color for the window’s scrollbar elevator. If this switch isn’t given then the scrollbar.elevator X default is used. If it isn’t given either, then the background color for the text window is used.
−showtitleDisplay a title bar at the top of the window. Mx normally assumes that a window manager will display a title bar; if your window manager doesn’t, you may wish to use this switch. If this switch isn’t specified, then Mx checks for a showTitle X default; if it exists and contains the string “yes”, then a title bar will be displayed.
−t tagLook up tag in the tags file of the current directory, open its file in the new window, and go to the line of the tag.
−tb colorUse color as the background color for the window’s title bar. If this switch isn’t given then the title.background X default is used. If it isn’t given either, then the background color for the text window is used. This option is ignored if Mx isn’t displaying a title bar.
−tf colorUse color as the foreground color for the window’s title bar. If this switch isn’t given then the title.foreground X default is used. If it isn’t given either, then the foreground color for the text window is used. This option is ignored if Mx isn’t displaying a title bar.
−ts colorUse color as the color for the window’s title stripes. If this switch isn’t given then the itle.stripe X default is used. If it isn’t given either, then the foreground color for the text window is used. This option is ignored if Mx isn’t displaying a title bar.
+Position the file so its last line is visible in the window.
+lineNumberAfter opening the file, select the first character of line "lineNumber and make that line visible in the window. For this switch, line 1 corresponds to the first line of the file.
+searchPatternAfter opening the file, search for searchPattern, just as if a search command had been invoked. If the first character of searchPattern is a slash then the slash is ignored (this is for vi compatibility and to permit search patterns that begin with a digit).
=geometryUse geometry as the geometry specifier for the window (same effect as the -geometry option).
host:displayUse this argument to select the display on which to create the window (same effect as the -display option).
INTRODUCTION
Mx is a mouse-oriented editor that uses the facilities of the X window system, the Sx supplementary library, and the Tcl command interpreter. It displays a window containing the first file argument and permits file to be edited using the commands defined below. If no file is specified, then mx displays a file containing a tutorial introduction to mx. If file is specified as an empty string, then mx creates a scratch window without any particular file association. Mx normally detaches itself from its parent (as far as its parent is concerned, mx will have exited); if the −D switch is given, or if mx is invoked under the name mxsync, then mx doesn’t detach itself from its parent.
Almost all mx actions are invoked using Tcl commands. See the Tcl documentation for information on the basic command syntax and the built-in Tcl commands. Mx extends the Tcl built-in commands with additional commands for file editing; the mx commands are described in the COMMANDS section below. Commands may be invoked in any of three ways: the command subwindow, pull-down menus, and keystroke bindings. The command subwindow is a small entry window that is displayed at the bottom of the mx window. When it is displayed, commands may be entered there. Pull-down menus appear in a bar at the top of the mx window, and may be invoked by pressing a mouse button over the menu name and releasing it over an entry in the menu. Each menu entry has a command associated with it; when the entry is invoked, the command is executed (see the menu command for information on how to create and modify menus). The third command invocation mechanism is through keystroke bindings: certain keystrokes, or combinations of keystrokes, have commands associated with them. When the keystroke sequence is typed, the associated command is executed (see the bind command for details). For example, the “a” key is normally bound to the command insert a, which causes character “a” to be inserted at the caret location.
Many commands may be invoked either through a menu entry or a keystroke binding; for these commands, the keystroke sequence bound to the command appears at the right side of the menu entry.
.MX FILES
After processing command line options, opening the window, and reading in the file, mx checks for the existence of a file .mx in your home directory (which is given by the environment variable HOME). If the file exists, mx reads it in and processes it as a command file, just as if it were read with the source command. Then it checks for an .mx file in the current directory, and processes it if it exists.
CARET AND SELECTION
The mouse may be used to position the caret (the insertion point) and to select ranges of text. The same actions apply both to the file or to the search and command subwindows. Left-clicking on a character positions the caret just before that character. Right-clicking will select all of the characters from the caret up to and including the character under the pointer. If the left button is clicked twice in quick succession without moving the mouse, it invokes word selection: the word containing the character under the pointer is selected, the caret is positioned at the left side of the word, and future right clicks will select only full words. If the left button is triple-clicked, line selection will be invoked. If the control key is held down while left- and right-clicking, the selection will be set without changing the caret or input focus.
VARIABLES
There are several Tcl global variables that are set or used by mx in some situations:
file Set by mx to the name of the file loaded in the window (which is the first name in $files.
files Set by mx to a list of all the file arguments specified on the command line that created the window.
geometry
Geometry to use when creating new windows, if none is given as part of the open command. See the open command for details.
height
Set by mx to indicate the height of the window, in lines of text. If the last line appearing in the window is only partially visible, it doesn’t count.
helpDir
Mx presets this variable to the location of the directory containing help information such as the tutorials.
history
Mx automatically changes this variable on each mouse click to hold information about all the recently-executed commands. Several of the default key bindings and menu entries also set this variable. See the HISTORY section and the history command for more information.
newWindow
During the open command, mx sets this global variable to hold the id of the newly-created window.
noRegExps
If this variable is set to “1”, searches and replaces will use plain strings. By default, pattern matching takes place with vi-style regular expressions.
replaceCmd
When the middle button is clicked in the “Replace” string entry, or when carriage-return is typed there, the contents of this variable are executed as a command.
replaceString
Set by mx to hold the contents of the replacement entry subwindow.
searchCmd
When the middle button is clicked in the “Search” string entry, or when carriage-return is typed there, the contents of this variable are executed as a command.
searchString
Set by mx to hold the contents of the search entry subwindow.
tagFiles
List of tags files to check in tag command, separated by white space. See the tag command for details. This variable is read by mx but not written.
version
Set by mx to hold a version number in the form x.y, where changes in x correspond to major revisions with probable incompatibilities, and changes in y represent small bug fixes and upgrades that should not cause substantial compatibility problems.
width
The width of the window, in characters. If the last character position is only partially-visible, then it doesn’t count. If a variable-width font is being used, the average character size is used in computing the window’s width.
MARKS
A mark is a string that identifies a position in the file. It has the format line.char where line is a line number in the file and char is a position within that line. For historical reasons, lines number from 1 and characters number from 0.
Most commands that deal with positions in the file, such as see and delete, take marks as arguments. Typically, marks are stored as the values of variables, although they may also be typed in directly. The mark command provides for simple mark arithmetic. The position indicated in a mark need not actually exist in the file; at the time the mark is used it is rounded off to the closest actual position in the file. For example, if the line number doesn’t exist in the file then it is changed to the last line; if the character position would like off the end of the line, then it is rounded to the position of the last character in the line.
When a command specifies that one of its arguments must be a mark, the mark may either be specified in the line.char form (either directly or through command or variable substitution), or it may be specified symbolically using one of the following names, which refer to special locations:
bottom
This special mark refers to the character that appears in the bottom left corner of the window.
caret The special mark caret corresponds to the character just to the right of the caret position.
center
The leftmost character on the center line of the window.
eof The last character in the file (which is always a newline character).
sel.left
The leftmost selected character. This form of mark may only be used if the selection is in the file that’s in this window.
sel.right
The rightmost selected character. This form of mark may only be used if the selection is in the file that’s in this window.
top The character that appears in the top left corner of the window.
HISTORY
Under normal circumstances, Mx continuously records all the top-level commands being executed, including those coming from keystrokes, menu entries, and the command, search, and replace subwindows. On each button click, undo, or search operation, all of the recorded commands are saved in the variable history and the record is cleared. Thus the history variable describes all the commands executed between the last two events in the above group. It may then be invoked as a command to repeat recent actions.
Under normal circumstances, mx does not record information about mouse clicks, searching, undoing, or history commands. In addition, changes of focus to the command, search, or replace subwindows are not normally recorded. Having these commands included in the history variable turns out to cause more trouble than good. However, much of this behavior is enforced by using the history command in the key bindings and menus established by the mx startup file, so you can change it if you wish. Only the mouse click behavior and mx’s refusal to record history commands are hard-wired. See the history command for information on how to control command recording.
COMMANDS
The mx built-in commands are described below. In addition to these commands, any of the Tcl built-in commands may also be used. Whenever a top-level command is invoked (i.e. in response to a keystroke or menu selection, as opposed to the execution of a command procedure), if it returns a non-empty result then the result is displayed in the message window. If the command returns an error then the error message is displayed in the message window.
bind [sequence [command]]
If the sequence and command arguments are given, this command associates the keystroke sequence sequence with command and returns an empty string. From now on, whenever sequence is typed in the window, the Tcl interpreter will be invoked to execute command. If sequence is already bound to a command, then command replaces the previous binding. If there are two bound sequences of which one is a prefix of the other, then the shorter sequence will always match in preference to the longer one. If command is an empty string, then the binding for sequence (if any) is deleted, leaving sequence unbound.
If the first character of command is “!”, it signifies that no undo marks are to be generated around this command; the “!” is stripped from the command before executing it. If several key bindings in a row are invoked and each had the “!” prefix, then all of the invocations will be undone together as a single unit. If command consists of nothing but the character “@” (optionally preceded by “!”), then whenever this binding is invoked the command “insert key” will be executed, where key is the last key typed on the keyboard. “!@” is typically used as the binding for all the standard ASCII characters.
If command isn’t specified, then the bind command returns the current binding for sequence, or the empty string if there is no binding for sequence. If neither sequence or command is given, then bind returns a Tcl list whose elements are the sequences associated with all known keystroke bindings.
caret mark
caret display type
In the single-argument form of this command, the caret is moved to just before the character at the position given by mark. The two-argument form is used to change the way the caret position is displayed. If type is caret, the caret position will always be marked by displaying a caret just before the caret character. If type is block, the caret position will be marked by displaying the caret character in reverse video. If type is off, then the caret position will not be marked with any sort of special display. Finally, a type of viblock marks the caret position with a block when in vi mode and with a caret otherwise (this mode is only relevant for tx). The caret command returns an empty string.
clean Pretend that the contents of this window were just written to disk (but don’t actually write anything). Until the next time the file is modified, mx will assume that the window is “clean”: if you invoke commands like quit or switch then mx will happily discard the contents of the window without warning you or giving you a chance to abort the command.
column mark
Return the column corresponding to the left edge of the character at the position indicated by mark. Mark must be a valid mark. Columns are computed by treating normal characters as one column wide, control characters as two columns wide, and tabs as wide enough to extend up to the next 8-column boundary. Character 0 of a line is at column 0.
control option string
This command performs control-character processing on string, depending on the value of option (abbreviations are OK):
control backslash string
Returns a string that is identical to string except that non-printing characters are replaced with backslash sequences. The newline control character is replaced with \n, tab is replaced with \t, backspace is replaced with \b, and any other non-printing character is replaced with \ddd where ddd gives the octal value of the character.
control binding string
This command is used primarily to produce a printable description of a keystroke sequence that is bound to a command. It returns a string consisting of space-separated fields corresponding to the characters of string. If a string character is space, its corresponding field is “SPACE”; if the string character is a normal printing character then the field is just that character; if the string character is rubout (1778) the corresponding field is “DEL”; if the string character is a control character, the corresponding field is of the form “C-a”; if the string character has its high-order bit set (2008), then the field is the same as if the high-order bit were not set, except that “M-” is prepended (3018 translates to “M-A”).
control make string
Returns a string of the same length as string. Each character in the result is the control equivalent of the string character (e.g., “a” and “A” convert to control-A). The character “?” converts to rubout (1778). You may not use this command to generate a null character (0).
delete mark1 [mark2 [noviewchange]]
Delete all of the characters between mark1 and mark2, inclusive. If mark2 isn’t specified, then delete the single character at mark1. Normally, this command changes the view in the window if necessary to ensure that the point of the deletion is visible; if noviewchange is specified then the view in the window will not be changed. Returns an empty string.
extract mark1 [mark2]
Return as result all of the characters in the file between the two marks mark1 and mark2. If mark2 is omitted, then return the single character at mark1.
focus window [clear]
Arrange for all future keyboard input to be directed to window, regardless of the mouse position. Window must have one of the following values (or a unique abbreviation for it):
command
The command window that appears at the bottom of the file.
file The main window, which displays the file being edited.
replace
The replace entry, which is part of the search/replace window that appears just underneath the menu bar.
search
The search entry in the search/replace window.
If window isn’t displayed when this command is invoked, mx displays it. Ifthe clear option is specified (or any abbreviation of clear) then the contents of the given window are cleared. The clear option is ignored if window is file. If input focussing has been disabled by the .Xdefaults file, then focus will open and/or clear window, but will not focus on it. Returns an empty string.
geometry spec
Set the size and/or location of the window according to the information in spec. Spec should be in the standard format for X geometry specifications (=80x24, for example). Returns an empty string.
history option [arg]
Control the history recording process. The exact function depends on option (which may be abbreviated uniquely):
history add info
Append info to the current history record as if it had been invoked as a command. Returns an empty string.
history clear
Discard all of the information in the current history record. Returns an empty string.
history ignore command
Execute command but don’t record it in the history record. Note that no history commands are ever recorded, even if they don’t appear as the command argument to history ignore. Returns an empty string.
history info
Returns the current history record, with commands separated by newlines.
history next varName [command]
Store the current history record in the variable varName, then clear the history record. After clearing the history record, if command is specified then execute it but don’t record it. Returns an empty string.
history off
Disable history recording. Invocations of history off nest: recording will not resume until an equal number of history on commands have been invoked. Returns an empty string.
history on
Re-enable history recording if the cumulative number of history on commands is greater than or equal to the number of history off commands. This command is ignored if history recording is already enabled. Returns an empty string.
indent mark1 mark2 [+|−] amount
Change the indentation of all the lines between mark1 and mark2, inclusive. If no sign is given, then amount specifies an absolute indentation: for each of the lines, the indentation will be set to amount. If amount is preceded by a minus (plus) argument, then the indentation of each line will be reduced (increased) by amount units. To set the indentation for a line to i, mx deletes all the leading blanks and tabs in the line, then inserts i/8 tabs followed by (i mod 8) spaces. Returns an empty string.
insert bytes [mark]
If mark is specified, it contains a mark; insert will insert the contents of the bytes argument just before the character at position mark. Otherwise the command will insert bytes at the position of the caret. Returns an empty string.
mark src op args
Return a position in the file in the form line.char, where line is a line in the file and char is a character in the line (lines number from 1, characters from 0). Src must be a valid mark; the return value is computed by performing some operation on the position given by src, depending on op and args:
mark src
Return the value of mark src. This form is used to retrieve the value of a built-in mark such as sel.left.
mark src direction amount units
Return the position of the character amount units away from src. Src must be a valid mark. Direction must be forward or backward; it indicates which direction to move from src. Amount is a decimal number indicating how far to move, and units indicates the units for motion: chars, words, or lines. For example, mark $b forward 1 word will set variable a to point to the beginning of the word just after the one containing the position indicated by variable b.
mark src char index
Return the position of the index’th character in the line given by src. If index is -1, then dst will refer to the last character on src’s line.
mark src column index
Return the position of the character that covers column index on the line containing src. Columns are computed by treating normal characters as one space wide, control characters as two spaces wide, tabs as wide enough to extend up to the next 8-column boundary, and the newline at the end of the line as infinitely wide. Columns number from 0.
mark src line index
Return the position whose line number is index but whose character position is the same as src’s.
mark src parenthesis [varName]
Return the position of the first character of the parenthesis that matches the one pointed to by src. If src doesn’t point to a parenthesis, then return src. If varName is specified, then it names a variable that is set to refer to the last character of the matching parenthesis (this feature is only useful for parentheses that are more than one character long).
mark src search direction pattern [varName]
Search for pattern and return the position of the first character of the matching range. If varName is given, it names a variable that is set to the last character of the matching range. The search starts at the position given by src and continues in direction, which must be either forward or backward. The search is circular: if a forward search reaches the end of the file then it continues at the beginning; if a backward search reaches the beginning of the file then it continues at the end. If no match is found, then src is returned (and stored in the variable named by varName, if specified).
menu option [args]
The menu command is used to manipulate the pull-down menus displayed at the top of the window. It has several forms, depending on option:
menu append name leftText centerText rightText color cmd
Append a new entry onto menu name, which must already exist. The leftText, centerText, and rightText arguments give strings to be displayed left-justified, centered, and right-justified (respectively) in the menu entry. If any of the arguments is an empty string or the single character “-”, then no text is displayed in that position. Color gives the background color to use for the entry; if it is an empty string or “-” then the standard background color for the window is used. Cmd is a command to invoke whenever the menu entry is invoked. Returns an empty string.
menu create name leftText centerText rightText color cmd leftText ...
Create a new menu, which will be displayed to the right of any existing menus in the menu bar. The new menu’s name will be name. If there is already a menu named name, then it will be replaced (the new menu will occupy the same position in the menu bar as the old menu). Following the name argument are any number of groups of five arguments, with each group describing one entry in the new menu from top down. The five arguments for each menu entry have the same meaning as for menu append. Returns an empty string.
menu delete name
Delete the menu named name and return an empty string.
menu info
Return a Tcl list whose entries are the names of the menus for this window, in order.
menu info name
Returns a Tcl list containing information about menu name. Each entry in the list corresponds to one entry in the menu, in order from top down. Each entry is itself a Tcl list with four entries, which are the leftText, centerText, rightText, and cmd values from menu create or menu append.
menu modify name entryIndex leftText centerText rightText color cmd
Change the entryIndex’th entry in menu name as indicated by arguments leftText through cmd. Each of these five arguments has the same meaning as in menu append. Entry 0 is the topmost entry in the menu. Returns an empty string.
message string
Display string in the message subwindow.
newline
Insert a newline character at the position of the caret, and adjust indentation. If the caret’s initial line consists of nothing but space, then all the space on the line is deleted. If the caret’s initial line contains leading space, it is reorganized to consist of zero or more tabs followed by zero or more space characters, such that the total width of white space is the same after the change as before (a tab counts for eight characters). Tabs and spaces are inserted on the caret’s new line to match the indentation of the caret’s initial line.
open [options] file file ...
Open a new window. Options and file arguments are treated just the same as they are treated on the command line, except for the following exceptions. The -D option is not permitted, nor are options that specify a display. If file is not specified, a new window is opened on the same file as the current window. If no geometry specification is given in options, then mx uses the contents of the global variable geometry as a default geometry; if no geometry variable exists, then mx picks a default geometry. Other options, such as foreground color and font, default to the values from the invoking window, rather than looking for X defaults. Open sets the global variable newWindow in the invoking window to hold the id of the newly-created window. This may be used in conjunction with the send command to issue commands to the new window. The return value is always an empty string.
quit Destroy the window. If this is the last remaining window on its file and if the file has been modified since the last time it was written, then the user is notified and given a chance to save the file or abort the command. This command always returns an error, in order to abort any partially-executed commands that are in progress (execution of further commands on the window could cause a core dump).
quote
Quote the next input character. The mapping for the next character will be ignored and the character will be inserted. The return value is always an empty string.
read file
Read file and insert its contents just before the caret.
replace [option args]
Replace the selection, as determined by option and args:
replace
If no option is given, then replace the selection by the value of the replaceString global variable. If the search subwindow isn’t visible, don’t do any replacement but open the search subwindow and focus input on the replacement string entry.
replace range start stop [pattern string]
Search the range of text between the marks start and stop, inclusive for occurrences of pattern. Replace each occurrence with string. If pattern and string aren’t specified, then they are taken from the searchString and replaceString global variables. If the search subwindow isn’t visible, don’t do any replacement but open the search subwindow and focus input on the replacement string entry. By default, vi-style regular expressions are used for the pattern and replacement strings. If the variable “noRegExps” is set to “1”, only simple matching is done: there are no wild cards. Matches must be within a single line of the file.
replace selection string
Delete the selection and insert string in its place.
The replace command always returns an empty string.
reset Discard the version of the file that is currently loaded in memory and re-load the file from its disk version. Any changes that have been made since the last time the file was saved will be lost (but you’ll be warned in this case and given a chance to skip the command). This command will affect all of the windows open on the file.
search [direction [pattern]]
Search for a pattern. The search starts from the beginning of the selection (if there is a selection in the window’s file), or from the caret if there’s no selection. Direction indicates which direction to search, and must be either forward or backward. If omitted, it defaults to forward. Pattern gives a text string to search for; if not given, it defaults to the global variable searchString. If the search subwindow isn’t visible, don’t do any searching but open the search subwindow and focus input on the search string entry. By default, vi-style regular expressions are used for the pattern and replacement strings. If the variable “noRegExps” is set to “1”, only simple matching is done: there are no wild cards. Matches must be within a single line of the file. If a match is found, the matching range is selected and the caret is set to the beginning of the range. Returns an empty string.
see mark [top|center|bottom]
Adjust the view in the window so that the character at mark is visible in the window. If a top or center or bottom option is given, then the mark will appear at the given position in the window. If no position is given, then mx will check to see if mark is already visible. If so, it does nothing. If not, it will center mark in the window. Returns an empty string.
selection option [arg ...]
This command performs one of several selection-related operations, depending on option:
selection
selection get
If selection is invoked with no option, or if option is get, then the command returns the contents of the selection. An error occurs if there’s nothing selected. The command selection is different from the command extract sel.left sel.right: selection will return the contents of the selection even if the selection is in another window, but extract sel.left sel.right can only return information from this window.
selection clear
If there is something selected in this window, the selection is cleared, so nothing will be selected. If there is nothing selected in this window, there is no effect. Returns an empty string.
selection here
Returns 1 if there is something selected in the file in this window. Returns 0 if there is no selection or if the selection is not in this window’s file.
selection set mark1 [mark2]
Change the selection to consist of the characters between mark1 and mark2, inclusive. If mark2 isn’t specified, then select the single character at mark1. Returns an empty string.
send window command
Window must be the id of another window owned by this mx process (such as a value placed in newWindow by open). The send command will invoke the Tcl interpreter to process command in the context of window, rather than the window from which the send command was issued. Send will return the result of executing command in window.
switch fileName
Change the window to display fileName instead of what’s there currently. If the file currently in the window has been modified, and if this is the only window on the file, then a notifier is popped up to warn the user and give him/her a chance to abort the command.
taginfo name
Look up name in the tags file(s). If it is found, then return a Tcl list whose first element is the file containing name and whose second element is a search pattern identifying the tag’s location in the file. If the global variable tagFiles is defined, it must contain a list of tags files to check. Those files will be checked for name in order. If no tagFiles variable exists, then the file tags in the current directory is searched.
undo [more]
undo recover fileName
Undo recent edits. If undo is invoked without any arguments, the most recent modification to the file is undone; multiple invocations will toggle the change. If the more argument is given, successive undo’s work back through history; successive undo more commands will undo every change back to the beginning of the edit session. Modifications are undone in groups delimited by marks in an undo log; normally, a mark is placed in the log before and after each user-invoked action (button click, menu selection, or keystroke) that modifies the file. Exceptions to this rule occur for keystrokes whose bindings have the “!” prefix: no marks are placed in the log for these actions. Returns an empty string. If the recover option is given, then fileName must be the address of a mx log. This command will read fileName, which describes changes made in a previous edit session, and apply those changes to the current file.
update
Force the screen to get updated. Normally the screen is updated only at the end of processing a command, just before waiting for more input from the user. This command will force any pending redisplays to be performed immediately. It’s used mostly for debugging. Returns an empty string.
write [fileName]
Write the file to disk. If fileName is given then the file is written there; otherwise it is written to the place from which it was read (i.e. the name displayed in the window’s title bar). Returns a message containing the file’s name and number of lines.
COMMAND PROCEDURES
In addition to the built-in commands described above, a number of Tcl command procedures are created by the default mx startup file. They may be invoked just like built-in commands, and are described below.
caretinfo
Returns a string containing information about the file’s length and the position of the caret.
line i Selects line number i and adjusts the view in the window so that the line number is visible. Returns an empty string.
move This command moves the contents of the selection to the caret position. Returns an empty string.
next This command switches to the next file of those specified on the command line by deleting the first element of the variable $files and switching the window to the new first element of $files.
showBindings binding binding ...
Open a scratch window and display information about keystroke bindings in it. If no binding argument is given, then display information about all of the keystroke bindings that are currently defined. If one or more binding arguments are given, then just display information for the given bindings. Returns an empty string.
showMenus name name ...
Open a scratch window and display information about menus in it. If no name argument is given, then display information for all the menus that are currently defined. If one or more name arguments are given, then just display information for the named menus. Returns an empty string.
showProcs name name ...
Open a scratch window and display procedure information in it. If no name argument is given, then display information about all the procedures that are currently defined. If one or more name arguments are given, then just display information for the named procedures. Returns an empty string.
showVars name name ...
Open a scratch window and display variable values in it. If no name argument is given, then display the values of all variables known in the context of the caller of showVars. If one or more name arguments are given, then just show the values of those variables. Returns an empty string.
tag name
Invoke the taginfo command to look up name, then open a new window on its file, select the definition of name, and make the selected line visible in the new window. Returns an empty string.
where
Open a scratch window and display information about where the last error occurred. The error information is taken from the errorInfo global variable.
COMMAND SUBWINDOW
The command subwindow allows commands to be typed in directly, instead of invoking them through keystroke bindings or menus. When active, it appears at the bottom of the mx window. It can be activated with the command or focus commands. Commands may be entered and edited in the command subwindow, and are invoked by typing carriage-return or by middle-clicking in the window. When a command is invoked, it is not deleted from the command subwindow, in order to permit it to be re-invoked easily. The command window is de-activated by typing ^Q in it.
SEARCH SUBWINDOW
The search subwindow is used to enter search and replacement strings. When active, it appears at the top of the mx window, just underneath the menu bar. If it isn’t active and a search or replacement command is invoked that requires one of its entries, then the window is activated. It may also be activated using the focus command. The top entry in the window is used to enter a search pattern and the bottom entry is used to enter a replacement string. The values of these two entries are always available in the searchString and replaceString global variables, respectively. If carriage-return is typed in the “Search:” entry, or if the middle mouse button is clicked in the entry, then the the contents of the global variable searchCmd are invoked as a Tcl command. If carriage-return is typed in the “Replace:” entry, or if it is middle-buttoned, then the contents of the global variable replaceCmd are invoked as a Tcl command. The search subwindow can be deactivated by typing ^Q in it.
KEYWORDS
editor, mouse, window
Sprite version 1.0 — April 19, 1990