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