]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/acme/acme.factor
ea476f6dfdfdfb50b4b525bf51c58461137eb092
[factor.git] / basis / editors / acme / acme.factor
1 ! Copyright (C) 2020 Fred Alger
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays editors environment io.files.info io.pathnames
4 kernel make math.parser namespaces sequences ;
5 IN: editors.acme
6
7 SINGLETON: acme
8 acme editor-class set-global
9
10 : plan9-path ( -- path )
11   \ plan9-path get [
12     "PLAN9" os-env [
13       "/usr/local/plan9"
14     ] unless*
15   ] unless* ;
16
17 : plan9-tool-path ( tool -- path )
18   [ plan9-path "/bin" append ] dip append-path ;
19
20 <PRIVATE
21
22 : (plumb-path) ( -- path )
23   "plumb" plan9-tool-path ;
24
25 : (massage-pathname) ( file line -- str )
26  over file-info regular-file?
27  [ number>string 2array ":" join ]
28  [ drop ] if ;
29
30 PRIVATE>
31
32 M: acme editor-command ( file line -- command )
33  [ (plumb-path) , "-d" , "edit" , (massage-pathname) , ] { } make ;