factor/basis/editors/jedit/jedit.factor

36 lines
884 B
Factor
Raw Normal View History

! Copyright (C) 2004, 2010 Slava Pestov.
2007-09-20 18:09:08 -04:00
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.short-circuit editors io.pathnames
io.standard-paths kernel make math.parser namespaces sequences
system ;
2007-09-20 18:09:08 -04:00
IN: editors.jedit
SINGLETON: jedit
jedit editor-class set-global
HOOK: find-jedit-path os ( -- path )
2007-09-20 18:09:08 -04:00
2015-06-01 17:39:30 -04:00
M: object find-jedit-path f ;
2007-09-20 18:09:08 -04:00
M: macosx find-jedit-path
2015-06-01 17:39:30 -04:00
"org.gjt.sp.jedit" find-native-bundle [
"Contents/MacOS/jedit" append-path
] [
f
] if* ;
2007-09-20 18:09:08 -04:00
M: windows find-jedit-path
{ "jedit" } "jedit.exe" find-in-applications ;
2015-06-01 17:39:30 -04:00
: jedit-path ( -- path )
2015-06-01 17:39:30 -04:00
\ jedit-path get [
find-jedit-path [ "jedit" ?find-in-path ] unless*
] unless* ;
2007-09-20 18:09:08 -04:00
M: jedit editor-command ( file line -- command/f )
[
find-jedit-path ,
2011-11-02 19:47:10 -04:00
"-reuseview" ,
[ , ] [ number>string "+line:" prepend , ] bi*
] { } make ;