diff --git a/extra/editors/editors.factor b/extra/editors/editors.factor index 930a39dfdf..7d95c8ce8a 100644 --- a/extra/editors/editors.factor +++ b/extra/editors/editors.factor @@ -1,21 +1,36 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: parser kernel namespaces sequences definitions io.files -inspector continuations tuples tools.crossref io prettyprint -source-files ; +inspector continuations tuples tools.crossref tools.browser +io prettyprint source-files assocs vocabs vocabs.loader ; IN: editors TUPLE: no-edit-hook ; -M: no-edit-hook summary drop "No edit hook is set" ; +M: no-edit-hook summary + drop "You must load one of the below vocabularies before using editor integration:" ; SYMBOL: edit-hook +: available-editors ( -- seq ) + "editors" all-child-vocabs + values concat [ vocab-name ] map ; + +: editor-restarts ( -- alist ) + available-editors + [ "Load " over append swap ] { } map>assoc ; + +: no-edit-hook ( -- ) + \ no-edit-hook construct-empty + editor-restarts throw-restarts + require ; + : edit-location ( file line -- ) - >r ?resource-path r> - edit-hook get dup [ - \ no-edit-hook construct-empty throw - ] if ; + edit-hook get [ + >r >r ?resource-path r> r> call + ] [ + no-edit-hook edit-location + ] if* ; : edit ( defspec -- ) where [ first2 edit-location ] when* ; diff --git a/extra/ui/tools/operations/operations.factor b/extra/ui/tools/operations/operations.factor index d2d7685f45..b7a59f5c28 100755 --- a/extra/ui/tools/operations/operations.factor +++ b/extra/ui/tools/operations/operations.factor @@ -64,6 +64,7 @@ V{ } clone operations set-global { +keyboard+ T{ key-down f { C+ } "E" } } { +primary+ t } { +secondary+ t } + { +listener+ t } } define-operation UNION: definition word method-spec link ; @@ -72,6 +73,7 @@ UNION: editable-definition definition vocab vocab-link ; [ editable-definition? ] \ edit H{ { +keyboard+ T{ key-down f { C+ } "E" } } + { +listener+ t } } define-operation UNION: reloadable-definition definition pathname ;