]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/editors-docs.factor
Solution to Project Euler problem 65
[factor.git] / basis / editors / editors-docs.factor
1 USING: help.markup help.syntax parser source-files
2 source-files.errors vocabs.loader ;
3 IN: editors
4
5 ARTICLE: "editor" "Editor integration"
6 "Factor development is best done with one of the supported editors; this allows you to quickly jump to definitions from the Factor environment."
7 { $subsection edit }
8 "Depending on the editor you are using, you must load one of the child vocabularies of the " { $vocab-link "editors" } " vocabulary, for example " { $vocab-link "editors.emacs" } ":"
9 { $code "USE: editors.emacs" }
10 "If you intend to always use the same editor, it helps to have it load during stage 2 bootstrap. Place the code to load and possibly configure it in the " { $link "factor-boot-rc" } "."
11 $nl
12 "Editor integration vocabularies store a quotation in a global variable when loaded:"
13 { $subsection edit-hook }
14 "If a syntax error was thrown while loading a source file, you can jump to the location of the error in your editor:"
15 { $subsection :edit } ;
16
17 ABOUT: "editor"
18
19 HELP: edit-hook
20 { $var-description "A quotation with stack effect " { $snippet "( file line -- )" } ". If not set, the " { $link edit } " word throws a condition with restarts for loading one of the sub-vocabularies of the " { $vocab-link "editors" } " vocabulary." } ;
21
22 HELP: edit
23 { $values { "defspec" "a definition specifier" } }
24 { $description "Opens the source file containing the definition using the current " { $link edit-hook } ". See " { $link "editor" } "." }
25 { $examples
26     "Editing a word definition:"
27     { $code "\\ foo edit" }
28     "A word's documentation:"
29     { $code "\\ foo >link edit" }
30     "A method definition:"
31     { $code "M\\ fixnum + edit" }
32     "A help article:"
33     { $code "\"handbook\" >link edit" }
34 } ;
35
36 HELP: edit-location
37 { $values { "file" "a pathname string" } { "line" "a positive integer" } }
38 { $description "Opens a source file at the specified line number containing using the current " { $link edit-hook } ". Line numbers are indexed starting from 1. See " { $link "editor" } "." } ;
39
40 HELP: no-edit-hook
41 { $error-description "Thrown when " { $link edit } " is called when the " { $link edit-hook } " variable is not set. See " { $link "editor" } "." } ;
42
43 HELP: :edit
44 { $description "If the most recent error was a " { $link source-file-error } " thrown while parsing a source file, opens the source file at the failing line in the default editor using the " { $link edit-hook } ". See " { $link "editor" } "." } ;