factor/basis/editors/jedit/jedit.factor

34 lines
854 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
ERROR: jedit-not-found ;
2007-09-20 18:09:08 -04:00
HOOK: find-jedit-path os ( -- path )
2007-09-20 18:09:08 -04:00
M: object find-jedit-path f ;
2007-09-20 18:09:08 -04:00
M: macosx find-jedit-path
"org.gjt.sp.jedit" find-native-bundle
dup [ "Contents/MacOS/jedit" append-path ] when ;
2007-09-20 18:09:08 -04:00
M: windows find-jedit-path
{ "jedit" } "jedit.exe" find-in-applications ;
: jedit-path ( -- path )
\ jedit-path get-global [
find-jedit-path "jedit" or
] unless* ;
2007-09-20 18:09:08 -04:00
M: jedit editor-command ( file line -- command/f )
[
find-jedit-path ,
[ , ] [ number>string "+line:" prepend , ] bi*
] { } make ;