xmode.catalog: fix find-mode so it works with full paths
parent
2653ae7f47
commit
f5b4ecc14a
|
@ -1,7 +1,7 @@
|
||||||
USING: xmode.loader xmode.utilities xmode.rules namespaces
|
USING: xmode.loader xmode.utilities xmode.rules namespaces
|
||||||
strings splitting assocs sequences kernel io.files xml memoize
|
strings splitting assocs sequences kernel io.files xml memoize
|
||||||
words globs combinators io.encodings.utf8 sorting accessors xml.data
|
words globs combinators io.encodings.utf8 io.pathnames sorting
|
||||||
xml.traversal xml.syntax ;
|
accessors xml.data xml.traversal xml.syntax ;
|
||||||
IN: xmode.catalog
|
IN: xmode.catalog
|
||||||
|
|
||||||
TUPLE: mode file file-name-glob first-line-glob ;
|
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 ;
|
[ 2drop t ] [ file-name-glob>> ?glob-matches ] if ;
|
||||||
|
|
||||||
: find-mode ( file-name first-line -- mode )
|
: find-mode ( file-name first-line -- mode )
|
||||||
|
[ file-name ] dip
|
||||||
modes
|
modes
|
||||||
[ nip [ 2dup ] dip suitable-mode? ] assoc-find
|
[ nip [ 2dup ] dip suitable-mode? ] assoc-find
|
||||||
2drop [ 2drop ] dip [ "text" ] unless* ;
|
2drop [ 2drop ] dip [ "text" ] unless* ;
|
||||||
|
|
Loading…
Reference in New Issue