|
From: Daniel J S. <dan...@ie...> - 2007-06-08 18:11:59
|
Before I make changes, lets agree on behavior. Below is a rewrite of the
documentation. Basically, the rule is never discard anything from history,
simply display and next/previous through it according to one of three modes
resembling the bash shell options.
Two unresolved things.
1) What should be the default for {full|ignoredups|condensed}? And why?
2) Can we deprecate "historysize". (I've currently programmed "set history <n>"
and "set historysize <n>" to be the same.)
Dan
-----------
?commands set history
?set history
?unset history
Note: the command `set history` is only available when gnuplot has been
gnuplot has been configured with the GNU readline or its own history feature.
Syntax:
set history {<int>} {numbered|quiet} {full|ignoredups|condensed}
unset history
The value <int> indicates the value of history size when leaving gnuplot. It
is used for truncating the history to at most that many lines. The default
is 666. The option `quiet` will suppress numbers alongside the history, which
is useful for mouse copy and paste.
Options `full`, `ignoredups` and `condensed` control the manner in which
history is displayed and the way in which next/previous step through history.
In `full` mode, gnuplot shows every history entry. In `ignoredups` mode,
whenever there are back-to-back duplicate entries only one is listed. It is
similar in appearance to bash shell history with the "ignoredups" option, but
no commands are actually discarded from gnuplot's history list. `condensed`
mode results in a displayed history with only the most recent unique entries
and is similar in appearance to bash shell history with the "erasedups"
configuration. Again, no commands are actually discarded from history in any
of the modes. This ensures that repeated recall from history by number with
the same number produces the same command.
`unset history` will set history operation to its default settings: no history
truncation at exit and thus allow indefinite number of lines, `full`, and
`numbered`.
----------------
?commands history
?history
`history` command lists, saves or executes previous entries in the history of
the command line editing. The history list is retained in full and as typed
by the user. However, gnuplot may be configured (see `set history`) to display
the history in a variety of abbreviated and quiet formats. In quiet format, no
numbers are listed next to the history commands. In condensed format, only the
most recent of any repeated commands is shown. In ignoredups format, only one
of a succession of duplicate entries is show. The examples below illustrate
several other features:
history # show the history
history 5 # show last 5 entries in the history
history quiet 5 # show last 5 entries without entry numbers
history numbered 5 # show last 5 entries with entry numbers
history "hist.gp" # write the complete history to file hist.gp
history "hist.gp" append # append the complete history to file hist.gp
history 10 "hist.gp" # write last 10 commands to file hist.gp
history 10 "|head -5 >>diary.gp" # write 5 history commands using pipe
history ?load # show all history entries starting with "load"
history ?"set c" # like above, several words enclosed in quotes
hi !reread # execute last entry starting with "reread"
hist !"set xr" # like above, several words enclosed in quotes
hi !hi # possibly recursive, see note below
hi !123 # execute entry numbered 123 in the history list
history full 10 # show every line of last 10 entries
history condensed # show only most recent unique history entries
history ignoredups # show just one of contiguous duplicate entries
hi clear # clear all entries from the history
On systems which support a popen function (Unix), the output of history can be
piped through an external program by starting the file name with a '|', as one
of the above examples demonstrates.
Use of ! to execute old commands in the history list have the potential to be
recursive. For example "hi !hi" may be directly recursive if it itself was
the most recent command. However, there are more indirect, non-obvious ways
to an infinite recursion. For this reason, gnuplot will stop if in any series
of history commands the same line is executed twice.
|