]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/emacs/emacs.factor
Merge branch 'master' into directory-searching
[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.loader ;
4 IN: editors.emacs
5
6 SYMBOL: emacsclient-path
7
8 HOOK: default-emacsclient os ( -- path )
9
10 M: object default-emacsclient ( -- path ) "emacsclient" ;
11
12 : emacsclient ( file line -- )
13     [
14         {
15             [ emacsclient-path get-global ]
16             [ default-emacsclient dup emacsclient-path set-global ]
17         } 0|| ,
18         "--no-wait" ,
19         number>string "+" prepend ,
20         ,
21     ] { } make
22     os windows? [ run-detached drop ] [ try-process ] if ;
23
24 : emacs ( word -- )
25     where first2 emacsclient ;
26
27 [ emacsclient ] edit-hook set-global
28
29 os windows? [ "editors.emacs.windows" require ] when