Blob


1 .TH ACME 1
2 .SH NAME
3 acme, win, awd \- interactive text windows
4 .SH SYNOPSIS
5 .B acme
6 [
7 .B -abr
8 ]
9 [
10 .B -f
11 .I varfont
12 ]
13 [
14 .B -F
15 .I fixfont
16 ]
17 [
18 .B -c
19 .I ncol
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/lucsans/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 .PP
178 When a window is in autoindent mode
179 (see the
180 .B Indent
181 command below) and a newline character is typed,
182 acme copies leading white space on the current line to the new line.
183 The option
184 .B -a
185 causes each window to start in
186 autoindent mode.
187 .SS "Directory context
188 Each window's tag names a directory: explicitly if the window
189 holds a directory; implicitly if it holds a regular file
190 (e.g. the directory
191 .B /adm
192 if the window holds
193 .BR /adm/users ).
194 This directory provides a
195 .I context
196 for interpreting file names in that window.
197 For example, the string
198 .B users
199 in a window labeled
200 .B /adm/
201 or
202 .B /adm/keys
203 will be interpreted as the file name
204 .BR /adm/users .
205 The directory is defined purely textually, so it can be a non-existent
206 directory or a real directory associated with a non-existent file
207 (e.g.
208 .BR /adm/not-a-file ).
209 File names beginning with a slash
210 are assumed to be absolute file names.
211 .SS Errors
212 Windows whose names begin with
213 .B -
214 or
215 .B +
216 conventionally hold diagnostics and other data
217 not directly associated with files.
218 A window labeled
219 .B +Errors
220 receives all diagnostics produced by
221 .I acme
222 itself.
223 Diagnostics from commands run by
224 .I acme
225 appear in a window named
226 .IB directory /+Errors
227 where
228 .I directory
229 is identified by the context of the command.
230 These error windows are created when needed.
231 .SS "Mouse button 1
232 Mouse button 1 selects text just as in
233 .IR sam (1)
234 or
235 .IR rio (1) ,
236 including the usual double-clicking conventions.
237 .SS "Mouse button 2
238 By an
239 action similar to selecting text with button 1,
240 button 2 indicates text to execute as a command.
241 If the indicated text has multiple white-space-separated words,
242 the first is the command name and the second and subsequent
243 are its arguments.
244 If button 2 is `clicked'\(emindicates a null string\(em\c
245 .I acme
246 .I expands
247 the indicated text to find a command to run:
248 if the click is within button-1-selected text,
249 .I acme
250 takes that selection as the command;
251 otherwise it takes the largest string of valid file name characters containing the click.
252 Valid file name characters are alphanumerics and
253 .B _
254 .B .
255 .B -
256 .B +
257 .BR / .
258 This behavior is similar to double-clicking with button 1 but,
259 because a null command is meaningless, only a single click is required.
260 .PP
261 Some commands, all by convention starting with a capital letter, are
262 .I built-ins
263 that are executed directly by
264 .IR acme :
265 .TP
266 .B Cut
267 Delete most recently selected text and place in snarf buffer.
268 .TP
269 .B Del
270 Delete window. If window is dirty, instead print a warning; a second
271 .B Del
272 will succeed.
273 .TP
274 .B Delcol
275 Delete column and all its windows, after checking that windows are not dirty.
276 .TP
277 .B Delete
278 Delete window without checking for dirtiness.
279 .TP
280 .B Dump
281 Write the state of
282 .I acme
283 to the file name, if specified, or
284 .B $home/acme.dump
285 by default.
286 .TP
287 .B Edit
288 Treat the argument as a text editing command in the style of
289 .IR sam (1).
290 The full
291 .B Sam
292 language is implemented except for the commands
293 .BR k ,
294 .BR n ,
295 .BR q ,
296 and
297 .BR ! .
298 The
299 .B =
300 command is slightly different: it includes the file name and
301 gives only the line address unless the command is explicitly
302 .BR =# .
303 The `current window' for the command is the body of the window in which the
304 .B Edit
305 command is executed.
306 Usually the
307 .B Edit
308 command would be typed in a tag; longer commands may be prepared in a
309 scratch window and executed, with
310 .B Edit
311 itself in the current window, using the 2-1 chord described below.
312 .TP
313 .B Exit
314 Exit
315 .I acme
316 after checking that windows are not dirty.
317 .TP
318 .B Font
319 With no arguments, change the font of the associated window from fixed-spaced to
320 proportional-spaced or
321 .I vice
322 .IR versa .
323 Given a file name argument, change the font of the window to that stored in the named file.
324 If the file name argument is prefixed by
325 .B var
326 .RB ( fix ),
327 also set the default proportional-spaced (fixed-spaced) font for future use to that font.
328 Other existing windows are unaffected.
329 .TP
330 .B Get
331 Load file into window, replacing previous contents (after checking for dirtiness as in
332 .BR Del ).
333 With no argument, use the existing file name of the window.
334 Given an argument, use that file but do not change the window's file name.
335 .TP
336 .B ID
337 Print window ID number
338 .RI ( q.v. ).
339 .TP
340 .B Incl
341 When opening `include' files
342 (those enclosed in
343 .BR <> )
344 with button 3,
345 .I acme
346 searches in directories
347 .B /$objtype/include
348 and
349 .BR /sys/include .
350 .B Incl
351 adds its arguments to a supplementary list of include directories, analogous to
352 the
353 .B -I
354 option to the compilers.
355 This list is per-window and is inherited when windows are created by actions in that window, so
356 .I Incl
357 is most usefully applied to a directory containing relevant source.
358 With no arguments,
359 .I Incl
360 prints the supplementary list.
361 This command is largely superseded by plumbing
362 (see
363 .IR plumb (7)).
364 .TP
365 .B Indent
366 Set the autoindent mode according to the argument:
367 .B on
368 and
369 .B off
370 set the mode for the current window;
371 .B ON
372 and
373 .B OFF
374 set the mode for all existing and future windows.
375 .TP
376 .B Kill
377 Send a
378 .B kill
379 note to
380 .IR acme -initiated
381 commands named as arguments.
382 .TP
383 .B Load
384 Restore the state of
385 .I acme
386 from a file (default
387 .BR $home/acme.dump )
388 created by the
389 .B Dump
390 command.
391 .TP
392 .B Local
393 In the Plan 9
394 .IR acme ,
395 this prefix causes a command to be run in
396 .IR acme 's own
397 file name space and environment variable group.
398 On Unix this is impossible.
399 .B Local
400 is recognized as a prefix, but has no effect on the command being executed.
401 .\" .TP
402 .\" .B Local
403 .\" When prefixed to a command
404 .\" run the
405 .\" command in the same file name space and environment variable group as
406 .\" .IR acme .
407 .\" The environment of the command
408 .\" is restricted but is sufficient to run
409 .\" .IR bind (1),
410 .\" .IR 9fs
411 .\" (see
412 .\" .IR srv (4)),
413 .\" .IR import (4),
414 .\" etc.,
415 .\" and to set environment variables such as
416 .\" .BR $objtype .
417 .TP
418 .B Look
419 Search in body for occurrence of literal text indicated by the argument or,
420 if none is given, by the selected text in the body.
421 .TP
422 .B New
423 Make new window. With arguments, load the named files into windows.
424 .TP
425 .B Newcol
426 Make new column.
427 .TP
428 .B Paste
429 Replace most recently selected text with contents of snarf buffer.
430 .TP
431 .B Put
432 Write window to the named file.
433 With no argument, write to the file named in the tag of the window.
434 .TP
435 .B Putall
436 Write all dirty windows whose names indicate existing regular files.
437 .TP
438 .B Redo
439 Complement of
440 .BR Undo .
441 .TP
442 .B Send
443 Append selected text or snarf buffer to end of body; used mainly with
444 .IR win .
445 .TP
446 .B Snarf
447 Place selected text in snarf buffer.
448 .TP
449 .B Sort
450 Arrange the windows in the column from top to bottom in lexicographical
451 order based on their names.
452 .TP
453 .B Tab
454 Set the width of tab stops for this window to the value of the argument, in units of widths of the zero
455 character.
456 With no arguments, it prints the current value.
457 .TP
458 .B Undo
459 Undo last textual change or set of changes.
460 .TP
461 .B Zerox
462 Create a copy of the window containing most recently selected text.
463 .TP
464 .B <|>
465 If a regular shell command is preceded by a
466 .BR < ,
467 .BR | ,
468 or
469 .B >
470 character, the selected text in the body of the window is affected by the
471 I/O from the command.
472 The
473 .B <
474 character causes the selection to be replaced by the standard output
475 of the command;
476 .B >
477 causes the selection to be sent as standard input to the command; and
478 .B |
479 does both at once, `piping' the selection through the command and
480 replacing it with the output.
481 .PP
482 A common place to store text for commands is in the tag; in fact
483 .I acme
484 maintains a set of commands appropriate to the state of the window
485 to the left of the bar in the tag.
486 .PP
487 If the text indicated with button 2 is not a recognized built-in, it is executed as
488 a shell command. For example, indicating
489 .B date
490 with button 2 runs
491 .IR date (1).
492 The standard
493 and error outputs of commands are sent to the error window associated with
494 the directory from which the command was run, which will be created if
495 necessary.
496 For example, in a window
497 .B /etc/passwd
498 executing
499 .B pwd
500 will produce the output
501 .B /etc
502 in a (possibly newly-created) window labeled
503 .BR /etc/+Errors ;
504 in a window containing
505 .B /home/rob/sam/sam.c
506 executing
507 .B mk
508 will run
509 .IR mk (1)
510 in
511 .BR /home/rob/sam ,
512 producing output in a window labeled
513 .BR /home/rob/sam/+Errors .
514 The environment of such commands contains the variable
515 .B $%
516 with value set to the filename of the window in which the command is run,
517 and
518 .B $winid
519 set to the window's id number
520 (see
521 .IR acme (4)).
522 .SS "Mouse button 3
523 Pointing at text with button 3 instructs
524 .I acme
525 to locate or acquire the file, string, etc. described by the indicated text and
526 its context.
527 This description follows the actions taken when
528 button 3 is released after sweeping out some text.
529 In the description,
530 .I text
531 refers to the text of the original sweep or, if it was null, the result of
532 applying the same expansion rules that apply to button 2 actions.
533 .PP
534 If the text names an existing window,
535 .I acme
536 moves the mouse cursor to the selected text in the body of that window.
537 If the text names an existing file with no associated window,
538 .I acme
539 loads the file into a new window and moves the mouse there.
540 If the text is a file name contained in angle brackets,
541 .I acme
542 loads the indicated include file from the directory appropriate to the
543 suffix of the file name of the window holding the text.
544 (The
545 .B Incl
546 command adds directories to the standard list.)
547 .PP
548 If the text begins with a colon, it is taken to be an address, in
549 the style of
550 .IR sam (1),
551 within the body of the window containing the text.
552 The address is evaluated, the resulting text highlighted, and the mouse moved to it.
553 Thus, in
554 .IR acme ,
555 one must type
556 .B :/regexp
557 or
558 .B :127
559 not just
560 .B /regexp
561 or
562 .BR 127 .
563 (There is an easier way to locate literal text; see below.)
564 .PP
565 If the text is a file name followed by a colon and an address,
566 .I acme
567 loads the file and evaluates the address. For example, clicking button 3 anywhere
568 in the text
569 .B file.c:27
570 will open
571 .BR file.c ,
572 select line
573 27, and put the mouse at the beginning of the line. The rules about Error
574 files, directories, and so on all combine to make this an efficient way to
575 investigate errors from compilers, etc.
576 .PP
577 If the text is not an address or file, it is taken to
578 be literal text, which is then searched for in the body of the window
579 in which button 3 was clicked. If a match is found, it is selected and the mouse is
580 moved there. Thus, to search for occurrences of a word in a file,
581 just click button 3 on the word. Because of the rule of using the
582 selection as the button 3 action, subsequent clicks will find subsequent
583 occurrences without moving the mouse.
584 .PP
585 In all these actions, the mouse motion is not done if the text is a null string
586 within a non-null selected string in the tag, so that (for example) complex regular expressions
587 may be selected and applied repeatedly to the
588 body by just clicking button 3 over them.
589 .SS "Chords of mouse buttons
590 Several operations are bound to multiple-button actions.
591 After selecting text, with button 1 still down, pressing button 2
592 executes
593 .B Cut
594 and button 3 executes
595 .BR Paste .
596 After clicking one button, the other undoes
597 the first; thus (while holding down button 1) 2 followed by 3 is a
598 .B Snarf
599 that leaves the file undirtied;
600 3 followed by 2 is a no-op.
601 These actions also apply to text selected by double-clicking because
602 the double-click expansion is made when the second
603 click starts, not when it ends.
604 .PP
605 Commands may be given extra arguments by a mouse chord with buttons 2 and 1.
606 While holding down button 2 on text to be executed as a command, clicking button 1
607 appends the text last pointed to by button 1 as a distinct final argument.
608 For example, to search for literal
609 .B text
610 one may execute
611 .B Look text
612 with button 2 or instead point at
613 .B text
614 with button 1 in any window, release button 1,
615 then execute
616 .BR Look ,
617 clicking button 1 while 2 is held down.
618 .PP
619 When an external command (e.g.
620 .IR echo (1))
621 is executed this way, the extra argument is passed as expected and an
622 environment variable
623 .B $acmeaddr
624 is created that holds, in the form interpreted by button 3,
625 the fully-qualified address of the extra argument.
626 .SS "Support programs
627 .I Win
628 creates a new
629 .I acme
630 window and runs a
631 .I command
632 (default
633 .BR $SHELL )
634 in it, turning the window into something analogous to an
635 .IR rio (1)
636 window.
637 Executing text in a
638 .I win
639 window with button
640 2 is similar to using
641 .BR Send .
642 .PP
643 .I Awd
644 loads the tag line of its window with the directory in which it's running, suffixed
645 .BI - label
646 (default
647 .BR rc );
648 it is
649 intended to be executed by a
650 .B cd
651 function for use in
652 .I win
653 windows. An example definition is
654 .EX
655 fn cd { builtin cd $1 && awd $sysname }
656 .EE
657 .SS "Applications and guide files
658 In the directory
659 .B /acme
660 live several subdirectories, each corresponding to a program or
661 set of related programs that employ
662 .I acme's
663 user interface.
664 Each subdirectory includes source, binaries, and a
665 .B readme
666 file for further information.
667 It also includes a
668 .BR guide ,
669 a text file holding sample commands to invoke the programs.
670 The idea is to find an example in the guide that best matches
671 the job at hand, edit it to suit, and execute it.
672 .PP
673 Whenever a command is executed by
674 .IR acme ,
675 the default search path includes the directory of the window containing
676 the command and its subdirectory
677 .BR $cputype .
678 The program directories in
679 .B /acme
680 contain appropriately labeled subdirectories of binaries,
681 so commands named
682 in the guide files will be found automatically when run.
683 Also,
684 .I acme
685 binds the directories
686 .B /acme/bin
687 and
688 .B /acme/bin/$cputype
689 to the end of
690 .B /bin
691 when it starts; this is where
692 .IR acme -specific
693 programs such as
694 .I win
695 and
696 .I awd
697 reside.
698 .SH FILES
699 .TF $home/acme.dump
700 .TP
701 .B $home/acme.dump
702 default file for
703 .B Dump
704 and
705 .BR Load ;
706 also where state is written if
707 .I acme
708 dies or is killed unexpectedly, e.g. by deleting its window.
709 .TP
710 .B /acme/*/guide
711 template files for applications
712 .TP
713 .B /acme/*/readme
714 informal documentation for applications
715 .TP
716 .B /acme/*/src
717 source for applications
718 .TP
719 .B /acme/*/mips
720 MIPS-specific binaries for applications
721 .SH SOURCE
722 .B \*9/src/cmd/acme
723 .br
724 .B \*9/src/cmd/9term/win.c
725 .br
726 .B \*9/bin/awd
727 .SH SEE ALSO
728 .IR acme (4)
729 .br
730 Rob Pike,
731 .I
732 Acme: A User Interface for Programmers.
733 .SH BUGS
734 With the
735 .B -l
736 option or
737 .B Load
738 command,
739 the recreation of windows under control of external programs
740 such as
741 .I win
742 is just to rerun the command; information may be lost.