]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/textadept/textadept.factor
editors: allow them to be loaded in the load-all image
[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
19 editor-class [ textadept ] initialize
20
21 HOOK: find-textadept-path os ( -- path )
22
23 M: object find-textadept-path f ;
24
25 M: macosx find-textadept-path
26     "com.textadept" find-native-bundle [
27         "Contents/MacOS/textadept" append-path
28     ] [
29         f
30     ] if* ;
31
32 M: windows find-textadept-path
33     { "textadept_6.5.win32" } "textadept.exe" find-in-applications
34     [ "textadept.exe" ] unless* ;
35
36 : textadept-path  ( -- path )
37     \ textadept-path get [
38         find-textadept-path [ "textadept" ?find-in-path ] unless*
39     ] unless* ;
40
41 M: textadept editor-command
42     swap [
43         textadept-path , "-f" , , "-e" ,
44         1 - number>string "goto_line(" ")" surround ,
45     ] { } make ;