]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/textadept/textadept.factor
0d370955737b2c4805f4511883ad878e87921173
[factor.git] / basis / editors / textadept / textadept.factor
1 ! Copyright 2013 Michael T. Richter <ttmrichter@gmail.com>
2 !
3 ! This program is free software and comes without any warranty, express nor
4 ! implied.  It is, in short, warranted to do absolutely nothing but (possibly)
5 ! occupy storage space.  You can redistribute it and/or modify it under the
6 ! terms of the Do What The Fuck You Want To Public License, Version 2, as
7 ! published by Sam Hocevar.  Consult http://www.wtfpl.net/txt/copying for full
8 ! legal details.
9 !
10 ! For more information about Textadept, consult http://foicica.com/textadept/
11
12 USING: combinators.short-circuit editors io.launcher
13 io.pathnames io.standard-paths kernel make math math.parser
14 namespaces sequences system vocabs ;
15 IN: editors.textadept
16
17 SINGLETON: textadept
18 textadept editor-class set-global
19
20 HOOK: find-textadept-path os ( -- path )
21
22 M: object find-textadept-path f ;
23
24 M: macosx find-textadept-path
25     "com.textadept" find-native-bundle [
26         "Contents/MacOS/textadept" append-path
27     ] [
28         f
29     ] if* ;
30
31 M: windows find-textadept-path
32     { "textadept_6.5.win32" } "textadept.exe" find-in-applications
33     [ "textadept.exe" ] unless* ;
34
35 : textadept-path  ( -- path )
36     \ textadept-path get [
37         find-textadept-path [ "textadept" ?find-in-path ] unless*
38     ] unless* ;
39
40 M: textadept editor-command ( file line -- command )
41     swap [
42         textadept-path , "-f" , , "-e" ,
43         1 - number>string "goto_line(" ")" surround ,
44     ] { } make ;