]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/emacs/emacs.factor
Make "foo.private" require load foo instead.
[factor.git] / basis / editors / emacs / emacs.factor
1 USING: definitions io.launcher kernel parser words sequences math
2 math.parser namespaces editors make system combinators.short-circuit
3 fry threads vocabs ;
4 IN: editors.emacs
5
6 SINGLETON: emacsclient
7 emacsclient editor-class set-global
8
9 SYMBOL: emacsclient-path
10
11 HOOK: default-emacsclient os ( -- path )
12
13 M: object default-emacsclient ( -- path ) "emacsclient" ;
14
15 M: emacsclient editor-command ( file line -- command )
16     [
17         {
18             [ emacsclient-path get-global ]
19             [ default-emacsclient dup emacsclient-path set-global ]
20         } 0|| ,
21         "--no-wait" ,
22         number>string "+" prepend ,
23         ,
24     ] { } make
25     os windows? [ run-detached drop ] [ try-process ] if ;
26
27 : emacs ( word -- )
28     where first2 emacsclient ;
29
30 os windows? [ "editors.emacs.windows" require ] when