]> gitweb.factorcode.org Git - factor.git/commitdiff
editors: define EDITOR: and SET-EDITOR:
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 28 Jan 2023 01:04:59 +0000 (19:04 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 28 Jan 2023 04:41:03 +0000 (22:41 -0600)
basis/editors/editors.factor

index 5200e3300aa4d73cf03a330787be3d3e80e8a36a..e69eb567a3561e3274f85fc3a12b0aec55840a6b 100644 (file)
@@ -1,14 +1,17 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See https://factorcode.org/license.txt for BSD license.
-USING: accessors assocs calendar continuations debugger
-definitions io io.launcher io.pathnames kernel lexer namespaces
-prettyprint sequences sets source-files.errors splitting strings
-threads tools.crossref vocabs vocabs.files vocabs.hierarchy
-vocabs.loader vocabs.metadata words ;
+USING: accessors assocs calendar classes.parser
+classes.singleton continuations debugger definitions io
+io.launcher io.pathnames kernel lexer namespaces prettyprint
+sequences sets source-files.errors splitting strings threads
+tools.crossref vocabs vocabs.files vocabs.hierarchy
+vocabs.loader vocabs.metadata vocabs.parser words ;
 IN: editors
 
 SYMBOL: editor-class
 
+INITIALIZED-SYMBOL: editors [ HS{ } clone ]
+
 : available-editors ( -- seq )
     "editors" disk-child-vocab-names
     { "editors.ui" "editors.private" } diff ;
@@ -18,7 +21,10 @@ SYMBOL: editor-class
     [ [ "Load " prepend ] keep ] { } map>assoc ;
 
 SYNTAX: EDITOR:
-    f editor-class set-global "editors." scan-token append reload ;
+    scan-new-class [ define-singleton-class ] [ editors get-global adjoin ] bi ;
+
+SYNTAX: SET-EDITOR:
+    scan-token [ "editors." prepend require ] [ search ] bi editor-class set-global ;
 
 HOOK: editor-command editor-class ( file line -- command )