Blob


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