]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/sublime/sublime.factor
basis: removing unnecessary method stack effects.
[factor.git] / basis / editors / sublime / sublime.factor
1 ! Copyright (C) 2013 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators.short-circuit editors io.pathnames
4 io.standard-paths kernel make math.parser namespaces sequences
5 system ;
6 IN: editors.sublime
7
8 SINGLETON: sublime
9 sublime editor-class set-global
10
11 HOOK: find-sublime-path os ( -- path )
12
13 M: object find-sublime-path f ;
14
15 M: macosx find-sublime-path
16     { "com.sublimetext.3" "com.sublimetext.2" } [ find-native-bundle ] map-find drop [
17         "Contents/SharedSupport/bin/subl" append-path
18     ] [
19         f
20     ] if* ;
21
22 M: windows find-sublime-path
23     {
24         [ { "Sublime Text 3" } "subl.exe" find-in-applications ]
25         [ { "Sublime Text 2" } "sublime_text.exe" find-in-applications ]
26         [ "subl.exe" ]
27     } 0|| ;
28
29 : sublime-path  ( -- path )
30     \ sublime-path get [
31         find-sublime-path [ "subl" ?find-in-path ] unless*
32     ] unless* ;
33
34 M: sublime editor-command
35     [
36         sublime-path , "-a" , number>string ":" glue ,
37     ] { } make ;