More robust amended-use behavior

db4
Slava Pestov 2008-11-29 15:21:40 -06:00
parent 8b863ed5e5
commit b8fff571b4
1 changed files with 9 additions and 15 deletions

View File

@ -80,17 +80,17 @@ ERROR: no-word-error name ;
: <no-word-error> ( name possibilities -- error restarts ) : <no-word-error> ( name possibilities -- error restarts )
[ drop \ no-word-error boa ] [ word-restarts ] 2bi ; [ drop \ no-word-error boa ] [ word-restarts ] 2bi ;
SYMBOL: amended-use? SYMBOL: amended-use
SYMBOL: auto-use? SYMBOL: auto-use?
: no-word-restarted ( restart-value -- word ) : no-word-restarted ( restart-value -- word )
dup word? [ dup word? [
amended-use? on
dup vocabulary>> dup vocabulary>>
[ (use+) ] [ [ (use+) ]
"Added ``" swap "'' vocabulary to search path" 3append note. [ amended-use get dup [ push ] [ 2drop ] if ]
] bi [ "Added ``" swap "'' vocabulary to search path" 3append note. ]
tri
] [ create-in ] if ; ] [ create-in ] if ;
: no-word ( name -- newword ) : no-word ( name -- newword )
@ -232,22 +232,16 @@ SYMBOL: interactive-vocabs
SYMBOL: print-use-hook SYMBOL: print-use-hook
print-use-hook global [ [ ] or ] change-at print-use-hook global [ [ ] or ] change-at
!
: parse-fresh ( lines -- quot ) : parse-fresh ( lines -- quot )
[ [
amended-use? off V{ } clone amended-use set
parse-lines parse-lines
amended-use? get [ amended-use get empty? [ print-use-hook get call ] unless
print-use-hook get call
] when
] with-file-vocabs ; ] with-file-vocabs ;
: parsing-file ( file -- ) : parsing-file ( file -- )
"quiet" get [ "quiet" get [ drop ] [ "Loading " write print flush ] if ;
drop
] [
"Loading " write print flush
] if ;
: filter-moved ( assoc1 assoc2 -- seq ) : filter-moved ( assoc1 assoc2 -- seq )
swap assoc-diff [ swap assoc-diff [