]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/jedit/jedit.factor
editors: allow them to be loaded in the load-all image
[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
10 editor-class [ jedit ] initialize
11
12 HOOK: find-jedit-path os ( -- path )
13
14 M: object find-jedit-path f ;
15
16 M: macosx find-jedit-path
17     "org.gjt.sp.jedit" find-native-bundle [
18         "Contents/MacOS/jedit" append-path
19     ] [
20         f
21     ] if* ;
22
23 M: windows find-jedit-path
24     { "jedit" } "jedit.exe" find-in-applications ;
25
26 : jedit-path ( -- path )
27     \ jedit-path get [
28         find-jedit-path [ "jedit" ?find-in-path ] unless*
29     ] unless* ;
30
31 M: jedit editor-command
32     [
33         find-jedit-path ,
34         "-reuseview" ,
35         [ , ] [ number>string "+line:" prepend , ] bi*
36     ] { } make ;