history(1,3,n,1 builtins)(n) Tcl Built-In Commands history(1,3,n,1 builtins)(n) NAME history(1,3,n,1 builtins) - Manipulate the history(1,3,n,1 builtins) list SYNOPSIS history(1,3,n,1 builtins) ?option? ?arg arg ...? DESCRIPTION The history(1,3,n,1 builtins) command performs one of several operations related to recently-executed commands recorded in(1,8) a history(1,3,n,1 builtins) list. Each of these recorded commands is referred to as an ``event''. When specifying an event to the history(1,3,n,1 builtins) command, the following forms may be used: [1] A number: if(3,n) positive, it refers to the event with that number (all events are numbered starting at 1). If the number is nega- tive, it selects an event relative to the current event (-1 refers to the previous event, -2 to the one before that, and so on). Event 0 refers to the current event. [2] A string: selects the most recent event that matches the string. An event is considered to match the string(3,n) either if(3,n) the string(3,n) is the same as the first characters of the event, or if(3,n) the string(3,n) matches the event in(1,8) the sense of the string(3,n) match command. The history(1,3,n,1 builtins) command can take any of the following forms: history(1,3,n,1 builtins) Same as history(1,3,n,1 builtins) info(1,5,n), described below. history(1,3,n,1 builtins) add command ?exec(3,n,1 builtins)? Adds the command argument to the history(1,3,n,1 builtins) list as a new event. If exec(3,n,1 builtins) is specified (or abbreviated) then the command is also executed and its result is returned. If exec(3,n,1 builtins) isn't specified then an empty string(3,n) is returned as result. history(1,3,n,1 builtins) change newValue ?event? Replaces the value recorded for an event with newValue. Event specifies the event to replace, and defaults to the current event (not event -1). This command is intended for use in(1,8) com- mands that implement new forms of history(1,3,n,1 builtins) substitution and wish to replace the current event (which invokes the substitution) with the command created through substitution. The return value is an empty string. history(1,3,n,1 builtins) clear(1,3x,3x clrtobot) Erase the history(1,3,n,1 builtins) list. The current keep limit is retained. The history(1,3,n,1 builtins) event numbers are reset. history(1,3,n,1 builtins) event ?event? Returns the value of the event given by event. Event defaults to -1. history(1,3,n,1 builtins) info(1,5,n) ?count? Returns a formatted string(3,n) (intended for humans to read(2,n,1 builtins)) giving the event number and contents for each of the events in(1,8) the his- tory(1,3,n,1 builtins) list except the current event. If count is specified then only the most recent count events are returned. history(1,3,n,1 builtins) keep ?count? This command may be used to change the size of the history(1,3,n,1 builtins) list to count events. Initially, 20 events are retained in(1,8) the his- tory(1,3,n,1 builtins) list. If count is not specified, the current keep limit is returned. history(1,3,n,1 builtins) nextid Returns the number of the next event to be recorded in(1,8) the his- tory(1,3,n,1 builtins) list. It is useful for things like printing the event num- ber in(1,8) command-line prompts. history(1,3,n,1 builtins) redo ?event? Re-executes the command indicated by event and return its result. Event defaults to -1. This command results in(1,8) history(1,3,n,1 builtins) revision: see below for details. HISTORY REVISION Pre-8.0 Tcl had a complex history(1,3,n,1 builtins) revision mechanism. The current mechanism is more limited, and the old history(1,3,n,1 builtins) operations substitute and words have been removed. (As a consolation, the clear(1,3x,3x clrtobot) operation was added.) The history(1,3,n,1 builtins) option redo results in(1,8) much simpler ``history(1,3,n,1 builtins) revision''. When this option is invoked then the most recent event is modified to eliminate the history(1,3,n,1 builtins) command and replace it with the result of the history(1,3,n,1 builtins) command. If you want to redo an event without modifying his- tory(1,3,n,1 builtins), then use the event operation to retrieve some event, and the add operation to add it to history(1,3,n,1 builtins) and execute it. KEYWORDS event, history(1,3,n,1 builtins), record Tcl history(1,3,n,1 builtins)(n)