]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/jedit/jedit.factor
7a2b8114ede1dc718c7488c338cfe1e97372a2e5
[factor.git] / basis / editors / jedit / jedit.factor
1 ! Copyright (C) 2004, 2010 Slava Pestov.
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.jedit
7
8 SINGLETON: jedit
9 jedit editor-class set-global
10
11 ERROR: jedit-not-found ;
12
13 HOOK: find-jedit-path os ( -- path )
14
15 M: object find-jedit-path f ;
16
17 M: macosx find-jedit-path
18     "org.gjt.sp.jedit" find-native-bundle [
19         "Contents/MacOS/jedit" append-path
20     ] [
21         f
22     ] if* ;
23
24 M: windows find-jedit-path
25     { "jedit" } "jedit.exe" find-in-applications ;
26
27 : jedit-path ( -- path )
28     \ jedit-path get [
29         find-jedit-path [ "jedit" ?find-in-path ] unless*
30     ] unless* ;
31
32 M: jedit editor-command ( file line -- command/f )
33     [
34         find-jedit-path ,
35         "-reuseview" ,
36         [ , ] [ number>string "+line:" prepend , ] bi*
37     ] { } make ;