factor/basis/editors/emacs/emacs.factor

29 lines
741 B
Factor
Raw Normal View History

2015-06-01 17:39:30 -04:00
USING: combinators.short-circuit editors io.standard-paths
kernel make math.parser namespaces sequences system ;
2007-09-20 18:09:08 -04:00
IN: editors.emacs
SINGLETON: emacsclient
emacsclient editor-class set-global
SYMBOL: emacsclient-path
2015-06-01 17:39:30 -04:00
HOOK: find-emacsclient os ( -- path )
2015-06-01 17:39:30 -04:00
M: object find-emacsclient ( -- path )
"emacsclient" ?find-in-path ;
M: windows find-emacsclient
{
[ { "Emacs" } "emacsclientw.exe" find-in-applications ]
[ { "Emacs" } "emacsclient.exe" find-in-applications ]
[ "emacsclient.exe" ]
} 0|| ;
M: emacsclient editor-command ( file line -- command )
2007-09-20 18:09:08 -04:00
[
2015-06-01 17:39:30 -04:00
emacsclient-path get [ find-emacsclient ] unless* ,
"--no-wait" ,
number>string "+" prepend ,
2008-01-24 02:50:40 -05:00
,
2011-11-03 15:02:06 -04:00
] { } make ;