Commands entered at the terminal are stored in a command stack (to be technically correct, it is a queue but historically users have called it a stack). Commands may subsequently be recalled for re-execution by a simple short form command. By default, the stack holds the last 99 commands but this value can be changed by use of the CMDSTACK configuration parameter. The list is indexed by number such that the most recent command is numbered as 1, the oldest as 99. Conventionally, command 1 is referred to as the top of the stack.
The stack can be manipulated by commands prefixed by a dot character (period) entered at the command prompt. These allow commands on the stack to be edited and also provide facilities to save and restore sequences of commands to and from VOC paragraphs.
The stack manipulation commands are
|.An text||Append text to command stack entry n. There must be a space before text. Any additional spaces will be included in the appended data. If n is omitted, the top entry on the stack (position 1) is updated. The text is displayed after modification.|
|.Cn /old/new/G||Change string old to new in stack entry n. If n is omitted, it defaults to one. The delimiters around old and new may be any non-space character. The space before the first delimiter may be omitted if the delimiter is not a digit. The optional G causes a global replacement, that is, all occurrences of old are replaced by new. If G is not specified, only the first occurrence of old is changed. The text is displayed after modification.|
|.C-||Used immediately after .C this undoes the change. An intervening use of .L or .? is permitted. Any other action removes the ability to undo the change.|
|.Dn||Delete stack entry n. If n is omitted, the top stack entry is deleted.|
|.D name||Delete VOC entry name if it is a sentence or paragraph record. A confirmation prompt is issued prior to deletion.|
|.In text||Insert text as stack entry n. If n is not specified, text is inserted at the top of the stack. There must be a space before text. Any additional spaces will form part of the inserted entry.|
|.L name||List VOC entry name.|
|.Rn||Recall stack entry n to the top of the stack without deleting the original copy. If n is omitted, the top entry is duplicated.|
|.R name||Read VOC entry name to the top of the stack if it is a sentence or paragraph. Field one of the VOC entry is discarded, any continuation lines are merged and blank lines in a paragraph are omitted.|
|.S name n m||Save stack lines m to n as VOC entry name. The value of m and n may be entered in either order. If m is omitted it defaults to the same value as n. If n is also omitted, the top line of the stack is saved. The VOC entry will be a sentence if only a single line is saved, otherwise it will be a paragraph.|
|.Un||Convert stack entry n to upper case. n defaults to one if omitted.|
|.Xn||Execute command n. If n is omitted, the last command is executed.|
The repeated command is copied to the top of the stack except when executing the current topmost command.
|.X file record||Execute command stored in the named file and record. This record must have the same format as a VOC record.|
|.?||Display a help message regarding the stack manipulation commands.|
For compatibility with other environments, a command can also be saved on the stack without execution by entering it at the command prompt with a question mark as the last character. The question mark is removed.
The command stack is saved between sessions if the VOC contains a record named $COMMAND.STACK with field 1 set to X. This record is inserted automatically when a new account is created but can be deleted if the stack is not to be saved. Presence of this record causes the command stack to be saved to, or restored from, a file named as the user's login name in the stacks subdirectory of the account in which QM was entered. On ECS mode systems, the stack is saved in UTF-8 format.
QM supports a secondary, private vocabulary file that is represented by a multi-file named PVOC with subfile names that correspond to the uppercase form of the user's login name. The .D, .L, .R and .S commands have an extended form to access the private vocabulary file:
|.DP name||Delete private vocabulary entry name if it is a sentence or paragraph record. A confirmation prompt is issued prior to deletion.|
|.LP name||List private vocabulary entry name.|
|.RP name||Read private vocabulary entry name to the top of the stack if it is a sentence or paragraph. Field one of the entry is discarded, any continuation lines are merged and blank lines in a paragraph are omitted.|
|.SP name n m||Save stack lines m to n as private vocabulary entry name. The value of m and n may be entered in either order. If m is omitted it defaults to the same value as n. If n is also omitted, the top line of the stack is saved. The entry will be a sentence if only a single line is saved, otherwise it will be a paragraph.|
See also The Command Editor