aboutsummaryrefslogtreecommitdiff
path: root/man/man4/acme.4
blob: 78214cad951900fdb70f78b7a97d3e4157866760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
.TH ACME 4
.SH NAME
acme \- control files for text windows
.SH SYNOPSIS
.B acme
[
.B -f
.I varfont
] [
.B -F
.I fixfont
]
[
.I file
\&... ]
.SH DESCRIPTION
The text window system
.IR acme (1)
serves a variety of files for reading, writing, and controlling
windows.
Some of them are virtual versions of system files for dealing
with the virtual console; others control operations
of 
.I acme
itself.
When a command is run under
.IR acme ,
a directory holding these files is posted as the 9P service
.B acme
(using
.IR 9pserve (4)).
.PP
Some of these files supply virtual versions of services available from the underlying
environment, in particular the character terminal files in Plan 9's
\fIcons\fR(3).
(Unlike in Plan 9's \fIrio\fR(1),
each command under
.I acme
sees the same set of files; there is not a distinct
.B /dev/cons
for each window.)
Other files are unique to
.IR acme .
.TP
.B acme
is a subdirectory used by
.B win
(see
.IR acme (1))
as a mount point for the
.I acme
files associated with the window in which
.B win
is running.
It has no specific function under
.I acme
itself.
.TP
.B cons
is the standard and diagnostic output file for all commands
run under
.IR acme .
(Input for commands is redirected to
.BR /dev/null .)
Text written to
.B cons
appears in a window labeled
.IB dir /+Errors\f1,
where
.I dir
is the directory in which the command
was run.
The window is created if necessary, but not until text is actually written.
.TP
.B consctl
Is an empty unwritable file present only for compatibility; there is no way
to turn off `echo', for example, under
.IR acme .
.TP
.B index
holds a sequence of lines of text, one per window.  Each line has 5 decimal numbers,
each formatted in 11 characters plus a blank\(emthe window ID;
number of characters (runes) in the tag;
number of characters in the body;
a 1 if the window is a directory, 0 otherwise;
and a 1 if the window is modified, 0
otherwise\(emfollowed by the tag up to a newline if present.
Thus at character position 5×12 starts the name of the window.
If a file has multiple zeroxed windows open,
only the most recently used will appear in the
.B index
file.
.TP
.B label
is an empty file, writable without effect, present only for compatibility with
.BR rio .
.TP
.B new
A directory analogous to the numbered directories
.RI ( q.v. ).
Accessing any
file in
.B new
creates a new window.  Thus to cause text to appear in a new window,
write it to
.BR /dev/new/body .
For more control, open
.BR /dev/new/ctl
and use the interface described below.
.LP
.PP
Each
.I acme
window has associated a directory numbered by its ID.
Window IDs are chosen sequentially and may be discovered by the
.B ID
command, by
reading the
.B ctl
file, or
indirectly through the
.B index
file.  The files in the numbered directories are as follows.
.TP
.B addr
may be written with any textual address (line number, regular expression, etc.),
in the format understood by button 3 but without the initial colon, including compound addresses,
to set the address for text accessed through the
.B data
file.
When read, it returns the value of the address that would next be read
or written through the
.B data
file, in the format
.BI # m ,# n
where
.I m
and
.I n
are character (not byte) offsets.  If
.I m
and
.I n
are identical, the format is just
.BI # m\f1.
Thus a regular expression may be evaluated by writing it to
.B addr
and reading it back.
The
.B addr
address has no effect on the user's selection of text.
.TP
.B body
holds contents of the window body.  It may be read at any byte offset.
Text written to
.B body
is always appended; the file offset is ignored.
.TP
.B ctl
may be read to recover the five numbers as held in the
.B index
file, described above, plus three more fields: the width of the
window in pixels, the name of the font used in the window,
and the width of a tab character in pixels.
Text messages may be written to
.B ctl
to affect the window.
Each message is terminated by a newline and multiple
messages may be sent in a single write.
.RS .5i
.TF limit=addr
.TP
.B addr=dot
Set the
.B addr
address to that of the user's selected text in the window.
.TP
.B clean
Mark the window clean as though it has just been written.
.TP
.B dirty
Mark the window dirty, the opposite of clean.
.TP
.B cleartag
Remove all text in the tag after the vertical bar.
.TP
.B del
Equivalent to the
.B Del
interactive command.
.TP
.B delete
Equivalent to the
.B Delete
interactive command.
.TP
.B dot=addr
Set the user's selected text in the window to the text addressed by the
.B addr
address.
.TP
.BI dump " command
Set the command string to recreate the window from a dump file.
.TP
.BI dumpdir " directory
Set the directory in which to run the command to recreate the window from a dump file.
.TP
.B get
Equivalent to the
.B Get
interactive command with no arguments; accepts no arguments.
.TP
.B limit=addr
When the
.B ctl
file is first opened, regular expression context searches in
.B addr
addresses examine the whole file; this message restricts subsequent
searches to the current
.B addr
address.
.TP
.B mark
Cancel
.BR nomark ,
returning the window to the usual state wherein each modification to the
body must be undone individually.
.TP
.BI name " name
Set the name of the window to
.IR name .
.TP
.B nomark
Turn off automatic `marking' of changes, so a set of related changes
may be undone in a single
.B Undo
interactive command.
.TP
.B put
Equivalent to the
.B Put
interactive command with no arguments; accepts no arguments.
.TP
.B show
Guarantee at least some of the selected text is visible on the display.
.RE
.PD
.TP
.B data
is used in conjunction with
.B addr
for random access to the contents of the body.
The file offset is ignored when writing the
.B data
file; instead the location of the data to be read or written is determined by the state of the
.B addr
file.
Text, which must contain only whole characters (no `partial runes'),
written to
.B data
replaces the characters addressed by the
.B addr
file and sets the address to the null string at the end of the written text.
A read from
.B data
returns as many whole characters as the read count will permit starting
at the beginning of the
.B addr
address (the end of the address has no effect)
and sets the address to the null string at the end of the returned
characters.
.TP
.B errors
Writing to the
.B errors
file appends to the body of the
.IB dir /+Errors
window, where
.I dir
is the directory currently named in the tag.
The window is created if necessary,
but not until text is actually written.
.TP
.B event
When a window's
.B event
file is open, changes to the window occur as always but the
actions are also reported as
messages to the reader of the file.  Also, user actions with buttons 2 and 3
(other than chorded
.B Cut
and
.BR Paste ,
which behave normally) have no immediate effect on the window;
it is expected that the program reading the
.B event
file will interpret them.
The messages have a fixed format:
a character indicating the origin or cause of the action,
a character indicating the type of the action,
four free-format blank-terminated decimal numbers,
optional text, and a newline.
The first and second numbers are the character addresses of the action,
the third is a flag,
and the final is a count of the characters in the optional text, which
may itself contain newlines.
The origin characters are
.B E
for writes to the
.B body
or
.B tag
file,
.B F
for actions through the window's other files,
.B K
for the keyboard, and
.B M
for the mouse.
The type characters are
.B D
for text deleted from the body,
.B d
for text deleted from the tag,
.B I
for text inserted to the body,
.B i
for text inserted to the tag,
.B L
for a button 3 action in the body,
.B l
for a button 3 action in the tag,
.B X
for a button 2 action in the body, and
.B x
for a button 2 action in the tag.
.IP
If the relevant text has less than 256 characters, it is included in the message;
otherwise it is elided, the fourth number is 0, and the program must read
it from the
.B data
file if needed.  No text is sent on a
.B D
or
.B d
message.
.IP
For
.BR D ,
.BR d ,
.BR I ,
and
.BR i
the flag is always zero.
For
.BR X
and
.BR x ,
the flag is a bitwise OR (reported decimally) of the following:
1 if the text indicated is recognized as an
.I acme
built-in command;
2 if the text indicated is a null string that has a non-null expansion;
if so, another complete message will follow describing the expansion
exactly as if it had been indicated explicitly (its flag will always be 0);
8 if the command has an extra (chorded) argument; if so,
two more complete messages will follow reporting the argument (with
all numbers 0 except the character count) and where it originated, in the form of
a fully-qualified button 3 style address.
.IP
For
.B L
and
.BR l ,
the flag is the bitwise OR of the following:
1 if
.I acme
can interpret the action without loading a new file;
2 if a second (post-expansion) message follows, analogous to that with
.B X
messages;
4 if the text is a file or window name (perhaps with address) rather than
plain literal text.
.IP
For messages with the 1 bit on in the flag,
writing the message back to the
.B event
file, but with the flag, count, and text omitted,
will cause the action to be applied to the file exactly as it would
have been if the
.B event
file had not been open.
.TP
.B tag
holds contents of the window tag.  It may be read at any byte offset.
Text written to
.B tag
is always appended; the file offset is ignored.
.TP
.B xdata
The
.B xdata
file like
.B data
except that reads stop at the end address.
.SH SOURCE
.B \*9/src/cmd/acme
.SH SEE ALSO
.IR rio (1),
.IR acme (1)