<p>Factor is a programming language with postfix syntax. The Factor plugin for <ahref="http://www.jedit.org">jEdit</a> makes for a more pleasant programming experience -- it allows you to navigate Factor source very rapidly, running unit tests and reloading code with ease. Word definitions become a pleasure to write with on the fly parsing, completion, and stack effect checking. For information on Factor itself, including extensive documentation in PDF format, see the Factor web site: <ahref="http://factor.sourceforge.net">http://factor.sourceforge.net</a>. </p>
<p>The Factor plugin needs to communicate with a running instance of a Factor runtime for most features to work. To set up the external instance, go to <b>Plugins</b>><b>Plugin Options</b>><b>Factor</b>. You will need to supply a full path to the Factor runtime, as well as a path to the image file.</p>
<p>The embedded listener can be accessed by selecting the <b>Factor</b> shell in the Console plugin. The <b>Run current file</b> and <b>Evaluate selection</b> commands can be used to send text from jEdit to the listener.<p>
<p>Factor files are parsed in a background thread and checked for errors, using the framework provided by the SideKick plugin. Errors are underlined in the text area (and listed in the <b>ErrorList</b> plugin window). Words are looked up in the external Factor instance, and you are notified of typos immediately.</p>
<p>The <b>Edit word</b> command opens a dialog box where the name of a word can be typed -- while the word is being typed, the possible completions is instantly updated, and selecting one opens the source file containing the definition of that word:</p>
<imgclass="nice-box"src="edit-word.png">
<p>To be able to edit definitions of standard library words, add a phrase like the following to your <code>$HOME/.factor-rc</code>:</p>
<preclass="nice-box"><SPANCLASS="syntax13">"</SPAN><SPANCLASS="syntax13">/home/slava/Factor/</SPAN><SPANCLASS="syntax13">"</SPAN><SPANCLASS="syntax13">"</SPAN><SPANCLASS="syntax13">resource-path</SPAN><SPANCLASS="syntax13">"</SPAN> set
<p>The <b>Infer word at caret</b> command shows a popup with the inferred stack effect. Note that not all words have an inferred stack effect. This command is great for debugging!</p>
<p>Factor words are separated into vocabularies, and each source file must list which vocabularies it uses. A common error is a missing <code>USING:</code> declaration. The <b>Use word at caret</b> command searches for the word at the caret in all vocabularies, and adds a <code>USE:</code> declaration for the vocabulary to the start of the source file -- in this case, <code>ifte</code> is found in the <code>kernel</code> vocabulary, and the parse error instantly goes away:</p>
<p>Invoking <b>Plugins</b>><b>SideKick</b>><b>Show Completion Popup</b> displays a popup of possible completions for the word at the caret -- bind this to <code>C+SPACE</code> for quick access. Inserting a call to a word via a completion popup automatically adds a <code>USING:</code> declaration, if necessary.</p>
<p>The <b>Extract word</b> command can only be invoked if there is a selection. It asks for a new word name, replaces the selection with a call to the word, and adds a new colon definition directly above the current definition.</p>