]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/emacs/emacs.factor
editors.emacs: add an emacsclient-args on request.
[factor.git] / basis / editors / emacs / emacs.factor
1 USING: combinators.short-circuit editors io.standard-paths
2 kernel make math.parser namespaces sequences system ;
3 IN: editors.emacs
4
5 SINGLETON: emacsclient
6 emacsclient editor-class set-global
7
8 SYMBOL: emacsclient-path
9 SYMBOL: emacsclient-args
10
11 HOOK: find-emacsclient os ( -- path )
12
13 M: object find-emacsclient ( -- path )
14     "emacsclient" ?find-in-path ;
15
16 M: windows find-emacsclient
17     {
18         [ { "Emacs" } "emacsclientw.exe" find-in-applications ]
19         [ { "Emacs" } "emacsclient.exe" find-in-applications ]
20         [ "emacsclient.exe" ]
21     } 0|| ;
22
23 M: emacsclient editor-command ( file line -- command )
24     [
25         emacsclient-path get [ find-emacsclient ] unless* ,
26         emacsclient-args get %
27         "-a=emacs" ,
28         "--no-wait" ,
29         number>string "+" prepend ,
30         ,
31     ] { } make ;