Command-Line Edit History
Definition of Terms
Notes on the History Meta-Commands
In addition to allowing the command history to be traversed and searched as described in Command-Line Editing, the command-line version of Maple provides several commands for interactively manipulating that command history.
The following terms are used throughout the remainder of this page:
The entire saved history of at most interface(historysize) commands. This is generally preserved between Maple sessions in the user's ".maple_history" file (or other file specified by interface(historyfile)).
The tail of the command history consisting of just the commands that were entered in the current session. When a session starts, the session history is initially empty.
One of the meta-commands described in this document for manipulating the command and session histories.
The following example is used to illustrate the history commands that follow. If, in the first session after installing Maple, you executed the commands,
p1 := plot(sin):
p2 := plot(cos):
and then in a second session, the commands,
y := 1/(x^4+1);
then the command history would look like this (bottom is most recent):
beginning of command history
beginning of session history
current input line
Note that the final quit (or done or stop) command is not saved between sessions.
The following are the history manipulation meta-commands. Each must begin with !! with no preceding whitespace, followed immediately by the character or word identifying the meta-command. Each command has a short single-character form, and a long word form. If an argument is specified, whitespace may precede the argument.
For those commands having an argument shown as specifier, the argument is optional. If present, it can be one of:
A positive integer, specifying how many lines of the history (beginning with the most recent) are to be affected.
A search string, preceded by a "/" character. All lines of the history from the most recent containing the string, to the most recent are affected. If the string does not begin with whitespace or a digit the "/" may be omitted.
If invoked with a specifier, lists the specified range of non-history commands from the command history.
If invoked without an argument, lists the entire session history.
If a !!=specifier command is invoked as the first command in a session (i.e. before there is a session history), those lines are considered to be session history from that point on (internally, the session history pointer is moved backward to the first command that was selected by the specifier).
To visually separate the displayed history from the rest of the session, each non-comment line is preceded by either << if interface(numberlines) is false, or by (*n*), where n is the numeric specifier currently corresponding to that line, if interface(numberlines) is true. Comment lines are displayed without any preceding annotation.
If invoked with a specifier, plays back (reexecutes) the specified range of commands stored in the command history.
If invoked with no argument, plays back all the commands in the session history.
In both cases, the commands are not added to the history again.
Like the !!=specifier command, if a !!!specifier command is invoked as the first command in session, the specified lines become session history.
While history commands are being executed, each line is echoed, preceded by >> , a double default prompt. This is suppressed if interface(echo) is 0.
In the example session, !!! would execute the five commands beginning with y := 1/(x^4+1);, and, !!!8 would reexecute the eight commands beginning with p1 := plot(sin):.
This plays back the same commands that the corresponding !!! command would, but one step at a time. Each line is first displayed and made available for editing, and is not executed until the user presses Enter.
Any changes made to the displayed command before pressing Enter will update the history in-place.
Traversing the history during playback, whether using the up and down arrow keys, or the Ctrl-R search facility, will cancel playback if the command finally executed is outside the range of commands that were being played back. Otherwise, playback will resume from that point in the command history.
During playback, entering any history meta-command will stop playback and process the new command. The null command, !!, will stop playback, do nothing else, and return to a normal prompt.
Drops the specified recent lines from the command history. If the specifier is omitted, removes one entry.
In the example session, !!-3 would remove the diff, simplify, and normal commands from the history, as would !!-/diff.
Replaces the current session history with the contents of the specified file. Those parts of the command history predating the current session are not affected.
In the example session, the lines read from the file would replace the five commands beginning with y := 1/(x^4+1);.
Appends the contents of the specified file to the command history. This is similar to !!<, except that the existing session history, if any, is not replaced.
Writes the session history into the specified file as plain text. This can be edited externally if desired. In the example session, the five commands beginning with y := 1/(x^4+1); would be written to the file.
Lists a short summary of all the meta-commands, including information on how to find this help page.
This meta-command does nothing, but if issued during a !!. playback, will stop the playback (as any history meta-command would do).
Note that you would usually issue this meta-command when the input line is already displaying a Maple command for editing and reexecution. The !! command can be entered by just typing it, followed by a space at the beginning of such a line. The rest of the line will be ignored, and it will not be updated (i.e., it will be left as it was in the history).
The !! history meta-commands are themselves added to the history when invoked, however:
They are not saved between sessions in the ".maple_history" file.
They are not written to the file produced by the !!>filename command.
They are not counted when applying a numeric specifier.
They are ignored by a search specifier and the command line editor's search command (Ctrl-R).
They do not appear in history commands displayed by !!=.
They are not reexecuted by the !!! and !!/ commands.
If you foresee having to go back to specific places in the history repeatedly, entering short comment lines such as #a, #b, etc. will make it easy to refer to these locations. A command such as !!./#a, or the slightly shorter !!.#a, will start playback from that point.
If the user interface variable historytimestamp is set to true in the user's Maple initialization file, then a timestamp indicating the date and time that the current session began is inserted into the command history just prior to the session history (i.e., the session history still starts out empty in the fresh session). This timestamp, and those of older sessions, will appear as comments in the command history.
Download Help Document