diff --git a/doc/jedit/complete.png b/doc/jedit/complete.png new file mode 100644 index 0000000000..9f1742bf4d Binary files /dev/null and b/doc/jedit/complete.png differ diff --git a/doc/jedit/describe.png b/doc/jedit/describe.png new file mode 100644 index 0000000000..1255158311 Binary files /dev/null and b/doc/jedit/describe.png differ diff --git a/doc/jedit/edit-word.png b/doc/jedit/edit-word.png new file mode 100644 index 0000000000..dd22a3b8b3 Binary files /dev/null and b/doc/jedit/edit-word.png differ diff --git a/doc/jedit/error.png b/doc/jedit/error.png new file mode 100644 index 0000000000..4980f1b2e4 Binary files /dev/null and b/doc/jedit/error.png differ diff --git a/doc/jedit/index.html b/doc/jedit/index.html new file mode 100644 index 0000000000..d180b5a973 --- /dev/null +++ b/doc/jedit/index.html @@ -0,0 +1,173 @@ + + +Factor plugin + + + + + + + + +

Factor plugin

+ +

Factor is a programming language with postfix syntax. The Factor plugin for jEdit provides many nifty time-saving features for working with Factor code.

+ +

Introduction

+ +If Factor is compiled with the jEdit classes in the class path, the resulting Factor.jar can then be placed in $HOME/.jedit/jars/ and loaded by jEdit.

+ +Note that while the Factor plugin requires jEdit 4.2pre15, you will need to download and install the Factor edit mode separately from the Factor home page. If you are running jEdit 4.2final, this edit mode is already included. + +

Embedded interpreter

+ +

The plugin embeds a Factor interpreter inside jEdit that gets lazily loaded when first used. The interpreter communicates with the plugin and vice versa to perform various useful tasks.

+ +

The Run current file and Evaluate selection commands can be used to send text from jEdit to the interpreter.

+ + + +

If you have CFactor installed, it is possible to embed it in jEdit using the inferior.factor socket protocol. Add the following to your $HOME/.factor-rc: + +

USE: telnetd
+: inf 9999 telnetd ;
+: cfactor "localhost" 9999 <client> inferior-client ;
+
+ + +

Now, start CFactor and type the following phrase:

+ +
inf
+ +

Then open the Factor listener window in jEdit, and type the following phrase:

+ +
cfactor
+ +

You will now be talking to the CFactor interpreter prompt. Styled text output and hyperlinks will be transmitted using the inferior.factor socket protocol.

+ +

Cross-referencing

+ +

The Edit word at caret command opens the source file containing the definition of the word at the caret. See word at caret shows the definition of the word at the caret in the Factor listener window.

+ +

The Edit word 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:

+ + + +

To be able to edit definitions of standard library words, add a phrase like the following to your $HOME/.factor-rc:

+ +
"/home/slava/Factor/" "resource-path" set
+
+ +

The Word usages at caret command displays a list of words that refer to the word at the caret in the Factor listener window. Clicking on words in the listener shows a popup menu with various useful actions.

+ + + +

Here we see the result of selecting Describe.

+ + + +

Error checking

+ +

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 ErrorList plugin window).

+ + + +

A common error is a missing USE: declaration. The Plugins>Factor>Use word at caret command searches for the word at the caret in all vocabularies, and adds a USE: declaration for the vocabulary to the start of the source file -- in this case, ifte is found in the combinators vocabulary, and the parse error instantly goes away:

+ + + +

Completion and browsing

+ +

The stack effect of the word at the caret is shown in the status bar.

+ + + +

Invoking Plugins>SideKick>Show Completion Popup displays a popup of possible completions for the word at the caret -- bind this to C+SPACE for quick access:

+ + + +

The Plugins>SideKick>Structure Browser displays a list of all words defined in the current buffer:

+ + + + + diff --git a/doc/jedit/listener.png b/doc/jedit/listener.png new file mode 100644 index 0000000000..e0d5228fe8 Binary files /dev/null and b/doc/jedit/listener.png differ diff --git a/doc/jedit/status.png b/doc/jedit/status.png new file mode 100644 index 0000000000..56933df687 Binary files /dev/null and b/doc/jedit/status.png differ diff --git a/doc/jedit/usages.png b/doc/jedit/usages.png new file mode 100644 index 0000000000..3154bed40a Binary files /dev/null and b/doc/jedit/usages.png differ diff --git a/doc/jedit/word-list.png b/doc/jedit/word-list.png new file mode 100644 index 0000000000..71295a434e Binary files /dev/null and b/doc/jedit/word-list.png differ diff --git a/doc/jedit/word-use.png b/doc/jedit/word-use.png new file mode 100644 index 0000000000..e7f31acdae Binary files /dev/null and b/doc/jedit/word-use.png differ diff --git a/doc/plugin.html b/doc/plugin.html deleted file mode 100644 index 189715d272..0000000000 --- a/doc/plugin.html +++ /dev/null @@ -1,71 +0,0 @@ - - -Factor plugin - - - - - - - - -

Factor plugin

- -Factor is a programming language with postfix syntax. This document describes the Factor plugin only, not the Factor language itself. The language is described in detail in the Factor Developer's Guide. Also, be sure to visit the Factor home page located at factor.sourceforge.net.

- -If you're interested in using the Factor plugin as a quick calculator embedded in jEdit, here is a quick start guide: - -

2 2 + .
-10 3 ^ .
-HEX: ffce HEX: fefc bitand .
-pi sin .
-pi i * exp .
- -

Introduction

- -If Factor is compiled with the jEdit classes in the class path, the resulting Factor.jar can then be placed in $HOME/.jedit/jars/ and loaded by jEdit.

- -The plugin embeds a Factor interpreter inside jEdit that gets lazily loaded when first used. The interpreter communicates with the plugin and vice versa to perform various useful tasks.

- -Note that while the Factor plugin requires jEdit 4.2pre15, you will need to download and install the Factor edit mode separately from the Factor home page. If you are running jEdit 4.2final, this edit mode is already included. - -

Plugin actions

- -The Factor plugin adds a menu to jEdit's Plugins menu with the following commands (which can also be assigned keyboard shortcuts, added to the tool bar etc): - - - -

SideKick parser

- -The Factor plugin uses the SideKick plugin to perform background parsing of Factor source files. This has the following implications: - - - - - diff --git a/doc/tutorial/numbers-game.factor b/doc/tutorial/numbers-game.factor index 0cb72b4894..4d99271a7a 100644 --- a/doc/tutorial/numbers-game.factor +++ b/doc/tutorial/numbers-game.factor @@ -1,6 +1,7 @@ ! Numbers game example IN: numbers-game +USE: combinators USE: kernel USE: math USE: parser @@ -22,7 +23,7 @@ USE: stack : judge-guess ( actual guess -- ? ) 2dup = [ - correct f + 2drop correct f ] [ inexact-guess t ] ifte ;