]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/acme
games/galaxy: new mouse behavior
[plan9front.git] / sys / man / 1 / acme
1 .TH ACME 1
2 .SH NAME
3 acme, win \- interactive text windows
4 .SH SYNOPSIS
5 .B acme
6 [
7 .B -ab
8 ]
9 [
10 .B -c
11 .I ncol
12 ]
13 [
14 .B -f
15 .I varfont
16 ]
17 [
18 .B -F
19 .I fixfont
20 ]
21 [
22 .B -l
23 .I loadfile
24 |
25 .I file
26 \&... ]
27 .LP
28 .B win
29 [
30 .I command
31 ]
32 .SH DESCRIPTION
33 .I Acme
34 manages windows of text that may be edited interactively or by external programs.
35 The interactive interface uses the keyboard and mouse; external programs
36 use a set of files served by
37 .IR acme ;
38 these are discussed in
39 .IR acme (4).
40 .PP
41 Any named
42 .I files
43 are read into
44 .I acme
45 windows before
46 .I acme
47 accepts input.
48 With the
49 .B -l
50 option, the state of the entire system is loaded
51 from
52 .IR loadfile ,
53 which should have been created by a
54 .B Dump
55 command (q.v.),
56 and subsequent
57 .I file
58 names are ignored.
59 Plain files display as text; directories display as columnated lists of the
60 names of their components, as in
61 .B "ls -p directory|mc
62 except that the names of subdirectories have a slash appended.
63 .PP
64 The
65 .B -f
66 .RB ( -F )
67 option sets the main font, usually variable-pitch (alternate, usually fixed-pitch);
68 the default is
69 .B /lib/font/bit/lucidasans/euro.8.font
70 .RB ( \&.../lucm/unicode.9.font ).
71 Tab intervals are set to the width of 4 (or the value of
72 .BR $tabstop )
73 numeral zeros in the appropriate font.
74 .PP
75 .SS Windows
76 .I Acme
77 windows are in two parts: a one-line
78 .I tag
79 above a multi-line
80 .IR body .
81 The body typically contains an image of a file, as in
82 .IR sam (1),
83 or the output of a
84 program, as in an
85 .IR rio (1)
86 window.
87 The tag contains a number of
88 blank-separated words, followed by a vertical bar character, followed by anything.
89 The first word is the name of the window, typically the name of the associated
90 file or directory, and the other words are commands available in that window.
91 Any text may be added after the bar; examples are strings to search for or
92 commands to execute in that window.
93 Changes to the text left of the bar will be ignored,
94 unless the result is to change the name of the
95 window.
96 .PP
97 If a window holds a directory, the name (first word of the tag) will end with
98 a slash.
99 .SS Scrolling
100 Each window has a scroll bar to the left of the body.
101 The scroll bar behaves much as in
102 .IR sam (1)
103 or
104 .IR rio (1)
105 except that scrolling occurs when the button is pressed, rather than released,
106 and continues
107 as long as the mouse button is held down in the scroll bar.
108 For example, to scroll slowly through a file,
109 hold button 3 down near the top of the scroll bar.  Moving the mouse
110 down the scroll bar speeds up the rate of scrolling.
111 .SS Layout
112 .I Acme
113 windows are arranged in columns.  By default, it creates two columns when starting;
114 this can be overridden with the
115 .B -c
116 option.
117 Placement is automatic but may be adjusted
118 using the
119 .I layout box
120 in the upper left corner of each window and column.
121 Pressing and holding any mouse button in the box drags
122 the associated window or column.
123 For windows, just
124 clicking in the layout box grows the window in place: button 1
125 grows it a little, button 2 grows it as much as it can, still leaving all other
126 tags in that column visible, and button 3 takes over the column completely,
127 temporarily hiding other windows in the column.
128 (They will return
129 .I en masse
130 if any of them needs attention.)
131 The layout box in a window is normally white; when it is black in the center,
132 it records that the file is `dirty':
133 .I acme
134 believes it is modified from its original
135 contents.
136 .PP
137 Tags exist at the top of each column and across the whole display.
138 .I Acme
139 pre-loads them with useful commands.
140 Also, the tag across the top maintains a list of executing long-running commands.
141 .SS Typing
142 The behavior of typed text is similar to that in
143 .IR rio (1)
144 except that the characters are delivered to the tag or body under the mouse; there is no
145 `click to type'.
146 (The experimental option
147 .B -b
148 causes typing to go to the most recently clicked-at or made window.)
149 The usual backspacing conventions apply.
150 As in
151 .IR sam (1)
152 but not
153 .IR rio ,
154 the ESC key selects the text typed since the last mouse action,
155 a feature particularly useful when executing commands.
156 A side effect is that typing ESC with text already selected is identical
157 to a
158 .B Cut
159 command
160 .RI ( q.v. ).
161 .PP
162 Most text, including the names of windows, may be edited uniformly.
163 The only exception is that the command names to the
164 left of the bar in a tag are maintained automatically; changes to them are repaired
165 by
166 .IR acme .
167 .PP
168 When a window is in autoindent mode
169 (see the
170 .B Indent
171 command below) and a newline character is typed,
172 acme copies leading white space on the current line to the new line.
173 The option
174 .B -a
175 causes each window to start in 
176 autoindent mode.
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 (6)).
354 .TP
355 .B Indent
356 Set the autoindent mode according to the argument:
357 .B on
358 and
359 .B off
360 set the mode for the current window;
361 .B ON
362 and
363 .B OFF
364 set the mode for all existing and future windows.
365 .TP
366 .B Kill
367 Send a
368 .B kill
369 note to
370 .IR acme -initiated
371 commands named as arguments.
372 .TP
373 .B Load
374 Restore the state of
375 .I acme
376 from a file (default
377 .BR $home/acme.dump )
378 created by the
379 .B Dump
380 command.
381 .TP
382 .B Local
383 When prefixed to a command
384 run the
385 command in the same file name space and environment variable group as
386 .IR acme .
387 The environment of the command
388 is restricted but is sufficient to run
389 .IR bind (1),
390 .IR 9fs
391 (see
392 .IR srv (4)),
393 .IR import (4),
394 etc.,
395 and to set environment variables such as
396 .BR $objtype .
397 .TP
398 .B Look
399 Search in body for occurrence of literal text indicated by the argument or,
400 if none is given, by the selected text in the body.
401 .TP
402 .B New
403 Make new window.  With arguments, load the named files into windows.
404 .TP
405 .B Newcol
406 Make new column.
407 .TP
408 .B Paste
409 Replace most recently selected text with contents of snarf buffer.
410 .TP
411 .B Put
412 Write window to the named file.
413 With no argument, write to the file named in the tag of the window.
414 .TP
415 .B Putall
416 Write all dirty windows whose names indicate existing regular files.
417 .TP
418 .B Redo
419 Complement of
420 .BR Undo .
421 .TP
422 .B Send
423 Append selected text or snarf buffer to end of body; used mainly with
424 .IR win .
425 .TP
426 .B Snarf
427 Place selected text in snarf buffer.
428 .TP
429 .B Sort
430 Arrange the windows in the column from top to bottom in lexicographical
431 order based on their names.
432 .TP
433 .B Tab
434 Set the width of tab stops for this window to the value of the argument, in units of widths of the zero
435 character.
436 With no arguments, it prints the current value.
437 .TP
438 .B Undo
439 Undo last textual change or set of changes.
440 .TP
441 .B Zerox
442 Create a copy of the window containing most recently selected text.
443 .TP
444 .B <|>
445 If a regular shell command is preceded by a
446 .BR < ,
447 .BR | ,
448 or
449 .B >
450 character, the selected text in the body of the window is affected by the
451 I/O from the command.
452 The
453 .B <
454 character causes the selection to be replaced by the standard output
455 of the command;
456 .B >
457 causes the selection to be sent as standard input to the command; and
458 .B |
459 does both at once, `piping' the selection through the command and
460 replacing it with the output.
461 .PP
462 A common place to store text for commands is in the tag; in fact
463 .I acme
464 maintains a set of commands appropriate to the state of the window
465 to the left of the bar in the tag.
466 .PP
467 If the text indicated with button 2 is not a recognized built-in, it is executed as
468 a shell command.  For example, indicating
469 .B date
470 with button 2 runs
471 .IR date (1).
472 The standard
473 and error outputs of commands are sent to the error window associated with
474 the directory from which the command was run, which will be created if
475 necessary.
476 For example, in a window
477 .B /adm/users
478 executing
479 .B pwd
480 will produce the output
481 .B /adm
482 in a (possibly newly-created) window labeled
483 .BR /adm/+Errors ;
484 in a window containing
485 .B /sys/src/cmd/sam/sam.c
486 executing
487 .B mk
488 will run
489 .IR mk (1)
490 in
491 .BR /sys/src/cmd/sam ,
492 producing output in a window labeled
493 .BR /sys/src/cmd/sam/+Errors .
494 The environment of such commands contains the variable
495 .B $%
496 with value set to the filename of the window in which the command is run,
497 and
498 .B $winid
499 set to the window's id number
500 (see
501 .IR acme (4)).
502 .SS "Mouse button 3
503 Pointing at text with button 3 instructs
504 .I acme
505 to locate or acquire the file, string, etc. described by the indicated text and
506 its context.
507 This description follows the actions taken when
508 button 3 is released after sweeping out some text.
509 In the description,
510 .I text
511 refers to the text of the original sweep or, if it was null, the result of
512 applying the same expansion rules that apply to button 2 actions.
513 .PP
514 If the text names an existing window,
515 .I acme
516 moves the mouse cursor to the selected text in the body of that window.
517 If the text names an existing file with no associated window,
518 .I acme
519 loads the file into a new window and moves the mouse there.
520 If the text is a file name contained in angle brackets,
521 .I acme
522 loads the indicated include file from the directory appropriate to the
523 suffix of the file name of the window holding the text.
524 (The
525 .B Incl
526 command adds directories to the standard list.)
527 .PP
528 If the text begins with a colon, it is taken to be an address, in
529 the style of
530 .IR sam (1),
531 within the body of the window containing the text.
532 The address is evaluated, the resulting text highlighted, and the mouse moved to it.
533 Thus, in
534 .IR acme ,
535 one must type
536 .B :/regexp
537 or
538 .B :127
539 not just
540 .B /regexp
541 or
542 .BR 127 .
543 (There is an easier way to locate literal text; see below.)
544 .PP
545 If the text is a file name followed by a colon and an address,
546 .I acme
547 loads the file and evaluates the address.  For example, clicking button 3 anywhere
548 in the text
549 .B file.c:27
550 will open
551 .BR file.c ,
552 select line
553 27, and put the mouse at the beginning of the line.  The rules about Error
554 files, directories, and so on all combine to make this an efficient way to
555 investigate errors from compilers, etc.
556 .PP
557 If the text is not an address or file, it is taken to
558 be literal text, which is then searched for in the body of the window
559 in which button 3 was clicked.  If a match is found, it is selected and the mouse is
560 moved there.  Thus, to search for occurrences of a word in a file,
561 just click button 3 on the word.  Because of the rule of using the
562 selection as the button 3 action, subsequent clicks will find subsequent
563 occurrences without moving the mouse.
564 .PP
565 In all these actions, the mouse motion is not done if the text is a null string
566 within a non-null selected string in the tag, so that (for example) complex regular expressions
567 may be selected and applied repeatedly to the
568 body by just clicking button 3 over them.
569 .SS "Chords of mouse buttons
570 Several operations are bound to multiple-button actions.
571 After selecting text, with button 1 still down, pressing button 2
572 executes
573 .B Cut
574 and button 3 executes
575 .BR Paste .
576 After clicking one button, the other undoes
577 the first; thus (while holding down button 1) 2 followed by 3 is a
578 .B Snarf
579 that leaves the file undirtied;
580 3 followed by 2 is a no-op.
581 These actions also apply to text selected by double-clicking because
582 the double-click expansion is made when the second
583 click starts, not when it ends.
584 .PP
585 Commands may be given extra arguments by a mouse chord with buttons 2 and 1.
586 While holding down button 2 on text to be executed as a command, clicking button 1
587 appends the text last pointed to by button 1 as a distinct final argument.
588 For example, to search for literal
589 .B text
590 one may execute
591 .B Look text
592 with button 2 or instead point at
593 .B text
594 with button 1 in any window, release button 1,
595 then execute
596 .BR Look ,
597 clicking button 1 while 2 is held down.
598 .PP
599 When an external command (e.g.
600 .IR echo (1))
601 is executed this way, the extra argument is passed as expected and an
602 environment variable
603 .B $acmeaddr
604 is created that holds, in the form interpreted by button 3,
605 the fully-qualified address of the extra argument.
606 .SS "Support programs
607 .I Win
608 creates a new
609 .I acme
610 window and runs a
611 .I command
612 (default
613 .BR /bin/rc )
614 in it, turning the window into something analogous to an
615 .IR rio (1)
616 window.
617 Executing text in a
618 .I win
619 window with button
620 2 is similar to using
621 .BR Send .
622 .SS "Applications and guide files
623 In the directory
624 .B /acme
625 live several subdirectories, each corresponding to a program or
626 set of related programs that employ
627 .I acme's
628 user interface.
629 Each subdirectory includes source, binaries, and a
630 .B readme
631 file for further information.
632 It also includes a
633 .BR guide ,
634 a text file holding sample commands to invoke the programs.
635 The idea is to find an example in the guide that best matches
636 the job at hand, edit it to suit, and execute it.
637 .PP
638 Whenever a command is executed by
639 .IR acme ,
640 the default search path includes the directory of the window containing
641 the command and its subdirectory
642 .BR $cputype .
643 The program directories in
644 .B /acme
645 contain appropriately labeled subdirectories of binaries,
646 so commands named
647 in the guide files will be found automatically when run.
648 Also,
649 .I acme
650 binds the directories
651 .B /acme/bin
652 and
653 .B /acme/bin/$cputype
654 to the beginning of
655 .B /bin
656 when it starts; this is where
657 .IR acme -specific
658 programs such as
659 .I win
660 reside.
661 .SH FILES
662 .TF $home/acme.dump
663 .TP
664 .B $home/acme.dump
665 default file for
666 .B Dump
667 and
668 .BR Load ;
669 also where state is written if
670 .I acme
671 dies or is killed unexpectedly, e.g. by deleting its window.
672 .TP
673 .B /acme/*/guide
674 template files for applications
675 .TP
676 .B /acme/*/readme
677 informal documentation for applications
678 .TP
679 .B /acme/*/src
680 source for applications
681 .TP
682 .B /acme/*/mips
683 MIPS-specific binaries for applications
684 .SH SOURCE
685 .B /sys/src/cmd/acme
686 .br
687 .B /acme/bin/source/win
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.