xmode.catalog: fix find-mode so it works with full paths

db4
Joe Groff 2010-06-05 15:07:45 -07:00
parent 2653ae7f47
commit f5b4ecc14a
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,7 @@
USING: xmode.loader xmode.utilities xmode.rules namespaces
strings splitting assocs sequences kernel io.files xml memoize
words globs combinators io.encodings.utf8 sorting accessors xml.data
xml.traversal xml.syntax ;
words globs combinators io.encodings.utf8 io.pathnames sorting
accessors xml.data xml.traversal xml.syntax ;
IN: xmode.catalog
TUPLE: mode file file-name-glob first-line-glob ;
@ -114,6 +114,7 @@ ERROR: mutually-recursive-rulesets ruleset ;
[ 2drop t ] [ file-name-glob>> ?glob-matches ] if ;
: find-mode ( file-name first-line -- mode )
[ file-name ] dip
modes
[ nip [ 2dup ] dip suitable-mode? ] assoc-find
2drop [ 2drop ] dip [ "text" ] unless* ;