From b9082ca7b1a815f51806c7cbae489d937e325855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 18 Apr 2014 02:37:56 +0200 Subject: [PATCH] FUEL: fallback to the all-words algorithm when search doesnt work It's to hard to figure out the correct "in" and "usings" values for fuel-eval-in-context when *fuel help* is looking at articles. Instead of trying, fallback on the less precise word lookup algorith and accept that it sometimes will lead you wrong. --- extra/fuel/help/help.factor | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/extra/fuel/help/help.factor b/extra/fuel/help/help.factor index c461a39b62..0083d1e456 100644 --- a/extra/fuel/help/help.factor +++ b/extra/fuel/help/help.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2009 Jose Antonio Ortega Ruiz. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs combinators fuel.eval help help.crossref -help.markup help.topics io io.streams.string kernel make namespaces -parser prettyprint sequences summary help.vocabs +USING: accessors arrays assocs combinators combinators.short-circuit fry +fuel.eval help help.crossref help.markup help.topics io io.streams.string +kernel make namespaces parser prettyprint sequences summary help.vocabs vocabs vocabs.loader vocabs.hierarchy vocabs.metadata vocabs.parser words see listener sets ; FROM: vocabs.hierarchy => child-vocabs ; @@ -11,6 +11,11 @@ IN: fuel.help > _ = ] all-words swap find nip ] } 1|| ; + : fuel-value-str ( word -- str ) [ pprint-short ] with-string-writer ; inline @@ -88,16 +93,18 @@ SYMBOL: describe-words PRIVATE> : (fuel-word-help) ( name -- elem ) - search [ [ auto-use? on (fuel-word-element) ] with-scope ] [ f ] if* ; + fuel-find-word [ + [ auto-use? on (fuel-word-element) ] with-scope + ] [ f ] if* ; : (fuel-word-synopsis) ( word usings -- str/f ) [ [ lookup-vocab ] filter interactive-vocabs [ append ] change - search [ synopsis ] [ f ] if* + fuel-find-word [ synopsis ] [ f ] if* ] with-scope ; : (fuel-word-def) ( name -- str ) - search [ [ def>> pprint ] with-string-writer ] [ f ] if* ; inline + fuel-find-word [ [ def>> pprint ] with-string-writer ] [ f ] if* ; inline : (fuel-vocab-summary) ( name -- str ) >vocab-link summary ; inline