Blob


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