History:
Filter:

History : Object

keeps a history of interpreted lines of code
Source: History.sc

Description

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:

Class Methods

NOTE: Many class methods are redirected to the privileged instance of History, History.current. This is intended to provide a simple code user interface.

History.start

start adding interpreted code to (current) history.

History.end

end adding interpreted code to (current) history.

History.started

boolean whether History is started.

History.document

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/GUI/PlusGUI/Core/extGuiHistory.sc

post the history in a new document (as story). The document title is a string formatted as follows: "%Y-%m-%d-%Hh%M-History".

History.current

History.current = value

the current History instance

History.lines

History.lineShorts

the currently recorded lines in History.current. lineShorts is a copy with shortened strings for display.

History.makeWin(where, numItems: 8)

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/GUI/PlusGUI/Core/extGuiHistory.sc

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

Configuration

History.keepsLog

History.keepsLog = value

get and set flag whether to log History to a file.

History.verbose

History.verbose = value

get and set flag whether to post debug messages from History operations.

History.recordLocally

History.recordLocally = value

get and set flag to turn recording local code evaluation on and off

History.localOff

History.localOn

convenience to turn recording of local code evaluation on and off

History.forwardFunc

History.forwardFunc = value

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.

Save and load history logs

History.showLogFolder

open folder where logfiles are stored

History.showLogFile

open current log file

History.saveCS(path, forward: false)

store history as one compileString.

History.loadCS(path, forward: false)

load a history from (compilestring) file.

History.saveStory(path)

store in a file, in historical order as individual code snippets.

History.loadStory(path)

read history into current, from a file in story format.

History.rewrite(path, open: true)

Write a properly formatted code file from a history.

Arguments:

path

The filename is the original name with "_rewritten." appended.

open

If open is true (default: true), open a text window with the string.

History.readFromDoc(path)

read in a history from a code file created with .rewrite

Editing history

History.clear

remove all items from (current) history.

History.enter(lineStr, id: 'me')

add an entry to (current) history by hand.

History.drop(num)

drop the newest num lines from history. if n is negative, drop the oldest n lines.

History.keep(num)

keep only the newest num lines from history. if n is negative, keep the oldest n lines.

History.removeAt(index)

remove a specific line

History.removeLast

remove last line from history

Repeating 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.

History.ignoreErrors

History.ignoreErrors = value

global flag whether evaluating code lines via History will ignore errors or stop and throw them.

History.eval(codeString, ignoreError)

evaluate codeString, and optionally, use ignoreError to override global ignoreErrors flag.

History.evalLineAt(index)

evaluate the line at index in History.current.lines

History.play(start: 0, end, verbose: true)

play back current history from start to end line, per default verbose.

History.stop

stop current history playback.

Date, time, string functions

History.startTimeStamp

History.formatTime(val)

History.unformatTime(str)

History.shorten(line, maxLength)

History.prettyString(str)

History.new(lines)

create a new instance containing the lines given.

Inherited class methods

Undocumented class methods

History.playCmdPeriod

Instance Methods

NOTE: the instance methods [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.

.isCurrent

flag whether this history is History.current

.makeCurrent

make this history History.current

.player

the player task for ths history

.keys

all keys of code authors in this history

.addLine(now, authID, lineStr)

add a line to history with current time, id, and code string

.indicesFor(keys, string: "")

find line indices created by keys and containing string. used for filtering.

Inherited instance methods

Examples