Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / share / tcl / help / tcl / status / history
1 NAME
2 history - Manipulate the history list
3
4 SYNOPSIS
5 history ?option? ?arg arg ...?
6
7
8 DESCRIPTION
9 The history command performs one of several operations related to
10 recently-executed commands recorded in a history list. Each of these
11 recorded commands is referred to as an ``event''. When specifying an
12 event to the history command, the following forms may be used:
13
14 [1] A number: if positive, it refers to the event with that number
15 (all events are numbered starting at 1). If the number is nega-
16 tive, it selects an event relative to the current event (-1
17 refers to the previous event, -2 to the one before that, and so
18 on). Event 0 refers to the current event.
19
20 [2] A string: selects the most recent event that matches the
21 string. An event is considered to match the string either if
22 the string is the same as the first characters of the event, or
23 if the string matches the event in the sense of the string match
24 command.
25
26 The history command can take any of the following forms:
27
28 history
29 Same as history info, described below.
30
31 history add command ?exec?
32 Adds the command argument to the history list as a new event.
33 If exec is specified (or abbreviated) then the command is also
34 executed and its result is returned. If exec isn't specified
35 then an empty string is returned as result.
36
37 history change newValue ?event?
38 Replaces the value recorded for an event with newValue. Event
39 specifies the event to replace, and defaults to the current
40 event (not event -1). This command is intended for use in com-
41 mands that implement new forms of history substitution and wish
42 to replace the current event (which invokes the substitution)
43 with the command created through substitution. The return value
44 is an empty string.
45
46 history clear
47 Erase the history list. The current keep limit is retained.
48 The history event numbers are reset.
49
50 history event ?event?
51 Returns the value of the event given by event. Event defaults
52 to -1.
53
54 history info ?count?
55 Returns a formatted string (intended for humans to read) giving
56 the event number and contents for each of the events in the his-
57 tory list except the current event. If count is specified then
58 only the most recent count events are returned.
59
60 history keep ?count?
61 This command may be used to change the size of the history list
62 to count events. Initially, 20 events are retained in the his-
63 tory list. If count is not specified, the current keep limit is
64 returned.
65
66 history nextid
67 Returns the number of the next event to be recorded in the his-
68 tory list. It is useful for things like printing the event num-
69 ber in command-line prompts.
70
71 history redo ?event?
72 Re-executes the command indicated by event and returns its
73 result. Event defaults to -1. This command results in history
74 revision: see below for details.
75
76 HISTORY REVISION
77 Pre-8.0 Tcl had a complex history revision mechanism. The current
78 mechanism is more limited, and the old history operations substitute
79 and words have been removed. (As a consolation, the clear operation
80 was added.)
81
82 The history option redo results in much simpler ``history revision''.
83 When this option is invoked then the most recent event is modified to
84 eliminate the history command and replace it with the result of the
85 history command. If you want to redo an event without modifying his-
86 tory, then use the event operation to retrieve some event, and the add
87 operation to add it to history and execute it.
88
89
90 KEYWORDS