History stores all code strings as they are being evaluated, in order to reuse code written earlier, to forward code to other players, or to store, reproduce, edit and analyse live-coded performances. It records every evaluated code string into a singleton instance of History - History.current
.
First examples:
History.current
. This is intended to provide a simple code user interface.start adding interpreted code to (current) history.
end adding interpreted code to (current) history.
boolean whether History is started.
post the history in a new document (as story). The document title is a string formatted as follows: "%Y-%m-%d-%Hh%M-History"
.
the current History instance
the currently recorded lines in History.current. lineShorts is a copy with shortened strings for display.
make a HistoryGui for History.current. argument: where a point that sets left top of the HistoryGui window, argument: numItems the number of lines in the textview
get and set flag whether to log History to a file.
get and set flag whether to post debug messages from History operations.
get and set flag to turn recording local code evaluation on and off
convenience to turn recording of local code evaluation on and off
a function to run on incoming new lines, can be used to send code by network. See the Utopia quark for examples of networking code history.
open folder where logfiles are stored
open current log file
store history as one compileString.
load a history from (compilestring) file.
store in a file, in historical order as individual code snippets.
read history into current, from a file in story format.
Write a properly formatted code file from a history.
path |
The filename is the original name with "_rewritten." appended. |
open |
If open is true (default: true), open a text window with the string. |
read in a history from a code file created with .rewrite
remove all items from (current) history.
add an entry to (current) history by hand.
drop the newest num lines from history. if n is negative, drop the oldest n lines.
keep only the newest num lines from history. if n is negative, keep the oldest n lines.
remove a specific line
remove last line from history
Repeating history can have different uses: A. Reconstruction, e.g. redoing a history of coding steps as closely as possible, or replaying a full performance as closely as possible; here, all errors are important and should be handled individually. B. Experimental live performance, e.g. replaying snippets from a recorded networked live-coding show in nonlinear orders; here, errors will occur more often because the current state will not always fit with what a particular line would require. Thus, one will likely prefer the robustness to just keep going.
global flag whether evaluating code lines via History will ignore errors or stop and throw them.
evaluate codeString, and optionally, use ignoreError to override global ignoreErrors flag.
evaluate the line at index in History.current.lines
play back current history from start to end line, per default verbose.
stop current history playback.
create a new instance containing the lines given.
[hasMovedOn_, hasMovedOn, play, stop, lines, lineShorts, removeAt, removeLast, keep, drop, clear, saveCS, loadCS, saveStory, evalLineAt, loadStory, makeWin, document]
are also implemented as class methods, and documented above.flag whether this history is History.current
make this history History.current
the player task for ths history
all keys of code authors in this history
add a line to history with current time, id, and code string
find line indices created by keys and containing string. used for filtering.