Blame


1 84a15e79 2022-02-21 op # acmerc
2 84a15e79 2022-02-21 op
3 84a15e79 2022-02-21 op I'm using this script to spawn acme on OpenBSD in all its glory!
4 84a15e79 2022-02-21 op
5 84a15e79 2022-02-21 op #!/usr/bin/env rc
6 84a15e79 2022-02-21 op
7 84a15e79 2022-02-21 op . $home/lib/profile
8 84a15e79 2022-02-21 op
9 84a15e79 2022-02-21 op if (~ $PLAN9 '') {
10 84a15e79 2022-02-21 op echo '$PLAN9 is not defined!'
11 84a15e79 2022-02-21 op exit 1
12 84a15e79 2022-02-21 op }
13 84a15e79 2022-02-21 op
14 84a15e79 2022-02-21 op Provide a sane environment for acme
15 84a15e79 2022-02-21 op
16 84a15e79 2022-02-21 op SHELL=rc
17 84a15e79 2022-02-21 op PAGER=nobs
18 84a15e79 2022-02-21 op MANPAGER=nobs
19 84a15e79 2022-02-21 op EDITOR=editinacme
20 84a15e79 2022-02-21 op VISUAL=editinacme
21 84a15e79 2022-02-21 op
22 84a15e79 2022-02-21 op Most of the utilities from plan9ports binds sockets in NAMESPACE, which
23 84a15e79 2022-02-21 op is /tmp/ns.$USER.$DISPLAY by default. I'd like to have different
24 84a15e79 2022-02-21 op namespaces per acme session, so I'm defining the env variable.
25 84a15e79 2022-02-21 op
26 84a15e79 2022-02-21 op Yes, using $pid ($$ in bourne shell) is discouraged to generate "random"
27 025e0c49 2022-03-02 op values, but here it's done on purpose: every program spawned inside
28 84a15e79 2022-02-21 op *this* terminal will share the same namespace.
29 84a15e79 2022-02-21 op
30 84a15e79 2022-02-21 op NAMESPACE=/tmp/ns.$user.$pid
31 84a15e79 2022-02-21 op mkdir -p $"NAMESPACE
32 84a15e79 2022-02-21 op
33 84a15e79 2022-02-21 op Start the plumber and fontsrv
34 84a15e79 2022-02-21 op
35 84a15e79 2022-02-21 op plumber
36 84a15e79 2022-02-21 op fontsrv &
37 84a15e79 2022-02-21 op fontsrvpid=$apid
38 84a15e79 2022-02-21 op
39 84a15e79 2022-02-21 op I've used Go Mono for a while, but I'm falling in love with bitmaps
40 84a15e79 2022-02-21 op fonts these days
41 84a15e79 2022-02-21 op
42 84a15e79 2022-02-21 op font=/usr/local/plan9/font/fixed/unicode.7x14.font
43 84a15e79 2022-02-21 op # font=/mnt/font/GoMono/10a/font
44 84a15e79 2022-02-21 op FONT=/mnt/font/InputSans-Regular/10a/font
45 84a15e79 2022-02-21 op
46 84a15e79 2022-02-21 op Start acme for real
47 84a15e79 2022-02-21 op
48 84a15e79 2022-02-21 op $PLAN9/bin/acme -a -f $font -F $FONT $* &
49 84a15e79 2022-02-21 op acmepid=$apid
50 84a15e79 2022-02-21 op
51 84a15e79 2022-02-21 op wait a bit for acme to set up its things and start autoacme
52 84a15e79 2022-02-21 op
53 84a15e79 2022-02-21 op {
54 84a15e79 2022-02-21 op sleep 1
55 84a15e79 2022-02-21 op winid=1
56 84a15e79 2022-02-21 op exec acmeeval 'autoacme '$home'/bin/acmeconfig'
57 c0109344 2022-02-21 op } &
58 84a15e79 2022-02-21 op acmeevalpid=$apid
59 84a15e79 2022-02-21 op
60 84a15e79 2022-02-21 op Then wait for acme to terminate
61 84a15e79 2022-02-21 op
62 84a15e79 2022-02-21 op wait $acmepid
63 84a15e79 2022-02-21 op
64 84a15e79 2022-02-21 op and stop acmeeval (just in case) and fontsrv
65 84a15e79 2022-02-21 op
66 84a15e79 2022-02-21 op kill $acmeevalpid
67 84a15e79 2022-02-21 op kill $fontsrvpid
68 84a15e79 2022-02-21 op
69 84a15e79 2022-02-21 op wait a little bit more
70 84a15e79 2022-02-21 op
71 84a15e79 2022-02-21 op wait # just in case
72 84a15e79 2022-02-21 op
73 84a15e79 2022-02-21 op and then kill the namespace before quitting
74 84a15e79 2022-02-21 op
75 84a15e79 2022-02-21 op rm -rf $"NAMESPACE