3 acme \- control files for text windows
17 The text window system
19 serves a variety of files for reading, writing, and controlling
21 Some of them are virtual versions of system files for dealing
22 with the virtual console; others control operations
26 When a command is run under
28 a directory holding these files is posted as the 9P service
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
40 sees the same set of files; there is not a distinct
43 Other files are unique to
47 is a subdirectory used by
51 as a mount point for the
53 files associated with the window in which
56 It has no specific function under
61 is the standard and diagnostic output file for all commands
64 (Input for commands is redirected to
68 appears in a window labeled
72 is the directory in which the command
74 The window is created if necessary, but not until text is actually written.
77 is an empty unwritable file present only for compatibility; there is no way
78 to turn off `echo', for example, under
82 holds a sequence of lines of text, one per window. Each line has 5 decimal numbers,
83 each formatted in 11 characters plus a blank\(emthe window ID;
84 number of characters (runes) in the tag;
85 number of characters in the body;
86 a 1 if the window is a directory, 0 otherwise;
87 and a 1 if the window is modified, 0
88 otherwise\(emfollowed by the tag up to a newline if present.
89 Thus at character position 5×12 starts the name of the window.
90 If a file has multiple zeroxed windows open,
91 only the most recently used will appear in the
96 is an empty file, writable without effect, present only for compatibility with
100 reports a log of window operations since the opening of the
103 Each line describes a single operation using three fields separated by single spaces:
104 the decimal window ID, the operation, and the window name.
107 blocks until there is an operation to report, so reading the file
108 can be used to monitor editor activity and react to changes.
109 The reported operations are
113 (window creation via zerox),
119 The window name can be the empty string; in particular it is empty in
121 log entries corresponding to windows created by external programs.
124 is a directory analogous to the numbered directories
129 creates a new window. Thus to cause text to appear in a new window,
132 For more control, open
134 and use the interface described below.
139 window has associated a directory numbered by its ID.
140 Window IDs are chosen sequentially and may be discovered by the
146 indirectly through the
148 file. The files in the numbered directories are as follows.
151 may be written with any textual address (line number, regular expression, etc.),
152 in the format understood by button 3 but without the initial colon, including compound addresses,
153 to set the address for text accessed through the
156 When read, it returns the value of the address that would next be read
157 or written through the
165 are character (not byte) offsets. If
169 are identical, the format is just
171 Thus a regular expression may be evaluated by writing it to
176 address has no effect on the user's selection of text.
179 holds contents of the window body. It may be read at any byte offset.
182 is always appended; the file offset is ignored.
185 may be read to recover the five numbers as held in the
187 file, described above, plus three more fields: the width of the
188 window in pixels, the name of the font used in the window,
189 and the width of a tab character in pixels.
190 Text messages may be written to
192 to affect the window.
193 Each message is terminated by a newline and multiple
194 messages may be sent in a single write.
201 address to that of the user's selected text in the window.
204 Mark the window clean as though it has just been written.
207 Mark the window dirty, the opposite of clean.
210 Remove all text in the tag after the vertical bar.
223 Set the user's selected text in the window to the text addressed by the
228 Set the command string to recreate the window from a dump file.
230 .BI dumpdir " directory
231 Set the directory in which to run the command to recreate the window from a dump file.
236 interactive command with no arguments; accepts no arguments.
241 interactive command with a single (required) argument.
246 file is first opened, regular expression context searches in
248 addresses examine the whole file; this message restricts subsequent
249 searches to the current
256 returning the window to the usual state wherein each modification to the
257 body must be undone individually.
260 Set the name of the window to
264 Turn off automatic `marking' of changes, so a set of related changes
265 may be undone in a single
272 interactive command with no arguments; accepts no arguments.
275 Guarantee at least some of the selected text is visible on the display.
280 is used in conjunction with
282 for random access to the contents of the body.
283 The file offset is ignored when writing the
285 file; instead the location of the data to be read or written is determined by the state of the
288 Text, which must contain only whole characters (no `partial runes'),
291 replaces the characters addressed by the
293 file and sets the address to the null string at the end of the written text.
296 returns as many whole characters as the read count will permit starting
297 at the beginning of the
299 address (the end of the address has no effect)
300 and sets the address to the null string at the end of the returned
306 file appends to the body of the
310 is the directory currently named in the tag.
311 The window is created if necessary,
312 but not until text is actually written.
317 file is open, changes to the window occur as always but the
318 actions are also reported as
319 messages to the reader of the file. Also, user actions with buttons 2 and 3
324 which behave normally) have no immediate effect on the window;
325 it is expected that the program reading the
327 file will interpret them.
328 The messages have a fixed format:
329 a character indicating the origin or cause of the action,
330 a character indicating the type of the action,
331 four free-format blank-terminated decimal numbers,
332 optional text, and a newline.
333 The first and second numbers are the character addresses of the action,
335 and the final is a count of the characters in the optional text, which
336 may itself contain newlines.
337 The origin characters are
345 for actions through the window's other files,
347 for the keyboard, and
350 The type characters are
352 for text deleted from the body,
354 for text deleted from the tag,
356 for text inserted to the body,
358 for text inserted to the tag,
360 for a button 3 action in the body,
362 for a button 3 action in the tag,
364 for a button 2 action in the body, and
366 for a button 2 action in the tag.
368 If the relevant text has less than 256 characters, it is included in the message;
369 otherwise it is elided, the fourth number is 0, and the program must read
372 file if needed. No text is sent on a
384 the flag is always zero.
389 the flag is a bitwise OR (reported decimally) of the following:
390 1 if the text indicated is recognized as an
393 2 if the text indicated is a null string that has a non-null expansion;
394 if so, another complete message will follow describing the expansion
395 exactly as if it had been indicated explicitly (its flag will always be 0);
396 8 if the command has an extra (chorded) argument; if so,
397 two more complete messages will follow reporting the argument (with
398 all numbers 0 except the character count) and where it originated, in the form of
399 a fully-qualified button 3 style address.
405 the flag is the bitwise OR of the following:
408 can interpret the action without loading a new file;
409 2 if a second (post-expansion) message follows, analogous to that with
412 4 if the text is a file or window name (perhaps with address) rather than
415 For messages with the 1 bit on in the flag,
416 writing the message back to the
418 file, but with the flag, count, and text omitted,
419 will cause the action to be applied to the file exactly as it would
422 file had not been open.
425 holds contents of the window tag. It may be read at any byte offset.
428 is always appended; the file offset is ignored.
435 except that reads stop at the end address.