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 new
99 A directory analogous to the numbered directories
100 .RI ( q.v. ).
101 Accessing any
102 file in
103 .B new
104 creates a new window. Thus to cause text to appear in a new window,
105 write it to
106 .BR /dev/new/body .
107 For more control, open
108 .BR /dev/new/ctl
109 and use the interface described below.
110 .LP
111 .PP
112 Each
113 .I acme
114 window has associated a directory numbered by its ID.
115 Window IDs are chosen sequentially and may be discovered by the
116 .B ID
117 command, by
118 reading the
119 .B ctl
120 file, or
121 indirectly through the
122 .B index
123 file. The files in the numbered directories are as follows.
124 .TP
125 .B addr
126 may be written with any textual address (line number, regular expression, etc.),
127 in the format understood by button 3 but without the initial colon, including compound addresses,
128 to set the address for text accessed through the
129 .B data
130 file.
131 When read, it returns the value of the address that would next be read
132 or written through the
133 .B data
134 file, in the format
135 .BI # m ,# n
136 where
137 .I m
138 and
139 .I n
140 are character (not byte) offsets. If
141 .I m
142 and
143 .I n
144 are identical, the format is just
145 .BI # m\f1.
146 Thus a regular expression may be evaluated by writing it to
147 .B addr
148 and reading it back.
149 The
150 .B addr
151 address has no effect on the user's selection of text.
152 .TP
153 .B body
154 holds contents of the window body. It may be read at any byte offset.
155 Text written to
156 .B body
157 is always appended; the file offset is ignored.
158 .TP
159 .B ctl
160 may be read to recover the five numbers as held in the
161 .B index
162 file, described above, plus three more fields: the width of the
163 window in pixels, the name of the font used in the window,
164 and the width of a tab character in pixels.
165 Text messages may be written to
166 .B ctl
167 to affect the window.
168 Each message is terminated by a newline and multiple
169 messages may be sent in a single write.
170 .RS .5i
171 .TF limit=addr
172 .TP
173 .B addr=dot
174 Set the
175 .B addr
176 address to that of the user's selected text in the window.
177 .TP
178 .B clean
179 Mark the window clean as though it has just been written.
180 .TP
181 .B dirty
182 Mark the window dirty, the opposite of clean.
183 .TP
184 .B cleartag
185 Remove all text in the tag after the vertical bar.
186 .TP
187 .B del
188 Equivalent to the
189 .B Del
190 interactive command.
191 .TP
192 .B delete
193 Equivalent to the
194 .B Delete
195 interactive command.
196 .TP
197 .B dot=addr
198 Set the user's selected text in the window to the text addressed by the
199 .B addr
200 address.
201 .TP
202 .BI dump " command
203 Set the command string to recreate the window from a dump file.
204 .TP
205 .BI dumpdir " directory
206 Set the directory in which to run the command to recreate the window from a dump file.
207 .TP
208 .B get
209 Equivalent to the
210 .B Get
211 interactive command with no arguments; accepts no arguments.
212 .TP
213 .B limit=addr
214 When the
215 .B ctl
216 file is first opened, regular expression context searches in
217 .B addr
218 addresses examine the whole file; this message restricts subsequent
219 searches to the current
220 .B addr
221 address.
222 .TP
223 .B mark
224 Cancel
225 .BR nomark ,
226 returning the window to the usual state wherein each modification to the
227 body must be undone individually.
228 .TP
229 .BI name " name
230 Set the name of the window to
231 .IR name .
232 .TP
233 .B nomark
234 Turn off automatic `marking' of changes, so a set of related changes
235 may be undone in a single
236 .B Undo
237 interactive command.
238 .TP
239 .B noscroll
240 Turn off automatic `scrolling' of the window to show text written to the body.
241 .TP
242 .B put
243 Equivalent to the
244 .B Put
245 interactive command with no arguments; accepts no arguments.
246 .TP
247 .B scroll
248 Cancel a
249 .B noscroll
250 message, returning the window to the default state wherein each write
251 to the
252 .B body
253 file causes the window to `scroll' to display the new text.
254 .TP
255 .B show
256 Guarantee at least some of the selected text is visible on the display.
257 .RE
258 .PD
259 .TP
260 .B data
261 is used in conjunction with
262 .B addr
263 for random access to the contents of the body.
264 The file offset is ignored when writing the
265 .B data
266 file; instead the location of the data to be read or written is determined by the state of the
267 .B addr
268 file.
269 Text, which must contain only whole characters (no `partial runes'),
270 written to
271 .B data
272 replaces the characters addressed by the
273 .B addr
274 file and sets the address to the null string at the end of the written text.
275 A read from
276 .B data
277 returns as many whole characters as the read count will permit starting
278 at the beginning of the
279 .B addr
280 address (the end of the address has no effect)
281 and sets the address to the null string at the end of the returned
282 characters.
283 .TP
284 .B errors
285 Writing to the
286 .B errors
287 file appends to the body of the
288 .IB dir /+Errors
289 window, where
290 .I dir
291 is the directory currently named in the tag.
292 The window is created if necessary,
293 but not until text is actually written.
294 .TP
295 .B event
296 When a window's
297 .B event
298 file is open, changes to the window occur as always but the
299 actions are also reported as
300 messages to the reader of the file. Also, user actions with buttons 2 and 3
301 (other than chorded
302 .B Cut
303 and
304 .BR Paste ,
305 which behave normally) have no immediate effect on the window;
306 it is expected that the program reading the
307 .B event
308 file will interpret them.
309 The messages have a fixed format:
310 a character indicating the origin or cause of the action,
311 a character indicating the type of the action,
312 four free-format blank-terminated decimal numbers,
313 optional text, and a newline.
314 The first and second numbers are the character addresses of the action,
315 the third is a flag,
316 and the final is a count of the characters in the optional text, which
317 may itself contain newlines.
318 The origin characters are
319 .B E
320 for writes to the
321 .B body
322 or
323 .B tag
324 file,
325 .B F
326 for actions through the window's other files,
327 .B K
328 for the keyboard, and
329 .B M
330 for the mouse.
331 The type characters are
332 .B D
333 for text deleted from the body,
334 .B d
335 for text deleted from the tag,
336 .B I
337 for text inserted to the body,
338 .B i
339 for text inserted to the tag,
340 .B L
341 for a button 3 action in the body,
342 .B l
343 for a button 3 action in the tag,
344 .B X
345 for a button 2 action in the body, and
346 .B x
347 for a button 2 action in the tag.
348 .IP
349 If the relevant text has less than 256 characters, it is included in the message;
350 otherwise it is elided, the fourth number is 0, and the program must read
351 it from the
352 .B data
353 file if needed. No text is sent on a
354 .B D
355 or
356 .B d
357 message.
358 .IP
359 For
360 .BR D ,
361 .BR d ,
362 .BR I ,
363 and
364 .BR i
365 the flag is always zero.
366 For
367 .BR X
368 and
369 .BR x ,
370 the flag is a bitwise OR (reported decimally) of the following:
371 1 if the text indicated is recognized as an
372 .I acme
373 built-in command;
374 2 if the text indicated is a null string that has a non-null expansion;
375 if so, another complete message will follow describing the expansion
376 exactly as if it had been indicated explicitly (its flag will always be 0);
377 8 if the command has an extra (chorded) argument; if so,
378 two more complete messages will follow reporting the argument (with
379 all numbers 0 except the character count) and where it originated, in the form of
380 a fully-qualified button 3 style address.
381 .IP
382 For
383 .B L
384 and
385 .BR l ,
386 the flag is the bitwise OR of the following:
387 1 if
388 .I acme
389 can interpret the action without loading a new file;
390 2 if a second (post-expansion) message follows, analogous to that with
391 .B X
392 messages;
393 4 if the text is a file or window name (perhaps with address) rather than
394 plain literal text.
395 .IP
396 For messages with the 1 bit on in the flag,
397 writing the message back to the
398 .B event
399 file, but with the flag, count, and text omitted,
400 will cause the action to be applied to the file exactly as it would
401 have been if the
402 .B event
403 file had not been open.
404 .TP
405 .B tag
406 holds contents of the window tag. It may be read at any byte offset.
407 Text written to
408 .B tag
409 is always appended; the file offset is ignored.
410 .TP
411 .B xdata
412 The
413 .B xdata
414 file like
415 .B data
416 except that reads stop at the end address.
417 .SH SOURCE
418 .B \*9/src/cmd/acme
419 .SH SEE ALSO
420 .IR rio (1),
421 .IR acme (1)