From e18e99acc3da1b6e8e8996bc9de220817cce5658 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 12 Mar 2009 21:21:48 -0500 Subject: [PATCH] Auto-use output omits duplicate vocabulary names, and the current vocabulary's private vocab --- basis/prettyprint/prettyprint.factor | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/basis/prettyprint/prettyprint.factor b/basis/prettyprint/prettyprint.factor index 7ef15b9a2f..2bdf3fb0ef 100644 --- a/basis/prettyprint/prettyprint.factor +++ b/basis/prettyprint/prettyprint.factor @@ -4,7 +4,7 @@ USING: accessors assocs colors combinators grouping io io.streams.string io.styles kernel make math math.parser namespaces parser prettyprint.backend prettyprint.config prettyprint.custom prettyprint.sections quotations sequences sorting strings vocabs -vocabs.parser words ; +vocabs.parser words sets ; IN: prettyprint > eq? nip ] with assoc-find 2drop ] curry map sift ; : prelude. ( -- ) - in get use get vocab-names use/in. ; + in get use get vocab-names prune in get ".private" append swap remove use/in. ; [ nl - "Restarts were invoked adding vocabularies to the search path." print - "To avoid doing this in the future, add the following USING:" print - "and IN: forms at the top of the source file:" print nl - prelude. - nl + { { font-style bold } { font-name "sans-serif" } } [ + "Restarts were invoked adding vocabularies to the search path." print + "To avoid doing this in the future, add the following USING:" print + "and IN: forms at the top of the source file:" print nl + ] with-style + { { page-color COLOR: light-gray } } [ prelude. ] with-nesting + nl nl ] print-use-hook set-global PRIVATE> : with-use ( obj quot -- ) - make-pprint use/in. do-pprint ; inline + make-pprint use/in. nl do-pprint ; inline : with-in ( obj quot -- ) make-pprint drop [ write-in bl ] when* do-pprint ; inline