## The History List

Every time a regular expression is executed, it is recorded in the history list, along with the name of the program then in use, and, in substitution mode, the substitution expression. By clicking on a command on the History menu, the user may cause the history list to popup, or, if it is already popped up, to be hidden. If left in place, it will be updated every time a regular expression is executed.

By default, only the event number and regular expression are shown. A command on the History menu allows the user to toggle display of the program name.

Pressing the left mouse button while the mouse is over an entry in the history list selects it. The first time the left mouse button is clicked over a history list entry, it marks that entry. A second left-click removes the mark. A marked entry is visually distinguished from others so that important entries, e.g. successfully completed components of a complex regular expression, can be located. A history list with one entry marked is shown below.

If a file with the name "Regexp" exists in the current directory, its contents become the first entry in the history list. This entry is numbered 000. The first entry made by execution of a regular expression in the current session is numbered 001.

Every time a regular expression is executed, it is also appended to a file named .redethist. The name of the program is also recorded, as is the substitution expression if Redet is in substitution mode. If this file exists, by default it is read on startup and its contents placed in the history list. The result is that, unless this file is deleted by the user, the history list persists across sessions. Reading of the history file may be prevented via the command line option -H. The entries read from this file are given non-positive numbers to distinguish them from entries made in the current session. The history file is read prior to the Regexp file. If entries are read from both, the contents of the Regexp file will be numbered 0 and the entries from the history file will be given negative numbers.

Redet look for the history file first in the current directory, then, if it does not find it, in the user's home directory. By default, history entries are appended to a file in the current directory. The initialization file command HistoryCentralP can be used to control where the history file is written. If this flag is set to false, history entries will instead be appended to a file in the user's home directory.

Like all files generated by Redet, the history file .redethist is written in UTF-8 Unicode. However, in one respect it does not conform to the standard for UTF-8 files intended for interchange. It is necessary to use some delimiter to separate the fields from each other. If a regular character is used, such as a tab, the problem arises that the user might have included this character in an expression, in which case the parse of the history entry would go wrong. It is possible to use quoting of various sorts to deal with this, but this increases complexity and creates new opportunities for error. Instead, I have used 0xFDDF as a delimiter. This codepoint is guaranteed not to represent any character, so one can count on it not appearing in a program name, regular expression, or substitution expression. Since under normal circumstances the only program that needs to deal with history files is Redet itself, the fact that they are not normal Unicode files should not be a problem. Should you try to edit or otherwise process a history file, it it is possible that you will encounter problems. However, with one exception all of the programs that I have tested (GNU emacs, GNU ed, GNU vi, vim, Yudit) treat 0xFDDF as a character for which they have no glyph available and do not otherwise present problems. OpenOffice Writer 1.1 displays the file but if asked to save it in the original format replaces 0xFDDF with a question-mark.

A command on the History menu allows the history list to be cleared. However, it is often desirable not to remove all of a cluttered history list. The command Prune History List leaves the marked entries on the history list while removing the others.

The history list may be saved to a file by means of a command on the History menu. This is not routinely necessary since the history is automatically recorded in the .redethist file, but is useful after pruning the history list.

Clicking the right mouse button copies the selected entry and inserts it into the regular expression window.

The regular expression window may be cleared first by clicking on the clear button in the menubar. However, it is not always desirable to clear the regular expression window. The history list can be used to construct a complex regular expression in several pieces. The regular expression window will be cleared between pieces, but once each of the pieces has been constructed, the whole can be entered into the regular expression window by recalling the components from the history list.

Next
Back to Table of Contents