summaryrefslogtreecommitdiff
path: root/man/1/acme
blob: d8779336292f2e56fe87d4e41bb802c8522c8ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
.TH ACME 1
.SH NAME
acme, win \- interactive text windows
.SH SYNOPSIS
.B acme
[
.B -f
.I varfont
]
[
.B -F
.I fixfont
]
[
.B -c
.I ncol
]
[
.B -b
]
[
.B -l
.I file
|
.I file
\&... ]
.LP
.B win
[
.I command
]
.SH DESCRIPTION
.I Acme
manages windows of text that may be edited interactively or by external programs.
The interactive interface uses the keyboard and mouse; external programs
use a set of files served by
.IR acme ;
these are discussed in
.IR acme (4).
.PP
Any named
.I files
are read into
.I acme
windows before
.I acme
accepts input.
With the
.B -l
option, the state of the entire system is loaded
from
.IR file ,
which should have been created by a
.B Dump
command (q.v.),
and subsequent
.I file
names are ignored.
Plain files display as text; directories display as columnated lists of the
names of their components with the names of subdirectories having a slash appended.
.PP
The
.B -f
.RB ( -F )
option sets the default variable-pitch (fixed-pitch)
font; the default is
.B /fonts/lucidasans/euro.8.font
.RB ( \&.../lucm/unicode.9.font ).
Tab intervals are set to the width of 4 numeral zeros in the variable-pitch font.
.PP
.SS Windows
.I Acme
windows are in two parts: a one-line
.I tag
above a multi-line
.IR body .
The body typically contains an image of a file or the output of a program.
The tag contains a number of
blank-separated words, followed by a vertical bar character, followed by anything.
The first word is the name of the window, typically the name of the associated
file or directory, and the other words are commands available in that window.
Any text may be added after the bar; examples are strings to search for or
commands to execute in that window.
Changes to the text left of the bar will be ignored,
unless the result is to change the name of the
window.
.PP
If a window holds a directory, the name (first word of the tag) will end with
a slash.
.SS Scrolling
Each window has a scroll bar to the left of the body.
Scrolling occurs when the button is pressed, rather than released,
and continues
as long as the mouse button is held down in the scroll bar.
For example, to scroll slowly through a file,
hold button 3 down near the top of the scroll bar.  Moving the mouse
down the scroll bar speeds up the rate of scrolling. Scrolling backwards is performed
similarly using button 1. Button 2 allows absolute movement within the text; clicking it
at different heights within the scroll bar changes the focused text without intermediate
scrolling.
.SS Layout
.I Acme
windows are arranged in columns.  By default, it creates two columns when starting;
this can be overridden with the
.B -c
option.
Placement is automatic but may be adjusted
using the
.I layout box
in the upper left corner of each window and column.
Pressing and holding any mouse button in the box drags
the associated window or column.
For windows, just
clicking in the layout box grows the window in place: button 1
grows it a little, button 2 grows it as much as it can, still leaving all other
tags in that column visible, and button 3 takes over the column completely,
temporarily hiding other windows in the column.
(They will return
.I en masse
if any of them needs attention.)
The layout box in a window is normally white; when it is black in the center,
it records that the file is `dirty':
.I Acme
believes it is modified from its original
contents.
.PP
Tags exist at the top of each column and across the whole display.
.I Acme
pre-loads them with useful commands.
Also, the tag across the top maintains a list of executing long-running commands.
.SS Typing
The behaviour of typed text is as one would expect
except that the characters are delivered to the tag or body under the mouse; there is no
`click to type'.
(The experimental option
.B -b
causes typing to go to the most recently clicked-at or made window.)
The usual backspacing conventions apply.
The ESC key selects the text typed since the last mouse action,
a feature particularly useful when executing commands.
A side effect is that typing ESC with text already selected is identical
to a
.B Cut
command
.RI ( q.v. ).
.PP
Most text, including the names of windows, may be edited uniformly.
The only exception is that the command names to the
left of the bar in a tag are maintained automatically; changes to them are repaired
by
.IR acme .
.SS "Directory context
Each window's tag names a directory: explicitly if the window
holds a directory; implicitly if it holds a regular file
(e.g. the directory
.B /module
if the window holds
.BR /module/sys.m ).
This directory provides a
.I context
for interpreting file names in that window.
For example, the string
.B sys.m
in a window labelled
.B /module/
or
.B /module/draw.m
will be interpreted as the file name
.BR /module/sys.m .
The directory is defined purely textually, so it can be a non-existent
directory or a real directory associated with a non-existent file
(e.g.
.BR /module/not-a-file ).
File names beginning with a slash
are assumed to be absolute file names.
.SS Errors
Windows whose names begin with
.B -
or
.B +
conventionally hold diagnostics and other data
not directly associated with files.
A window labelled
.B +Errors
receives all diagnostics produced by
.I acme
itself.
Diagnostics from commands run by
.I acme
appear in a window named
.IB directory /+Errors
where
.I directory
is identified by the context of the command.
These error windows are created when needed.
.SS "Mouse button 1
Mouse button 1 selects text and double-clicking highlights the text for replacement text to be
typed in. 
.PP
Button 1 is also useful for matching symbols. For example to match curly brackets in some limbo
source, 
double click button 1 immediately after the open curly bracket.
The whole of the text up to any matching end curly bracket will be highlighted. A similar match
is made if the double click is performed immediately before the end bracket. In all,
.I acme
will match the pairs { and }, [ and ], ( and ), < and >, « and », ' and ', " and ", ` and `.
Also whole lines of text may be highlighted by double clicking at the beginning or end of the line.
.SS "Mouse button 2
By an
action similar to selecting text with button 1,
button 2 indicates text to execute as a command.
If the indicated text has multiple white-space-separated words,
the first is the command name and the second and subsequent
are its arguments.
If button 2 is `clicked'\(emindicates a null string\(em\c
.I acme
.I expands
the indicated text to find a command to run:
if the click is within button-1-selected text,
.I acme
takes that selection as the command;
otherwise it takes the largest string of valid file name characters containing the click.
Valid file name characters are alphanumerics and
.B _
.B .
.B -
.B +
.BR / .
This behaviour is similar to double-clicking with button 1 but,
because a null command is meaningless, only a single click is required.
.PP
Some commands, all by convention starting with a capital letter, are
.I built-ins
that are executed directly by
.IR acme :
.TF "Lineno\ \ "
.PD
.TP
.B Cut
Delete most recently selected text and place in snarf buffer.
.TP
.B Del
Delete window.  If window is dirty, instead print a warning; a second
.B Del
will succeed.
.TP
.B Delcol
Delete column and all its windows, after checking that windows are not dirty.
.TP
.B Delete
Delete window without checking for dirtiness.
.TP
.B Dump
Write the state of
.I acme
to the file name, if specified, or
.B $home/acme.dump
by default.
.TP
.B Edit
Treat the argument as a text editing command in the style of Plan9's
.IR sam.
The full
.B Sam
language is implemented except for the commands
.BR k ,
.BR n ,
.BR q ,
and
.BR ! .
The
.B =
command is slightly different: it includes the file name and
gives only the line address unless the command is explicitly
.BR =# .
The `current window' for the command is the body of the window in which the
.B Edit
command is executed.
Usually the
.B Edit
command would be typed in a tag; longer commands may be prepared in a
scratch window and executed, with
.B Edit
itself in the current window, using the 2-1 chord described below. See the later
section on editing for a full description of the commands available here.
.TP
.B Exit
Exit
.I acme
after checking that windows are not dirty.
.TP
.B Font
With no arguments, change the font of the associated window from fixed-spaced to
proportional-spaced or
.I vice versa\f1.
Given a file name argument, change the font of the window to that stored in the named file.
If the file name argument is prefixed by
.B var
.RB ( fix ),
also set the default proportional-spaced (fixed-spaced) font for future use to that font.
Other existing windows are unaffected.
.TP
.B Get
Load file into window, replacing previous contents (after checking for dirtiness as in
.BR Del ).
With no argument, use the existing file name of the window.
Given an argument, use that file but do not change the window's file name.
.TP
.B ID
Print window ID number
.RI ( q.v. ).
.TP
.B Incl
When opening `include' files with button 3,
.I acme
searches in the directories
.B /module
and
.B /include .
.B Incl
adds its arguments to a supplementary list of include directories, analogous to
the
.B -I
option to the compilers.
This list is per-window and is inherited when windows are created by actions in that window, so
.I Incl
is most usefully applied to a directory containing relevant source.
With no arguments,
.I Incl
prints the supplementary list.
.TP
.B Kill
Send a
.B kill
note to
.IR acme -initiated
commands named as arguments.
.TP
.B Lineno
Give the line number(s) of the currently selected text.
.TP
.B Load
Restore the state of
.I acme
from a file (default
.BR $home/acme.dump )
created by the
.B Dump
command.
.TP
.B Local
When prefixed to a command
run the
command in the same file name space and environment variable group as
.IR acme .
The environment of the command
is restricted but is sufficient to run
.IR bind (1),
.IR mount ,
etc.,
and to set environment variables.
.TP
.B Look
Search in body for occurrence of literal text indicated by the argument or,
if none is given, by the selected text in the body.
.TP
.B New
Make new window.  With arguments, load the named files into windows.
.TP
.B Newcol
Make new column.
.TP
.B Paste
Replace most recently selected text with contents of snarf buffer.
.TP
.B Put
Write window to the named file.
With no argument, write to the file named in the tag of the window.
.TP
.B Putall
Write all dirty windows whose names indicate existing regular files.
.TP
.B Redo
Complement of
.BR Undo .
.TP
.B Send
Append selected text or snarf buffer to end of body; used mainly with
.IR win .
.TP
.B Snarf
Place selected text in snarf buffer.
.TP
.B Sort
Arrange the windows in the column from top to bottom in lexicographical
order based on their names.
.TP
.B Undo
Undo last textual change or set of changes.
.TP
.B Zerox
Create a copy of the window containing most recently selected text.
.PP
A common place to store text for commands is in the tag; in fact
.I acme
maintains a set of commands appropriate to the state of the window
to the left of the bar in the tag.
.PP
If the text indicated with button 2 is not a recognized built-in, it is executed as
a shell command.  For example, indicating
.B date
with button 2 runs
.IR date (1).
The standard
and error outputs of commands are sent to the error window associated with
the directory from which the command was run, which will be created if
necessary.
For example, in a window
.B /module/sys.m
executing
.B pwd
will produce the output
.B /module
in a (possibly newly-created) window labelled
.BR /adm/+Errors ;
in a window containing
.B /appl/cmd/date.b
executing
.B "limbo date.b"
will run
.IR limbo (1)
in
.BR /appl/cmd ,
producing output in a window labelled
.BR /appl/cmd/+Errors .
.SS "Mouse button 3
Pointing at text with button 3 instructs
.I acme
to locate or acquire the file, string, etc. described by the indicated text and
its context.
This description follows the actions taken when
button 3 is released after sweeping out some text.
In the description,
.I text
refers to the text of the original sweep or, if it was null, the result of
applying the same expansion rules that apply to button 2 actions.
.PP
If the text names an existing window,
.I acme
moves the mouse cursor to the selected text in the body of that window.
If the text names an existing file with no associated window,
.I acme
loads the file into a new window and moves the mouse there.
If the text is a file name contained in double quotes,
.I acme
loads the indicated include file from the directory appropriate to the
suffix of the file name of the window holding the text.
(The
.B Incl
command adds directories to the standard list.)
.PP
If the text begins with a colon, it is taken to be an address
within the body of the window containing the text.
The address is evaluated, the resulting text highlighted, and the mouse moved to it.
Thus, in
.IR acme ,
one must type
.B :/regexp
or
.B :127
not just
.B /regexp
or
.BR 127 .
(There is an easier way to locate literal text; see below.)
.PP
If the text is a file name followed by a colon and an address,
.I acme
loads the file and evaluates the address.  For example, clicking button 3 anywhere
in the text
.B file.c:27
will open
.BR file.c ,
select line
27, and put the mouse at the beginning of the line.  The rules about Error
files, directories, and so on all combine to make this an efficient way to
investigate errors from compilers, etc.
.PP
If the text is not an address or file, it is taken to
be literal text, which is then searched for in the body of the window
in which button 3 was clicked.  If a match is found, it is selected and the mouse is
moved there.  Thus, to search for occurrences of a word in a file,
just click button 3 on the word.  Because of the rule of using the
selection as the button 3 action, subsequent clicks will find subsequent
occurrences without moving the mouse.
.PP
In all these actions, the mouse motion is not done if the text is a null string
within a non-null selected string in the tag, so that (for example) complex regular expressions
may be selected and applied repeatedly to the
body by just clicking button 3 over them.
.SS "Chords of mouse buttons
Several operations are bound to multiple-button actions.
After selecting text, with button 1 still down, pressing button 2
executes
.B Cut
and button 3 executes
.BR Paste .
After clicking one button, the other undoes
the first; thus (while holding down button 1) 2 followed by 3 is a
.B Snarf
that leaves the file undirtied;
3 followed by 2 is a no-op.
These actions also apply to text selected by double-clicking because
the double-click expansion is made when the second
click starts, not when it ends.
.PP
Thus to copy a word a number of times, double click on the word with button 1 to highlight it leaving
button 1 down, press and release button 2 to cut it and save it in the snarf buffer, press and 
release button 3 to paste it back and then release button 1. Now move the cursor to any selected
place in the text, press button 1 down, then button 3 and the word is copied in.
.PP
Similarly lines may be deleted by double clicking at the beginning or end of the line and then 
pressing button 2 with button 1 still down.
.PP
Commands may be given extra arguments by a mouse chord with buttons 2 and 1.
While holding down button 2 on text to be executed as a command, clicking button 1
appends the text last pointed to by button 1 as a distinct final argument.
For example, to search for literal
.B text
one may execute
.B Look text
with button 2 or instead point at
.B text
with button 1 in any window, release button 1,
then execute
.BR Look ,
clicking button 1 while 2 is held down.
.PP
When an external command (e.g.
.IR echo (1))
is executed this way, the extra argument is passed as expected and an
environment variable
.B $acmeaddr
is created that holds, in the form interpreted by button 3,
the fully-qualified address of the extra argument.
.SS "Support programs
.I win
creates a new
.I acme
window and runs a
.I command
(default
.BR /dis/sh.dis )
in it, turning the window into a shell window in which commands may be executed.
Executing text in a
.I win
window with button
2 is similar to using
.BR Send .
.PP
Similarly
.I winm
creates a new window but runs the shell
.BR /dis/mash.dis
by default.
.I adiff
behaves as diff in finding the difference between two files but the listing uses
filename:linenumber format to allow the user to simply click on this to be sent to that line
in the file.
.I agrep
does for grep what adiff does for diff above.
.I cd
changes directory but when used in a win window for example, sends information to the
window to display a new heading reflecting the new directory.
.SS "Mail"
In the directory 
.B /acme/mail
there are two mail programs that may be used under acme. These
.I Mail
and
.I Mailpop3
can be run to display the user's current mail, read the mail, reply to mail, save or delete mail,
send mail and write the user's mail box.
.PP
The former expects the user's mail box to be in the directory and file specified as its first argument,
the latter uses the POP3 protocol to connect to a server for the user's mail and will prompt for a 
password when first run. Otherwise their behaviour is the same.
.SS "Applications and guide files
In the directory
.B /acme
live several subdirectories, each corresponding to a program or
set of related programs that employ
.I acme's
user interface.
Each subdirectory includes dis files and a
.B readme
file for further information.
It also includes a
.BR guide ,
a text file holding sample commands to invoke the programs.
The idea is to find an example in the guide that best matches
the job at hand, edit it to suit, and execute it.
.PP
Whenever a command is executed by
.IR acme ,
the default search path includes the directory of the window containing
the command.
Also,
.I acme
binds the directory
.B /acme/dis
in front of
.B /dis
when it starts; this is where
.IR acme -specific
programs such as
.I win
reside.
.SH EDITING
This section explains the commands available when using acme's Edit command.
.PP
.SS Regular expressions
Regular expressions are as in
.IR regexp (6)
with the addition of
.BR \en
to represent newlines.
A regular expression may never contain a literal newline character.
The empty
regular expression stands for the last complete expression encountered.
A regular expression
matches the longest leftmost substring formally
matched by the expression.
Searching in the reverse direction is equivalent
to searching backwards with the catenation operations reversed in
the expression.
.SS Addresses
An address identifies a substring in a file.
In the following, `character
.IR n '
means the null string
after the
.IR n -th
character in the file, with 1 the
first character in the file.
`Line
.IR n '
means the
.IR n -th
match,
starting at the beginning of the file, of the regular expression
.LR .*\en? .
All files always have a current substring, called dot,
that is the default address.
.SS Simple Addresses
.PD0
.TP
.BI # n
The empty string after character
.IR n ;
.B #0
is the beginning of the file.
.TP
.I n
Line
.IR n ;
.B 0
is the beginning of the file.
.TP
.BI  / regexp /
.PD0
.TP
.BI ? regexp ?
The substring that matches the regular expression,
found by looking toward the end 
.RB ( / )
or beginning
.RB ( ? )
of the file,
and if necessary continuing the search from the other end to the
starting point of the search.
The matched substring may straddle
the starting point.
When entering a pattern containing a literal question mark
for a backward search, the question mark should be
specified as a member of a class.
.PD
.TP
.B 0
The string before the first full line.
This is not necessarily
the null string; see
.B +
and
.B -
below.
.TP
.B $
The null string at the end of the file.
.TP
.B .
Dot.
.TP
.B \&'
The mark in the file.
.TP
\fL"regexp"\fP
Preceding a simple address (default
.BR . ),
refers to the address evaluated in the unique file whose menu line
matches the regular expression.
.PD
.SS Compound Addresses
In the following,
.I a1
and
.I a2
are addresses.
.TF a1+a2
.TP
.IB a1 + a2
The address
.I a2
evaluated starting at the end of
.IR a1 .
.TP
.IB a1 - a2
The address
.I a2
evaluated looking in the reverse direction
starting at the beginning of
.IR a1 .
.TP
.IB a1 , a2
The substring from the beginning of
.I a1
to the end of
.IR a2 .
If
.I a1
is missing,
.B 0
is substituted.
If
.I a2
is missing,
.B $
is substituted.
.TP
.IB  a1 ; a2
Like
.IB a1 , a2\f1,
but with
.I a2
evaluated at the end of, and dot set to,
.IR a1 .
.PD
.PP
The operators
.B +
and
.B -
are high precedence, while
.B ,
and
.B ;
are low precedence.
.PP
In both
.B +
and
.B -
forms, if
.I a2
is a line or character address with a missing
number, the number defaults to 1.
If
.I a1
is missing,
.L .
is substituted.
If both
.I a1
and
.I a2
are present and distinguishable,
.B +
may be elided.
.I a2
may be a regular
expression; if it is delimited by
.LR ? 's,
the effect of the
.B +
or
.B -
is reversed.
.PP
It is an error for a compound address to represent a malformed substring.
Some useful idioms: 
.IB a1 +-
(\f2a1-+\fP)
selects the line containing
the end (beginning) of a1.
.BI 0/ regexp /
locates the first match of the expression in the file.
(The form
.B 0;//
sets dot unnecessarily.)
.BI ./ regexp /// 
finds the second following occurrence of the expression,
and
.BI .,/ regexp /
extends dot.
.SS Commands
In the following, text demarcated by slashes represents text delimited
by any printable
character except alphanumerics.
Any number of
trailing delimiters may be elided, with multiple elisions then representing
null strings, but the first delimiter must always
be present.
In any delimited text,
newline may not appear literally;
.B \en
may be typed for newline; and
.B \e/
quotes the delimiter, here 
.LR / .
Backslash is otherwise interpreted literally, except in
.B s
commands.
.PP
Most commands may be prefixed by an address to indicate their range
of operation.
Those that may not are marked with a 
.L *
below.
If a command takes
an address and none is supplied, dot is used.
The sole exception is
the
.B w
command, which defaults to
.BR 0,$ .
In the description, `range' is used
to represent whatever address is supplied.
Many commands set the
value of dot as a side effect.
If so, it is always set to the `result'
of the change: the empty string for a deletion, the new text for an
insertion, etc. (but see the
.B s
and
.B e
commands).
.br
.ne 1.2i
.SS Text commands
.PD0
.TP
.BI a/ text /
.TP
or
.TP
.B  a
.TP
.I lines of text
.TP
.B .
Insert the text into the file after the range.
Set dot.
.PD
.TP
.B c\fP
.br
.ns
.TP
.B i\fP
Same as
.BR a ,
but
.B c
replaces the text, while
.B i
inserts
.I before
the range.
.TP
.B d
Delete the text in the range.
Set dot.
.TP
.BI s/ regexp / text /
Substitute
.I text
for the first match to the regular expression in the range.
Set dot to the modified range.
In 
.I text
the character
.B &
stands for the string
that matched the expression. 
Backslash behaves as usual unless followed by
a digit:
.BI \e d
stands for the string that matched the
subexpression begun by the
.IR d -th
left parenthesis.
If
.I s
is followed immediately by a
number
.IR n ,
as in
.BR s2/x/y/ ,
the
.IR n -th
match in the range is substituted.
If the
command is followed by a
.BR g ,
as in
.BR s/x/y/g ,
all matches in the range
are substituted.
.TP
.BI m " a1
.br
.ns
.TP
.BI t " a1
Move
.RB ( m )
or copy
.RB ( t )
the range to after
.IR a1 .
Set dot.
.SS Display commands
.PD 0
.TP
.B p
Print the text in the range.
Set dot.
.TP
.B =
Print the file name and line address of the range.
.TP
.B =#
Print the file name and character address of the range.
.PD
.SS File commands
.PD0
.TP
.BI * " b " file-list
Set the current file to the first file named in the list
that
.I acme
has displayed.
The list may be expressed
.BI < "command"
in which case the file names are taken as words (in the shell sense)
generated by the command.
.TP
.BI * " B " file-list
Same as
.BR b ,
except that file names not displayed are entered there,
and all file names in the list are examined.
.TP
.BI * " D " file-list
Delete the named files from the menu.
If no files are named, the current file is deleted.
It is an error to
.B D
a modified file, but a subsequent
.B D
will delete such a file.
.PD
.SS I/O Commands
.PD0
.TP
.BI * " e " filename
Replace the file by the contents of the named external file.
Set dot to the beginning of the file.
.TP
.BI r " filename
Replace the text in the range by the contents of the named external file.
Set dot.
.TP
.BI w " filename
Write the range (default
.BR 0,$ )
to the named external file.
.TP
.BI * " f " filename
Set the file name and print the resulting menu entry.
.PP
If the file name is absent from any of these, the current file name is used.
.B e
always sets the file name;
.B r
and
.B w
do so if the file has no name.
.TP
.BI < " command
Replace the range by the standard output of the command.
.TP
.BI > " command
Send the range to the standard input of the command.
.TP
.BI | " command
Send the range to the standard input, and replace it by
the standard output, of the command.
.TP
.BI * " cd " directory
Change working directory.
If no directory is specified,
.B $home
is used.
.PD
.PP
In any of
.BR < ,
.BR > ,
or
.BR | ,
if the
.I command
is omitted the last
.I command
(of any type) is substituted.
.SS Loops and Conditionals
.PD0
.TP
.BI x/ regexp / " command
For each match of the regular expression in the range, run the command
with dot set to the match.
Set dot to the last match.
If the regular
expression and its slashes are omitted, 
.L /.*\en/
is assumed.
Null string matches potentially occur before every character
of the range and at the end of the range.
.TP
.BI y/ regexp / " command
Like
.BR x ,
but run the command for each substring that lies before, between,
or after
the matches that would be generated by
.BR x .
There is no default regular expression.
Null substrings potentially occur before every character
in the range.
.TP
.BI * " X/ regexp / " command
For each file whose menu entry matches the regular expression,
make that the current file and
run the command.
If the expression is omitted, the command is run
in every file.
.TP
.BI * " Y/ regexp / " command
Same as
.BR X ,
but for files that do not match the regular expression,
and the expression is required.
.TP
.BI g/ regexp / " command
.br
.ns
.TP
.BI v/ regexp / " command
If the range contains
.RB ( g )
or does not contain
.RB ( v )
a match for the expression,
set dot to the range and run the command.
.PP
These may be nested arbitrarily deeply, but only one instance of either
.B X
or
.B Y
may appear in a \%single command.
An empty command in an
.B x
or
.B y
defaults to
.BR p ;
an empty command in
.B X
or
.B Y
defaults to
.BR f .
.B g
and
.B v
do not have defaults.
.PD
.SS Miscellany
.TF (empty)
.TP
.BI * " u " n
Undo the last
.I n
(default 1)
top-level commands that changed the contents or name of the
current file, and any other file whose most recent change was simultaneous
with the current file's change.
Successive
.BR u 's
move further back in time.
The only commands for which u is ineffective are
.BR cd ,
.BR u ,
.B w
and
.BR D .
If
.I n
is negative,
.B u
`redoes,' undoing the undo, going forwards in time again.
.TP
(empty)
If the range is explicit, set dot to the range.
If no address is specified (the
command is a newline) dot is extended in either direction to
line boundaries and printed.
If dot is thereby unchanged, it is set to
.B .+1 
and printed.
.PD
.SS Grouping and multiple changes
Commands may be grouped by enclosing them in braces
.BR {} .
Commands within the braces must appear on separate lines (no backslashes are
required between commands).
Semantically, an opening brace is like a command:
it takes an (optional) address and sets dot for each sub-command.
Commands within the braces are executed sequentially, but changes made
by one command are not visible to other commands (see the next
paragraph).
Braces may be nested arbitrarily.
.PP
When a command makes a number of changes to a file, as in
.BR x/re/c/text/ ,
the addresses of all changes to the file are computed in the original file.
If the changes are in sequence,
they are applied to the file.
Successive insertions at the same address are catenated into a single
insertion composed of the several insertions in the order applied.
.SH FILES
.TF /appl/acme/acme/*/src
.TP
.B $home/acme.dump
default file for
.B Dump
and
.BR Load ;
also where state is written if
.I acme
dies unexpectedly.
.TP
.B /acme/*/guide
template files for applications
.TP
.B /acme/*/readme
informal documentation for applications
.TP
.B /appl/acme/acme/*/src
source for applications
.TP
.B /acme/dis
dis files for applications
.SH SOURCE
.B /appl/acme
.br
.B /appl/acme/acme/bin/src/win.b
.SH SEE ALSO
.IR acme (4)
.br
Rob Pike,
.IR "Acme: A User Interface for Programmers" ", Volume 2"
.SH BUGS
With the
.B -l
option or
.B Load
command,
the recreation of windows under control of external programs
such as
.I win
is just to rerun the command; information may be lost.