Blob


1 .TH ACME 1
2 .SH NAME
3 acme, win, awd \- interactive text windows
4 .SH SYNOPSIS
5 .B acme
6 [
7 .B -f
8 .I varfont
9 ]
10 [
11 .B -F
12 .I fixfont
13 ]
14 [
15 .B -c
16 .I ncol
17 ]
18 [
19 .B -br
20 ]
21 [
22 .B -l
23 .I file
24 |
25 .I file
26 \&... ]
27 .LP
28 .B win
29 [
30 .I command
31 ]
32 .LP
33 .B awd
34 [
35 .I label
36 ]
37 .SH DESCRIPTION
38 .I Acme
39 manages windows of text that may be edited interactively or by external programs.
40 The interactive interface uses the keyboard and mouse; external programs
41 use a set of files served by
42 .IR acme ;
43 these are discussed in
44 .IR acme (4).
45 .PP
46 Any named
47 .I files
48 are read into
49 .I acme
50 windows before
51 .I acme
52 accepts input.
53 With the
54 .B -l
55 option, the state of the entire system is loaded
56 from
57 .IR file ,
58 which should have been created by a
59 .B Dump
60 command (q.v.),
61 and subsequent
62 .I file
63 names are ignored.
64 Plain files display as text; directories display as columnated lists of the
65 names of their components, as in
66 .B "ls -p directory|mc
67 except that the names of subdirectories have a slash appended.
68 .PP
69 The
70 .B -f
71 .RB ( -F )
72 option sets the main font, usually variable-pitch (alternate, usually fixed-pitch);
73 the default is
74 .B \*9/font/lucidasans/euro.8.font
75 .RB ( \&.../lucm/unicode.9.font ).
76 Tab intervals are set to the width of 4 (or the value of
77 .BR $tabstop )
78 numeral zeros in the appropriate font.
79 .PP
80 .SS Windows
81 .I Acme
82 windows are in two parts: a one-line
83 .I tag
84 above a multi-line
85 .IR body .
86 The body typically contains an image of a file, as in
87 .IR sam (1),
88 or the output of a
89 program, as in an
90 .IR rio (1)
91 window.
92 The tag contains a number of
93 blank-separated words, followed by a vertical bar character, followed by anything.
94 The first word is the name of the window, typically the name of the associated
95 file or directory, and the other words are commands available in that window.
96 Any text may be added after the bar; examples are strings to search for or
97 commands to execute in that window.
98 Changes to the text left of the bar will be ignored,
99 unless the result is to change the name of the
100 window.
101 .PP
102 If a window holds a directory, the name (first word of the tag) will end with
103 a slash.
104 .SS Scrolling
105 Each window has a scroll bar to the left of the body.
106 The scroll bar behaves much as in
107 .IR sam (1)
108 or
109 .IR rio (1)
110 except that scrolling occurs when the button is pressed, rather than released,
111 and continues
112 as long as the mouse button is held down in the scroll bar.
113 For example, to scroll slowly through a file,
114 hold button 3 down near the top of the scroll bar. Moving the mouse
115 down the scroll bar speeds up the rate of scrolling.
116 (The experimental option
117 .B -r
118 reverses the scrolling behavior of buttons 1 and 3, to behave
119 more like
120 .IR xterm (1).)
121 .SS Layout
122 .I Acme
123 windows are arranged in columns. By default, it creates two columns when starting;
124 this can be overridden with the
125 .B -c
126 option.
127 Placement is automatic but may be adjusted
128 using the
129 .I layout box
130 in the upper left corner of each window and column.
131 Pressing and holding any mouse button in the box drags
132 the associated window or column.
133 For windows, just
134 clicking in the layout box grows the window in place: button 1
135 grows it a little, button 2 grows it as much as it can, still leaving all other
136 tags in that column visible, and button 3 takes over the column completely,
137 temporarily hiding other windows in the column.
138 (They will return
139 .I en masse
140 if any of them needs attention.)
141 The layout box in a window is normally white; when it is black in the center,
142 it records that the file is `dirty':
143 .I acme
144 believes it is modified from its original
145 contents.
146 .PP
147 Tags exist at the top of each column and across the whole display.
148 .I Acme
149 pre-loads them with useful commands.
150 Also, the tag across the top maintains a list of executing long-running commands.
151 .SS Typing
152 The behavior of typed text is similar to that in
153 .IR rio (1)
154 except that the characters are delivered to the tag or body under the mouse; there is no
155 `click to type'.
156 (The experimental option
157 .B -b
158 causes typing to go to the most recently clicked-at or made window.)
159 The usual backspacing conventions apply.
160 As in
161 .IR sam (1)
162 but not
163 .IR rio ,
164 the ESC key selects the text typed since the last mouse action,
165 a feature particularly useful when executing commands.
166 A side effect is that typing ESC with text already selected is identical
167 to a
168 .B Cut
169 command
170 .RI ( q.v. ).
171 .PP
172 Most text, including the names of windows, may be edited uniformly.
173 The only exception is that the command names to the
174 left of the bar in a tag are maintained automatically; changes to them are repaired
175 by
176 .IR acme .
177 .SS "Directory context
178 Each window's tag names a directory: explicitly if the window
179 holds a directory; implicitly if it holds a regular file
180 (e.g. the directory
181 .B /adm
182 if the window holds
183 .BR /adm/users ).
184 This directory provides a
185 .I context
186 for interpreting file names in that window.
187 For example, the string
188 .B users
189 in a window labeled
190 .B /adm/
191 or
192 .B /adm/keys
193 will be interpreted as the file name
194 .BR /adm/users .
195 The directory is defined purely textually, so it can be a non-existent
196 directory or a real directory associated with a non-existent file
197 (e.g.
198 .BR /adm/not-a-file ).
199 File names beginning with a slash
200 are assumed to be absolute file names.
201 .SS Errors
202 Windows whose names begin with
203 .B -
204 or
205 .B +
206 conventionally hold diagnostics and other data
207 not directly associated with files.
208 A window labeled
209 .B +Errors
210 receives all diagnostics produced by
211 .I acme
212 itself.
213 Diagnostics from commands run by
214 .I acme
215 appear in a window named
216 .IB directory /+Errors
217 where
218 .I directory
219 is identified by the context of the command.
220 These error windows are created when needed.
221 .SS "Mouse button 1
222 Mouse button 1 selects text just as in
223 .IR sam (1)
224 or
225 .IR rio (1) ,
226 including the usual double-clicking conventions.
227 .SS "Mouse button 2
228 By an
229 action similar to selecting text with button 1,
230 button 2 indicates text to execute as a command.
231 If the indicated text has multiple white-space-separated words,
232 the first is the command name and the second and subsequent
233 are its arguments.
234 If button 2 is `clicked'\(emindicates a null string\(em\c
235 .I acme
236 .I expands
237 the indicated text to find a command to run:
238 if the click is within button-1-selected text,
239 .I acme
240 takes that selection as the command;
241 otherwise it takes the largest string of valid file name characters containing the click.
242 Valid file name characters are alphanumerics and
243 .B _
244 .B .
245 .B -
246 .B +
247 .BR / .
248 This behavior is similar to double-clicking with button 1 but,
249 because a null command is meaningless, only a single click is required.
250 .PP
251 Some commands, all by convention starting with a capital letter, are
252 .I built-ins
253 that are executed directly by
254 .IR acme :
255 .TP
256 .B Cut
257 Delete most recently selected text and place in snarf buffer.
258 .TP
259 .B Del
260 Delete window. If window is dirty, instead print a warning; a second
261 .B Del
262 will succeed.
263 .TP
264 .B Delcol
265 Delete column and all its windows, after checking that windows are not dirty.
266 .TP
267 .B Delete
268 Delete window without checking for dirtiness.
269 .TP
270 .B Dump
271 Write the state of
272 .I acme
273 to the file name, if specified, or
274 .B $home/acme.dump
275 by default.
276 .TP
277 .B Edit
278 Treat the argument as a text editing command in the style of
279 .IR sam (1).
280 The full
281 .B Sam
282 language is implemented except for the commands
283 .BR k ,
284 .BR n ,
285 .BR q ,
286 and
287 .BR ! .
288 The
289 .B =
290 command is slightly different: it includes the file name and
291 gives only the line address unless the command is explicitly
292 .BR =# .
293 The `current window' for the command is the body of the window in which the
294 .B Edit
295 command is executed.
296 Usually the
297 .B Edit
298 command would be typed in a tag; longer commands may be prepared in a
299 scratch window and executed, with
300 .B Edit
301 itself in the current window, using the 2-1 chord described below.
302 .TP
303 .B Exit
304 Exit
305 .I acme
306 after checking that windows are not dirty.
307 .TP
308 .B Font
309 With no arguments, change the font of the associated window from fixed-spaced to
310 proportional-spaced or
311 .I vice
312 .IR versa .
313 Given a file name argument, change the font of the window to that stored in the named file.
314 If the file name argument is prefixed by
315 .B var
316 .RB ( fix ),
317 also set the default proportional-spaced (fixed-spaced) font for future use to that font.
318 Other existing windows are unaffected.
319 .TP
320 .B Get
321 Load file into window, replacing previous contents (after checking for dirtiness as in
322 .BR Del ).
323 With no argument, use the existing file name of the window.
324 Given an argument, use that file but do not change the window's file name.
325 .TP
326 .B ID
327 Print window ID number
328 .RI ( q.v. ).
329 .TP
330 .B Incl
331 When opening `include' files
332 (those enclosed in
333 .BR <> )
334 with button 3,
335 .I acme
336 searches in directories
337 .B /$objtype/include
338 and
339 .BR /sys/include .
340 .B Incl
341 adds its arguments to a supplementary list of include directories, analogous to
342 the
343 .B -I
344 option to the compilers.
345 This list is per-window and is inherited when windows are created by actions in that window, so
346 .I Incl
347 is most usefully applied to a directory containing relevant source.
348 With no arguments,
349 .I Incl
350 prints the supplementary list.
351 This command is largely superseded by plumbing
352 (see
353 .IR plumb (7)).
354 .TP
355 .B Kill
356 Send a
357 .B kill
358 note to
359 .IR acme -initiated
360 commands named as arguments.
361 .TP
362 .B Local
363 In the Plan 9
364 .IR acme ,
365 this prefix causes a command to be run in
366 .IR acme 's own
367 file name space and environment variable group.
368 On Unix this is impossible.
369 .B Local
370 is recognized as a prefix, but has no effect on the command being executed.
371 .\" .TP
372 .\" .B Local
373 .\" When prefixed to a command
374 .\" run the
375 .\" command in the same file name space and environment variable group as
376 .\" .IR acme .
377 .\" The environment of the command
378 .\" is restricted but is sufficient to run
379 .\" .IR bind (1),
380 .\" .IR 9fs
381 .\" (see
382 .\" .IR srv (4)),
383 .\" .IR import (4),
384 .\" etc.,
385 .\" and to set environment variables such as
386 .\" .BR $objtype .
387 .TP
388 .B Load
389 Restore the state of
390 .I acme
391 from a file (default
392 .BR $home/acme.dump )
393 created by the
394 .B Dump
395 command.
396 .TP
397 .B Look
398 Search in body for occurrence of literal text indicated by the argument or,
399 if none is given, by the selected text in the body.
400 .TP
401 .B New
402 Make new window. With arguments, load the named files into windows.
403 .TP
404 .B Newcol
405 Make new column.
406 .TP
407 .B Paste
408 Replace most recently selected text with contents of snarf buffer.
409 .TP
410 .B Put
411 Write window to the named file.
412 With no argument, write to the file named in the tag of the window.
413 .TP
414 .B Putall
415 Write all dirty windows whose names indicate existing regular files.
416 .TP
417 .B Redo
418 Complement of
419 .BR Undo .
420 .TP
421 .B Send
422 Append selected text or snarf buffer to end of body; used mainly with
423 .IR win .
424 .TP
425 .B Snarf
426 Place selected text in snarf buffer.
427 .TP
428 .B Sort
429 Arrange the windows in the column from top to bottom in lexicographical
430 order based on their names.
431 .TP
432 .B Tab
433 Set the width of tab stops for this window to the value of the argument, in units of widths of the zero
434 character.
435 With no arguments, it prints the current value.
436 .TP
437 .B Undo
438 Undo last textual change or set of changes.
439 .TP
440 .B Zerox
441 Create a copy of the window containing most recently selected text.
442 .PP
443 A common place to store text for commands is in the tag; in fact
444 .I acme
445 maintains a set of commands appropriate to the state of the window
446 to the left of the bar in the tag.
447 .PP
448 If the text indicated with button 2 is not a recognized built-in, it is executed as
449 a shell command. For example, indicating
450 .B date
451 with button 2 runs
452 .IR date (1).
453 The standard
454 and error outputs of commands are sent to the error window associated with
455 the directory from which the command was run, which will be created if
456 necessary.
457 For example, in a window
458 .B /etc/passwd
459 executing
460 .B pwd
461 will produce the output
462 .B /etc
463 in a (possibly newly-created) window labeled
464 .BR /etc/+Errors ;
465 in a window containing
466 .B /home/rob/sam/sam.c
467 executing
468 .B mk
469 will run
470 .IR mk (1)
471 in
472 .BR /home/rob/sam ,
473 producing output in a window labeled
474 .BR /home/rob/sam/+Errors .
475 The environment of such commands contains the variable
476 .B $%
477 with value set to the filename of the window in which the command is run,
478 and
479 .B $winid
480 set to the window's id number
481 (see
482 .IR acme (4)).
483 .SS "Mouse button 3
484 Pointing at text with button 3 instructs
485 .I acme
486 to locate or acquire the file, string, etc. described by the indicated text and
487 its context.
488 This description follows the actions taken when
489 button 3 is released after sweeping out some text.
490 In the description,
491 .I text
492 refers to the text of the original sweep or, if it was null, the result of
493 applying the same expansion rules that apply to button 2 actions.
494 .PP
495 If the text names an existing window,
496 .I acme
497 moves the mouse cursor to the selected text in the body of that window.
498 If the text names an existing file with no associated window,
499 .I acme
500 loads the file into a new window and moves the mouse there.
501 If the text is a file name contained in angle brackets,
502 .I acme
503 loads the indicated include file from the directory appropriate to the
504 suffix of the file name of the window holding the text.
505 (The
506 .B Incl
507 command adds directories to the standard list.)
508 .PP
509 If the text begins with a colon, it is taken to be an address, in
510 the style of
511 .IR sam (1),
512 within the body of the window containing the text.
513 The address is evaluated, the resulting text highlighted, and the mouse moved to it.
514 Thus, in
515 .IR acme ,
516 one must type
517 .B :/regexp
518 or
519 .B :127
520 not just
521 .B /regexp
522 or
523 .BR 127 .
524 (There is an easier way to locate literal text; see below.)
525 .PP
526 If the text is a file name followed by a colon and an address,
527 .I acme
528 loads the file and evaluates the address. For example, clicking button 3 anywhere
529 in the text
530 .B file.c:27
531 will open
532 .BR file.c ,
533 select line
534 27, and put the mouse at the beginning of the line. The rules about Error
535 files, directories, and so on all combine to make this an efficient way to
536 investigate errors from compilers, etc.
537 .PP
538 If the text is not an address or file, it is taken to
539 be literal text, which is then searched for in the body of the window
540 in which button 3 was clicked. If a match is found, it is selected and the mouse is
541 moved there. Thus, to search for occurrences of a word in a file,
542 just click button 3 on the word. Because of the rule of using the
543 selection as the button 3 action, subsequent clicks will find subsequent
544 occurrences without moving the mouse.
545 .PP
546 In all these actions, the mouse motion is not done if the text is a null string
547 within a non-null selected string in the tag, so that (for example) complex regular expressions
548 may be selected and applied repeatedly to the
549 body by just clicking button 3 over them.
550 .SS "Chords of mouse buttons
551 Several operations are bound to multiple-button actions.
552 After selecting text, with button 1 still down, pressing button 2
553 executes
554 .B Cut
555 and button 3 executes
556 .BR Paste .
557 After clicking one button, the other undoes
558 the first; thus (while holding down button 1) 2 followed by 3 is a
559 .B Snarf
560 that leaves the file undirtied;
561 3 followed by 2 is a no-op.
562 These actions also apply to text selected by double-clicking because
563 the double-click expansion is made when the second
564 click starts, not when it ends.
565 .PP
566 Commands may be given extra arguments by a mouse chord with buttons 2 and 1.
567 While holding down button 2 on text to be executed as a command, clicking button 1
568 appends the text last pointed to by button 1 as a distinct final argument.
569 For example, to search for literal
570 .B text
571 one may execute
572 .B Look text
573 with button 2 or instead point at
574 .B text
575 with button 1 in any window, release button 1,
576 then execute
577 .BR Look ,
578 clicking button 1 while 2 is held down.
579 .PP
580 When an external command (e.g.
581 .IR echo (1))
582 is executed this way, the extra argument is passed as expected and an
583 environment variable
584 .B $acmeaddr
585 is created that holds, in the form interpreted by button 3,
586 the fully-qualified address of the extra argument.
587 .SS "Support programs
588 .I Win
589 creates a new
590 .I acme
591 window and runs a
592 .I command
593 (default
594 .BR $SHELL )
595 in it, turning the window into something analogous to an
596 .IR rio (1)
597 window.
598 Executing text in a
599 .I win
600 window with button
601 2 is similar to using
602 .BR Send .
603 .PP
604 .I Awd
605 loads the tag line of its window with the directory in which it's running, suffixed
606 .BI - label
607 (default
608 .BR rc );
609 it is
610 intended to be executed by a
611 .B cd
612 function for use in
613 .I win
614 windows. An example definition is
615 .EX
616 fn cd { builtin cd $1 && awd $sysname }
617 .EE
618 .SS "Applications and guide files
619 In the directory
620 .B /acme
621 live several subdirectories, each corresponding to a program or
622 set of related programs that employ
623 .I acme's
624 user interface.
625 Each subdirectory includes source, binaries, and a
626 .B readme
627 file for further information.
628 It also includes a
629 .BR guide ,
630 a text file holding sample commands to invoke the programs.
631 The idea is to find an example in the guide that best matches
632 the job at hand, edit it to suit, and execute it.
633 .PP
634 Whenever a command is executed by
635 .IR acme ,
636 the default search path includes the directory of the window containing
637 the command and its subdirectory
638 .BR $cputype .
639 The program directories in
640 .B /acme
641 contain appropriately labeled subdirectories of binaries,
642 so commands named
643 in the guide files will be found automatically when run.
644 Also,
645 .I acme
646 binds the directories
647 .B /acme/bin
648 and
649 .B /acme/bin/$cputype
650 to the end of
651 .B /bin
652 when it starts; this is where
653 .IR acme -specific
654 programs such as
655 .I win
656 and
657 .I awd
658 reside.
659 .SH FILES
660 .TF $home/acme.dump
661 .TP
662 .B $home/acme.dump
663 default file for
664 .B Dump
665 and
666 .BR Load ;
667 also where state is written if
668 .I acme
669 dies or is killed unexpectedly, e.g. by deleting its window.
670 .TP
671 .B /acme/*/guide
672 template files for applications
673 .TP
674 .B /acme/*/readme
675 informal documentation for applications
676 .TP
677 .B /acme/*/src
678 source for applications
679 .TP
680 .B /acme/*/mips
681 MIPS-specific binaries for applications
682 .SH SOURCE
683 .B \*9/src/cmd/acme
684 .br
685 .B \*9/src/cmd/9term/win.c
686 .br
687 .B \*9/bin/awd
688 .SH SEE ALSO
689 .IR acme (4)
690 .br
691 Rob Pike,
692 .I
693 Acme: A User Interface for Programmers.
694 .SH BUGS
695 With the
696 .B -l
697 option or
698 .B Load
699 command,
700 the recreation of windows under control of external programs
701 such as
702 .I win
703 is just to rerun the command; information may be lost.