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
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
|
\magnification=\magstep1
\raggedbottom
% Produce verbatim listings of various sorts
\def\uncatcodespecials{\def\do##1{\catcode`##1=12 } \dospecials}
\font\TT=cmtt9
\def\setupverbatim{%
\par \TT \spaceskip=0pt % Make sure we get fixed tt spacing
\obeylines\uncatcodespecials\obeyspaces\verbatimdefs
}
% This macro turns on verbatim mode until ?endverbatim is seen.
\def\verbatim{\begingroup \setupverbatim
\parskip=0pt plus .05\baselineskip \parindent=0pt
\catcode`\ =13 \catcode`\^^M=13 \catcode`\?=0
\verbatimgobble}
{\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }}
\gdef\verbatimgobble#1^^M{}}
% This defines ?endverbatim to end the group which begins with \verbatim
\let\endverbatim=\endgroup
% Input a file in verbatim mode. Sometimes useful for including
% real-life examples into a paper.
\def\verbfile#1{\begingroup\setupverbatim
\parskip=0pt plus .05\baselineskip \parindent=0pt
\input#1 \endgroup
}
\def\BIND#1#2{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
\hbox{\strut\kern2pt{\tt ESC C-#1 C-#2}\kern2pt}}
\hrule}\vrule}} % used to have a \kern2pt between the last }'s
\def\Bind#1#2{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
\hbox{\strut\kern2pt{\tt C-#1 C-#2}\kern2pt}}
\hrule}\vrule}}
\def\Web{{\tt WEB}}
\def\BS{\tt\char'134}
\def\Command#1#2#3#4{$$\line{{\hskip\parindent\tt #1}\hfil
\ifnum #4>2
\BIND{#2}{#3}%
\else
\ifnum #4=1
\Bind{#2}{#3}%
\else
\fi
\fi
}
$$%
}
\abovedisplayskip=\smallskipamount
\belowdisplayskip=\smallskipamount
\parskip=10pt plus2pt minus2pt
\overfullrule=0sp
\font\logofont=logo10
\def\MF{{\logofont META}\-{\logofont FONT}}
\font\ninerm=cmr9
\let\mc=\ninerm % medium caps for names like UNIX
\def\Unix{{\mc UNIX}} \let\unix=\Unix
\font\BF=cmbx10 scaled \magstep2
\font\Bf=cmbx10 scaled \magstep1
\font\SS=cmss10
\font\Tt=cmtt10 scaled \magstep1
\null\vskip3pc
\centerline{\BF A User's Manual for}
\medskip
\centerline{\BF GNU Emacs' WEB-MODE}
\bigskip
\centerline{\Bf Mark Motl}
\centerline{\bf Department of Computer Science}
\centerline{\bf \TeX{}as A\&M University}
\centerline{\tt motl@cs.tamu.edu}
\bigskip
This document is a companion to {\tt web-mode.el}, a collection of GNU
Emacs Lisp functions designed to customize GNU Emacs so that it is
sensitive to a \Web\ document. Appendix A is a complete list of the
functions.
You should receive two files: {\tt web-mode.el \rm and \tt
limbo.material}. The first is the source {\tt web-mode.el}\null. The
second is statements that commonly appear in the limbo portion of a
\Web. This `limbo' code is borrowed from some of Knuth's \Web{}s.
Throughout this document, I will use the symbology used by Emacs. For
example, the {\tt find-file} command can be entered two different ways
\Command{M-x find-file}{x}{f}{1}
The first way of entering the command is to actually type the command as
shown above. Press the {\tt META} key (on some terminals this may be the
{\tt ESC} key); next press the {\tt x} key; finally, enter the
characters {\tt find-file} followed by a carriage return. An alternate
way of issuing this command is to use its associated keybinding as shown
in the box to the right of the command above. In this keybinding {\tt
C-} refers to the {\tt CTRL} key. Press and hold down the {\tt CTRL} key
and then press the {\tt x} key followed by holding down the {\tt CTRL}
key and then pressing the {\tt f} key. For all commands mentioned
throughout this manual, both forms of invoking the command will be shown
if they exist. Some commands, such as
\Command{M-x what-line}{}{}{0}
do not have a keybinding and hence must be entered by typing in the
command name. All commands that are \Web{} extensions have been prefixed
with ``{\tt web-}''.
I strongly encourage all users of {\tt web-mode.el} to {\it
byte-compile\/} it. The byte-compiled code runs considerably faster
than interpreted code. To byte-compile {\tt web-mode.el}, start GNU
Emacs. Issue the command
\Command{M-x byte-compile-file}{}{}{0}
The user will be prompted for the name of the file. Respond with {\tt
web-mode.el}\null. This will create a new file named {\tt
web-mode.elc}\null.
\vfil\eject
To get {\tt web-mode} automatically loaded, add the following
lines of code to the file that configures your Emacs. This file is
usually ``{\tt .emacs}'' on \Unix{} systems.
\vskip\smallskipamount
\verbatim
(setq auto-mode-alist (cons '("\\.web\$" . web-mode) auto-mode-alist))
(autoload 'web-mode "web-mode.elc" "Major mode for editing WEB-based documents" t)
?endverbatim
\noindent You can also enter {\tt web-mode} manually by loading the
file that contains the {\tt web-mode} functions and then invoking the
function {\tt web-mode}\null. The commands to do this are:
$$\leftline{\hskip\parindent\tt M-x load-file\quad
{\it Respond with\/} {\tt web-mode.el} {\it or\/} {\tt web-mode.elc}\hfil}$$
and
\Command{M-x web-mode}{}{}{0}
{\null\vfill
\centerline{{\bf NOTICE}}
The rest of this document will assume that either of the above means which
invoke {\tt web-mode} has been executed.
\null\vfill
\centerline{{\bf CAVEAT}}
Some of these functions may seem to be trivial and slow at first. We
believe they will pay big dividends for larger \Web{}s.
}
\vfill\eject
\leftline{\Bf Getting Started}
{\tt Web-mode} assists in creating and/or editing \Web{}s.
\bigskip
\leftline{\SS Creating a New \Web}
If a \Web\ is being created, Emacs will need to be started with an empty
file. For example, if the name of the new \Web\ is {\tt my.web}, you
would probably enter the \Unix\ command
\Command{\% emacs my.web}{}{}{0}
The function {\tt web-mode} (see NOTICE on previous page) will prompt
the user for the name of the file that contains the limbo portion of the
\Web\null. To accept the default file ({\tt limbo.material}), the user
need only press the return key. If, on the other hand, the user wishes
to enter the name of another file, that can be done by answering with
another file name. If the default is selected, the contents of the file
{\tt limbo.material} are inserted and the user is asked to enter a title
for the \Web\null.
\bigskip
\leftline{\SS Editing a \Web}
If you wish to use {\tt web-mode} on an existing \Web, say {\tt
primes.web}, you would begin by invoking Emacs with the \Unix\ command
\Command{\% emacs primes.web}{}{}{0}
When the function {\tt web-mode} is executed, it will perform some
initialization of various data structures. A list of the module names
is collected. If {\tt web-mode} detects that a module name has been used
but never defined, a ``stub'' module is inserted at the {\bf end of the
major section} in which it was first used. The form of the stub module
is:
{\vskip2pt\parskip0sp\tt\obeylines\def\SP{{\tt\char`\ }}
@\SP
@\char`\^ Stub@\char`>
@\char`< Name of undefined module@\char`>=
}
%
{\tt Web-mode} also reads in the {\tt CHange} file that accompanies the
\Web\ currently being edited. If there is no {\tt CHange} file, one is
created; however, this file is ``saved'' only if it is modified.
%
\vfill\eject
%
\leftline{\Bf Movement Within The \Tt{WEB}}
\bigskip
Several commands facilitate movement within the \Web\ document. The user
can switch to the buffer containing the {\tt CHange} file by issuing the
command
\Command{M-x web-change-file}{c}{f}{3}
Similarly, the user can switch to the buffer containing the \Web{} file
at any time with the command
\Command{M-x web-file}{w}{f}{3}
If the \Web{} being edited is a {\tt CWEB}, the user can switch to any
of the include files with the command
\Command{M-x web-include-file}{i}{f}{3}
This command takes a numeric argument. For example, giving the function
an argument of 1 would cause the buffer containing the contents of the
first include file command ({\tt @i}) encountered in the {\tt CWEB} to
become the current buffer.
The user can {\tt goto} any module or section at any time by issuing
either
\Command{M-x web-goto-module}{g}{m}{6}
or
\Command{M-x web-goto-section}{g}{s}{6}
respectively. The user is then prompted for the module or section
number. If a nonpositive number or a number greater than the number of
modules or sections in the \Web\ is entered, an appropriate error
message is displayed in the minibuffer. If a valid module or section
number is entered, point moves to the beginning of that module or
section in the \Web\null. The command can also be entered with a numeric
argument which represents the destination module or section number. For
example, if the user wants to {\tt goto} module 163, the command could
be entered as
$$\line{\hskip\parindent\tt C-u 163 M-x web-goto-module\hfil
{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
\hbox{\strut\kern2pt{\tt C-u 163 ESC C-g C-m}\kern2pt}}
\hrule}\vrule}}}%
$$
If the destination module has been changed, a message is printed in the
minibuffer stating that the destination module has been changed.
The user can also {\tt goto} the next or previous module by entering
either
\Command{M-x web-next-module}{n}{m}{3}
or
\Command{M-x web-previous-module}{p}{m}{6}
respectively. If there is no next or previous module, an appropriate
message is displayed in the minibuffer; otherwise, point moves to the
beginning of the next or previous module, whichever is appropriate.
The user can also {\tt goto} the next or previous major section in the
\Web\ document by entering either
\Command{M-x web-next-section}{n}{s}{3}
or
\Command{M-x web-previous-section}{p}{s}{6}
respectively. If there is no next or previous section, an appropriate
message is displayed in the minibuffer; otherwise, point moves to the
beginning of the next or previous section, whichever is appropriate. It
should be noted that these commands move point to the beginning of the
next or previous section and not to the beginning of the current
section.
The user can determine the exact module number and major section point
is positioned in at any time with the commands
\Command{M-x web-what-module}{w}{m}{3}
and
\Command{M-x web-what-section}{w}{s}{3}
respectively.
If you are already an experienced \Web er, you might want to ask about
the {\tt change} file. Please wait until you've read that section.
%
\vfill\eject
%
\leftline{\Bf Inserting A Module Name}
\bigskip
Whenever the {\tt \char`<} key is pressed in the buffer containing the
\Web\ document, the function {\tt web-insert-module-name} is invoked. This
function must determine whether this is the beginning of a module name
or not. The function examines the preceding characters. If an odd
number of {\tt @}'s precede the {\tt \char`<}, then it is the
beginning of a module name and the function {\tt
web-options-for-module-name-insertion} is automatically invoked;
otherwise, the {\tt \char`<} is inserted and the user can continue
typing.
If the function determines that it is the beginning of a module name,
the user is switched to another buffer with the following options:
{\parskip=0sp\tt
\itemitem{A.} Abort
\itemitem{C.} Create New Module Name
\itemitem{L.} List All Modules Beginning with Letter
\itemitem{N.} Next Screen
\itemitem{P.} Previous Screen
\itemitem{S.} Select Existing Module Name\par }
\noindent The user must then select one of the above options. A sample
screen is shown in Figure~1. The \Web\ used for the figures is {\tt
primes.web} contained in [1]\null.
\verbatim
Option Action
------ -------------------------------------------
A Abort
C Create a New Module Name
L List all Module Names Beginning with Letter
N Next Screen
P Previous Screen
S Select Existing Module Name
-------------------------------------------------------------------------------
Number Name
1 Fill table |p| with the first |m| prime numbers
2 Give to |j_prime| the meaning: |j|~is a prime number
3 If |p[n]| is a factor of~|j|, set |j_prime:=false|
4 Increase |j| until it is the next prime number
5 Initialize the data structures
6 Other constants of the program
7 Output a line of answers
8 Output a page of answers
9 Print table |p|
10 Print the first |m| prime numbers
11 Program to print the first thousand prime numbers
Displaying 11 Module Names of 14
--**-Emacs: *Module Names* (Web)----All---------------------------------
?endverbatim
\medskip
\centerline{{\bf Figure 1.}}
{\parskip4pt plus2pt minus1pt
\item{{\tt A.}} If this option is selected, the user is switched back
to the buffer containing the \Web\ document and the two characters
preceding point ({\tt @\char`<}) are deleted.
The remaining options involve the list of module names. The
module names are displayed below the menu choices. The module names
are displayed in alphabetical order and are retrieved from the list
that was created when {\tt web-mode} was invoked at the beginning of
the editing session. The module names are displayed with a number to
their left. The modules are numbered sequentially beginning with
1\null.
\item{{\tt C.}} If the option is chosen, the user is prompted for the
name of the new module. Once entered, the user is switched back to the
buffer containing the \Web\ document, the new module name is inserted,
and the ending module delimiter (either {\tt @\char`>\ \rm or \tt
@\char`> =}) is determined automatically and inserted. A check against
the existing module names is conducted to ensure that the entered
module name is indeed new. If the module name is new, a determination
of whether a stub module needs to be appended is made and the new
module name is added to the list of module names.
\item{{\tt L.}} This causes all module names that begin with a
particular letter to be displayed. The user is prompted for the letter.
If no module names begin with the desired letter, an appropriate
message is displayed in the minibuffer.
\item{{\tt N.}} This causes the next screen of module names to be
displayed. For example, if the screen is capable of displaying 21
module names and currently module names 1 through 21 are displayed,
choosing {\tt N} would cause module names 22 through 42 to be
displayed.
\item{{\tt P.}} This causes the previous screen of module names to be
displayed. For example, if the screen is capable of displaying 21
module names and currently module names 30 through 50 are displayed,
choosing {\tt P} would cause module names 9 through 29 to be
displayed.
\item{{\tt S.}} This option asks the user to enter the number
associated with the module name that he wishes to insert in the \Web\
document. The ending module name delimiter (either {\tt @\char`>\ \rm
or \tt @\char`> =}) is determined automatically and inserted.\par}
\vfil
{\it This might seem like a severe interruption of the coding
process. However, getting the ``named modules'' spelled and spaced
correctly is critical.}
\vfil
\eject
%
\leftline{\BF Viewing the Index, Module Names, and}
\leftline{\BF Section Names}
\bigskip
{\tt Web-mode} allows a programmer to view the index as created by
{\tt WEAVE}\null. A user can also display the list of module names
that is maintained by {\tt web-mode}\null. It is also possible to
view the names of the major sections of the \Web{} and the module
number where each major section begins.
\bigskip
\leftline{\SS Viewing the Index}
The user can view the contents of the index created by {\tt WEAVE} by
issuing the command
\Command{M-x web-view-index}{v}{i}{3}
The user is first asked whether the \Web\ is a Pascal or C \Web\null.
After the language has been determined, the function creates an
asynchronous process which invokes the {\tt WEAVE} processor on the
\Web\ in the current buffer. At Texas A\&M we have modified {\tt WEAVE}
so that it writes the index to the file {\tt INDEX.tex} and the list of
module names to the file {\tt MODULE\_NAMES.tex}\null. (The changes that
must be made to {\tt WEAVE} to accomplish this are contained in Appendix
C.)\ \ Once this process has completed, the contents of {\tt INDEX.tex}
are inserted into another buffer. Some reformatting is done for a better
presentation. The user can traverse the list of module numbers for a
particular index entry by positioning the cursor anywhere on the line(s)
where the index entry of interest is located and issuing the command
\Command{M-x web-next-index}{n}{i}{3}
or
\Command{M-x web-previous-index}{p}{i}{6}
These commands can be issued from the buffer where the index is
displayed or they can be issued from the buffer that contains the \Web\
document. If the commands are issued from the former, the user is
switched back to the buffer that contains the \Web\ document, and point
is positioned at the beginning of the module where the most recently
selected index entry was next or previously referenced from point's
current position.
Once the user is back in the buffer that contains the \Web\ document,
the list of modules associated with the most recently selected index
entry can be traversed with the commands
\Command{M-x web-next-index}{n}{i}{3}
and
\Command{M-x web-previous-index}{p}{i}{6}
These commands work as expected and print an error message if the user
attempts to run off of either end of the list. A portion of the index
created for Knuth's {\tt primes.web} is shown in Figure~2\null.
\midinsert
\verbatim
Bertrand, Joseph, postulate: 21.
boolean: 15.
c: 7.
cc: 5, 7, 8, 10.
Dijkstra, Edsger: 1, 15.
Eratosthenes, sieve of: 24.
false: 13, 26.
integer: 4, 7, 12, 17, 24.
j: 12.
j\_prime: 13, 14, 15, 22, 26.
k: 12.
Knuth, Donald E.: 15.
m: 2.
mult: 24, 25, 26.
n: 23.
new\_line: 6*, 9, 10.
new\_page: 6*, 9.
ord: 17, 18, 19, 20, 21, 22, 23, 24, 25.
ord\_max: 17, 19, 23, 24.
output: 2, 6*.
output format: 5, 9.
p: 4.
--**-Emacs: *INDEX for primes.web* (Web)----Top-----------------------------
?endverbatim
\medskip
\centerline{{\bf Figure 2.}}
\endinsert
***{\bf Important}***\ \ It may be necessary for the {\tt web-view-index}
source to be changed if the {\tt WEAVE} processor for Pascal \Web s is
called something other than ``{\tt weave}'' or the {\tt WEAVE}
processor for C \Web s is called something other than ``{\tt cweave}''
on your computer system. The {\tt web-view-index} has calls to the Emacs'
function {\tt call-process}\null. The first argument to this function
is the name of the program that is to be run as a separate process. If
the program names of the {\tt WEAVE} processors differ on your system,
these lines will need to be changed accordingly in the function {\tt
web-view-index}\null.
\bigskip
\leftline{\SS Viewing the Module Names}
The user can also view the contents of the list of module names that
is maintained by {\tt web-mode}\null. When the command
\Command{M-x web-view-module-names-list}{v}{m}{3}
is issued, the list is displayed in another buffer. Some reformatting
is necessary. The user is free to peruse the list as much as he likes.
The results of issuing this command on Knuth's {\tt primes.web} is shown
in Figure~3\null.
\midinsert
\verbatim
Fill table |p| with the first |m| prime numbers (11) (3)
Give to |j_prime| the meaning: |j|~is a prime number (22) (14)
If |p[n]| is a factor of~|j|, set |j_prime:=false| (26) (22)
Increase |j| until it is the next prime number (14) (11)
Initialize the data structures (16 18) (11)
Other constants of the program (5 19) (2)
Output a line of answers (10) (9)
Output a page of answers (9) (8)
Print table |p| (8) (3)
Print the first |m| prime numbers (3) (2)
Program to print the first thousand prime numbers (2) (1)
Update variables that depend on~|j| (20) (14)
Update variables that depend on~|ord| (21 25) (20)
Variables of the program (4 7 12 15 17 23 24) (2)
--**-Emacs: *Module Name (Defined In) (Used In)* (Web)--All------------------
?endverbatim
\medskip
\centerline{{\bf Figure 3.}}
\endinsert
The commands
\Command{M-x web-next-define}{n}{d}{3}
\Command{M-x web-next-use}{n}{u}{3}
\Command{M-x web-previous-define}{p}{d}{6}
and
\Command{M-x web-previous-use}{p}{u}{6}
can be invoked from the buffer where the module names are displayed or
they can be invoked from the buffer containing the \Web\ document. If
they are invoked from the former, the user selects a module name by
positioning the cursor anywhere on the line(s) where the module name of
interest is located. Once a module name has been selected, the user is
switched back to the buffer containing the \Web\ document at the module
where the most recently selected module name was next/previously defined
or used, whichever is appropriate, from point's current position.
While in the \Web{} document, the ``Defined In'' and ``Used In'' lists
can be traversed with the commands
\Command{M-x web-next-define}{n}{d}{3}
which positions point at the beginning of the module where the most
recently selected module name was next defined,
\Command{M-x web-previous-define}{p}{d}{6}
which positions point at the beginning of the module where the most
recently selected module name was previously defined,
\Command{M-x web-next-use}{n}{u}{3}
which positions point at the beginning of the module where the most
recently selected module name was next used, and
\Command{M-x web-previous-use}{p}{u}{6}
which positions point at the beginning of the module where the most
recently selected module name was previously used.
It should be noted that these commands prevent the user from running
off either end of either list.
{\tt Web-mode} maintains a list of the form
$$\vbox{\tabskip0sp\halign{\hfil#&(``module-name-$#$''\quad%
(Defined In Modules)\quad(Used In Modules))\hfil\cr
(&1\cr &2\cr &\omit$\ldots$\hfil\cr &n\cr )\cr
}}
$$
This list is collected automatically by {\tt web-mode} as well as
maintained. If the user feels that this list is in error at any time
during an editing session, the list can be recollected with the
command
\Command{M-x web-collect-module-names}{}{}{0}
\vfil\eject
\leftline{\SS Viewing the Major Section Names}
The user can also view a list of the names of the major sections in
the \Web\ document and the module number where each major section
begins. The command
\Command{M-x web-view-section-names-list}{v}{s}{3}
collects the names of the major sections along with their module numbers
and displays them in another buffer. The user is switched over to this
buffer. The result of issuing this command on Knuth's {\tt primes.web}
is shown in Figure~4\null.
\midinsert
\verbatim
Module# Section Name
1 Printing primes: An example of \WEB
3 Plan of the program
5 The output phase
11 Generating the primes
22 The inner loop
27 Index
--**-Emacs: *Section Names* (Web)----All------------------------------------
?endverbatim
\medskip
\centerline{{\bf Figure 4.}}
\endinsert
\vfil\eject
\leftline{\Bf Support for Change Files}
\bigskip
{\tt Web-mode} also provides support for {\tt change} files. The
command
\Command{M-x web-view-changed-modules-list}{v}{c}{3}
can be invoked in either the buffer containing the \Web\ document or the
buffer containing the {\tt change} file. It displays a list of modules
that have been changed in a separate window.
The command
\Command{M-x web-edit-module}{e}{m}{3}
will insert the contents of the module that point is positioned in when
the command is invoked in the {\tt change} file in its proper position.
The entire module's contents are copied twice---once between {\tt @x @y}
and once between {\tt @y @z}. The user is positioned at the first line
after the {\tt @y}\null. This command is only available in the buffer
containing the \Web\ document.
The command
\Command{M-x web-what-change}{w}{c}{3}
can only be invoked in the buffer containing the {\tt change} file. This
function displays a descriptive message informing the user of what
module in the \Web\ the change that point is positioned in corresponds
to.
Movement within the {\tt change} file is accomplished with the commands:
\Command{M-x web-goto-change-corresponding-to-module}{g}{c}{6}
If a numeric argument is not provided, the user is prompted. Point is
positioned at the beginning of the change in the {\tt change} buffer
that corresponds to the module number given as an argument.
\Command{M-x web-next-change}{n}{c}{3}
This command positions point at the beginning of the next change in the
{\tt change} buffer.
\Command{M-x web-previous-change}{p}{c}{6}
This command positions point at the beginning of the previous change in
the {\tt change} buffer.
The command \Command{M-x web-count-changes}{c}{c}{3}
will display the number of modules that have been changed.
\vfil\eject
\leftline{\Bf Miscellaneous Functions}
\bigskip
The function
\Command{M-x web-count-modules}{c}{m}{3}
displays in the minibuffer the total number of modules in the \Web\
document that is currently being edited.
The function
\Command{M-x web-count-sections}{c}{s}{3}
displays in the minibuffer the total number of sections in the \Web\
document that is currently being edited.
The command
\Command{M-x web-delimiter-match-check}{d}{m}{3}
looks at the entire
\Web\ document module by module. It determines if the delimiters
surrounding module names, namely, {\tt@\char`<} and {\tt@\char`>}, are
matched. If the delimiters do not match properly, a descriptive message
is printed in a temporary buffer.
The function
\Command{M-x web-determine-characteristics}{d}{c}{3}
creates a table that shows the number of lines of commentary,
definition/format macros, and code in each module in the \Web\ document.
A message is displayed in the minibuffer indicating to the user which
module the function is currently working on. Once completed, the user is
switched to a buffer where the characteristics have been written. The
user is free to peruse this buffer using regular Emacs commands.
{\tt Web-mode} also makes it easier to enter index entries. When
the function
\Command{M-x web-insert-index-entry}{i}{i}{3}
is issued, the user is prompted for two things:
\null\vskip\baselineskip
{\parskip=0sp
\item{1.} The type of font to be used (Roman, typewriter, or
user-defined). This determines the opening delimiter to the index
entry (either {\tt @\char`\^\rm , \tt @\char`.\rm , or \tt @\char`:}) and
\item{2.} The text of the index entry.
}
\noindent The complete index entry is then placed on a new line.
\vfil\eject
The command
\Command{M-x web-rename-module}{r}{m}{3}
allows the user to rename a module. Point should be positioned on the
name that the user wishes to rename. The user is prompted for the new
name. The user is then given the option of renaming a single
occurrence, all occurrences, or is queried if each of the remaining
occurrences should be renamed.
There are several functions in {\tt web-mode} that are invoked
automatically whenever a particular key is pressed. These functions
include:
\Command{M-x web-is-this-a-new-module-beginning}{}{}{0}
which is invoked whenever the {\tt @} key is pressed. The function
checks to see if the {\tt @} is at the beginning of a line. If it is,
the next character is read. If this next character is either a space,
newline, tab, or asterisk, then the {\tt @} in combination with the next
character constitutes the beginning of a new module.
Another useful function that is invoked automatically is
\Command{M-x web-newline} {}{}{0}
which is invoked whenever the newline character is pressed. This
function positions point so that the next line has the same indentation
as the current line that is being terminated.
One keybinding that Emacs' users are familiar with has been rebound to
another function. The keybinding {\tt C-x C-c} has been bound to
the {\tt web-mode} function
\Command{M-x web-mode-save-buffers-kill-emacs}{x}{c}{1}
Before this function makes a call to Emacs' {\tt
save-buffers-kill-emacs}, it completes the journal file that is
maintained by {\tt web-mode}. This journal file keeps track of what file
is being edited, who is editing it, when the editing began, when the
editing stopped, and a count of the number of times each of {\tt
web-mode}'s interactive functions were used.
%
\vfil\eject
%
\leftline{\Bf A Final Note}
\bigskip
Any suggestions for enhancements, problems with the existing
functions, or criticisms can be submitted to
\item{$\bullet$} the author ({\tt motl@cs.tamu.edu}) or
\item{$\bullet$} Bart Childs ({\tt bart@cs.tamu.edu})\null.
%
\bigskip\null\vskip\baselineskip
%
\leftline{\Bf References}
\bigskip
{\parskip2pt plus1pt minus1pt
\raggedright
\item{1.} Donald E.~Knuth, ``Literate Programming,'' {\it The Computer
Journal}, vol.~27, no.~2, May\ 1984, pp.~97--111.
\item{2.} Bill Lewis, Dan LaLiberte, and the GNU Manual Group, {\it
The GNU Emacs Lisp Reference Manual}, Emacs Version 18 for \Unix\ Users,
Edition 1.01, Cambridge, MA: Free Software Foundation, Apr.~1990.
\item{3.} Richard Stallman, {\it GNU Emacs Manual}, Fifth Edition,
Version 18 for \Unix\ Users, Cambridge, MA: Free Software Foundation,
Oct.~1986.
%
\bigskip\null\vskip\baselineskip
%
\leftline{\Bf Supplementary Sources}
\bigskip\newcount\Itemno \Itemno=0
\def\Item#1\Enditem{\global\advance \Itemno by 1 \item{\the\Itemno.} #1}
\Item
{Adrian Avenarius and Siegfried Oppermann,
``FWEB: A Literate Programming System for Fortran8x,''
{\it SIGPLAN Notices,}
vol.~25, no.~1, Jan.~1990, pp.~52--58.
}
\Enditem
\Item
{Jon Bentley,
``Programming Pearls: Literate Programming,''
{\it Communications of the ACM},
vol.~29, no.~5, May~1986, pp.~364--369.
}
\Enditem
\Item
{Jon Bentley and David Gries,
``Programming Pearls: Abstract Data Types,''
{\it Communications of the ACM},
vol.~30, no.~4, Apr.~1987, pp.~284--290.
}
\Enditem
\Item
{Jon Bentley, Donald E.~Knuth, and Doug McIlroy,
``Programming Pearls: A Literate Program,''
{\it Communications of the ACM},
vol.~29, no.~6, Jun.~1986, pp.~471--483.
}
\Enditem
\Item
{Marcus E.~Brown,
``An Interactive Environment for Literate Programming,''
Ph.D.\ Dissertation, Dept.\ of Computer Science, Texas A\&M University,
College Station, TX, Aug.~1988.
}
\Enditem
\Item
{Marcus E.~Brown and Bart Childs,
``An Interactive Environment for Literate Programming,''
{\it Structured Programming}, vol.~11, no.~1, Jan.~1990, pp.~11--25.
}
\Enditem
\Item
{Peter J.~Denning,
``Announcing Literate Programming,''
{\it Communications of the ACM},
vol.~30, no.~7, Jul.~1987, p.~593.
}
\Enditem
\Item
{Klaus Guntermann and Joachim Schrod,
``\Web\ Adapted to C,''
{\it TUGboat},
vol.~7, no.~3, Oct.~1986, pp.~134--137.
}
\Enditem
\Item
{Eric Hamilton,
``Literate Programming: Expanding Generalized Regular Expressions,''
{\it Communications of the ACM},
vol.~31, no.~12, Dec.~1988, pp.~1376--1385.
}
\Enditem
\Item
{David R.~Hanson,
``Literate Programming: Printing Common Words,''
{\it Communications of the ACM},
vol.~30, no.~7, Jul.~1987, pp.~594--599.
}
\Enditem
\Item
{Michael A.~Jackson,
``Literate Programming: Processing Transactions,''
{\it Communications of the ACM},
vol.~30, no.~12, Dec.~1987, pp.~1000--1010.
}
\Enditem
\Item
{Donald E.~Knuth,
{\it \MF: The Program},
vol.~D of {\it Computers \& Typesetting},
Reading, MA: Addison-Wesley Publishing Co.,
1986.
}
\Enditem
\Item
{Donald E.~Knuth,
{\it \TeX: The Program},
vol.~B of {\it Computers \& Typesetting},
Reading, MA: Addison-Wesley Publishing Co.,
1986.
}
\Enditem
\Item
{Donald E.~Knuth,
``The \Web\ System of Structured Documentation,''
Stanford Computer Science Report STAN-CS-980,
Dept.\ of Computer Science,
Stanford University, Stanford, CA,
Sep.~1983.
}
\Enditem
\Item
{John A.~Krommes,
``The \Web{} System of Structured Software Design and Documentation for
Fortran, Ratfor, and C,''
Technical Report, Princeton University, Princeton, NJ,
Nov.~1989. Available by anonymous {\tt ftp} from
{\tt ss01.pppl.gov} in directory {\tt/pub/fweb}.
}
\Enditem
\Item
{Silvio Levy,
``\Web\ Adapted to C, Another Approach,''
{\it TUGboat},
vol.~8, no.~1,
\hfil\break
Apr.~1987, pp.~12--13.
}
\Enditem
\Item
{Donald C.~Lindsay,
``Literate Programming: A File Difference Program,''
{\it Communications of the ACM},
vol.~32, no.~6, Jun.~1989, pp.~740--752.
}
\Enditem
\Item
{Charles Lins,
``A First Look at Literate Programming,''
{\it Structured Programming},
vol.~10, no.~1, 1989, pp.~60--62.
}
\Enditem
\Item
{Charles Lins,
``An Introduction to Literate Programming,''
{\it Structured Programming},
vol.~10, no.~2, 1989, pp.~107--112.
}
\Enditem
\Item
{Norman Ramsey,
``Literate Programming: Weaving a Language-Independent \Web,''
{\it Communications of the ACM},
vol.~32, no.~9, Sep.~1989, pp.~1051--1055.
}
\Enditem
\Item
{E.~W.~Sewell,
``How to\/ {\tt MANGLE} Your Software: The\/ \Web\ System for
Modula-2,''
\hfil\break
{\it TUGboat},
vol.~8, no.~2, Jul.~1987, pp.~118--122.
}
\Enditem
\Item
{E.~W.~Sewell,
{\it Weaving a Program: Literate Programming in WEB},
New York, NY: Van Nostrand Reinhold, 1989.
}
\Enditem
\Item
{Richard M.~Stallman,
``EMACS: The Extensible, Customizable, Self-Doc\-u\-men\-ting Display
Editor,''
in {\it Interactive Programming Environments},
David R.~Barstow,
\hfil\break
Howard E.~Shroke, and Erik Sandewall, Eds.,
New York, NY: McGraw-Hill Book Co., 1984, pp.~300--325.
}
\Enditem
\Item
{Harold~Thimbleby,
``Experiences of `Literate Programming' using {\tt cweb} (a variant
of Knuth's \Web),''
{\it The Computer Journal},
vol.~29, no.~3, Jun.~1986, pp.~201--211.
}
\Enditem
\Item
{Sho-Huan Tung,
``A Structured Method for Literate Programming,''
{\it Structured Programming},
vol.~10, no.~2, 1989, pp.~113--120.
}
\Enditem
\Item
{Christopher J.~Van Wyk,
``Literate Programming: An Assessment,''
{\it Communications of the ACM},
vol.~33, no.~3, Mar.~1990, pp.~361 and 365.
}
\Enditem
}% end reduced parskip for references.
\vfil\eject
%
\centerline{\BF Glossary}
\bigskip
{\bf buffer} --- A buffer is the basic editing unit. In Emacs, a user can
have many buffers, however, only one can be edited at any one time.
{\bf change file} --- This file contains information that is used to
override portions of the \Web{} file. Each ``change'' consists of
repeating the lines from the \Web{} file that require modification and
the new lines that are to replace the old ones. The {\tt TANGLE} and
{\tt WEAVE} processors have the ability to scan both the \Web{} and
change files so that the new lines replace the old lines at the
appropriate places in the resulting high-level language and \TeX{} codes.
{\bf major section} --- A major section is a ``starred'' module; that is,
it is a module that begins with the symbols `{\tt@*}'.
{\bf minibuffer} --- The bottom line of the screen when using Emacs.
This area is used to display arguments to commands, commands that are
typed in from the keyboard, and messages to the user. For commands that
require arguments, the minibuffer area can be used for prompting as well.
{\bf module} --- A module begins with the pair of symbols `{\tt@*}',
`{\tt@\char`<}', `{\tt@\BS t}', `{\tt@\BS n}', or `{\tt@\char`\ }'. A
module ends when the next module begins or the end of the file, whichever
comes first.
{\bf numeric argument} --- A number which is specified before a command
to alter the effect of the command.
{\bf section} --- A section is the same as a major section.
{\bf web file} --- contains the source of the \Web\null. The file
consists of the limbo portion and the individual units that comprise the
\Web{} called modules. A module consists of a commentary, definition, and
code parts, any two of which can be empty.
\vfil\eject
\centerline{\BF Appendix A}
% SLIDES can be prepared using TeX without resorting to SliTeX.
% SliTeX is an excellent way to do many things that will not show
% in this macro package.
%
% To use this you should start off with:
% \magnification=\magstep5 or 6. Try it and pick one.
% Look at the other parameters in the slides.tex sample.
% Now tex away!
%
% The following is taken from the first 120 lines of MANMAC.TeX.
% A few lines have been deleted.
% This is MANMAC.TEX in text format, as of Mar 31, 1986.
% Macros for The TeXbook
\catcode`@=11 % borrow the private macros of PLAIN (with care)
\font\tentex=cmtex10
\font\ninerm=cmr9
\font\eightrm=cmr8
\font\sixrm=cmr6
\font\ninei=cmmi9
\font\eighti=cmmi8
\font\sixi=cmmi6
\skewchar\ninei='177 \skewchar\eighti='177 \skewchar\sixi='177
\font\ninesy=cmsy9
\font\eightsy=cmsy8
\font\sixsy=cmsy6
\skewchar\ninesy='60 \skewchar\eightsy='60 \skewchar\sixsy='60
\font\ninebf=cmbx9
\font\eightbf=cmbx8
\font\sixbf=cmbx6
\font\ninett=cmtt9
\font\eighttt=cmtt8
\hyphenchar\tentt=-1 % inhibit hyphenation in typewriter type
\hyphenchar\ninett=-1
\hyphenchar\eighttt=-1
\font\ninesl=cmsl9
\font\eightsl=cmsl8
\font\nineit=cmti9
\font\eightit=cmti8
\newfam\ssfam
\font\tenss=lcmss8 scaled 1440
\font\niness=lcmss8 scaled 1200
\font\eightss=lcmss8
\newskip\ttglue
\def\X {\def\rm{\fam0\tenrm}% look at tenpoint in the TeXbook
\textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
\textfont1=\teni \scriptfont1=\seveni \scriptscriptfont1=\fivei
\textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\def\it{\fam\itfam\tenit}%
\textfont\itfam=\tenit
\def\sl{\fam\slfam\tensl}%
\textfont\slfam=\tensl
\def\bf{\fam\bffam\tenbf}%
\textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
\scriptscriptfont\bffam=\fivebf
\def\tt{\fam\ttfam\tentt\raggedright}%
\textfont\ttfam=\tentt
\tt \ttglue=.5em plus.25em minus.15em
\def\SS{\fam\ssfam\tenss}%
\textfont\ssfam=\tenss
\normalbaselineskip=12pt
\setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}%
\normalbaselines \parskip=\normalbaselineskip \rm}
\def\IX {\def\rm{\fam0\ninerm}% look at ninepoint in the TeXbook
\textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
\textfont1=\ninei \scriptfont1=\sixi \scriptscriptfont1=\fivei
\textfont2=\ninesy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\def\it{\fam\itfam\nineit}%
\textfont\itfam=\nineit
\def\sl{\fam\slfam\ninesl}%
\textfont\slfam=\ninesl
\def\bf{\fam\bffam\ninebf}%
\textfont\bffam=\ninebf \scriptfont\bffam=\sixbf
\scriptscriptfont\bffam=\fivebf
\def\tt{\fam\ttfam\ninett\raggedright}%
\textfont\ttfam=\ninett
\tt \ttglue=.5em plus.25em minus.15em
\def\SS{\fam\ssfam\niness}%
\textfont\ssfam=\niness
\normalbaselineskip=11pt
\setbox\strutbox=\hbox{\vrule height8pt depth3pt width\z@}%
\normalbaselines \parskip=\normalbaselineskip \rm}
\def\VIII {\def\rm{\fam0\eightrm}% look at eightpoint in the TeXbook
\textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
\textfont1=\eighti \scriptfont1=\sixi \scriptscriptfont1=\fivei
\textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy
\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
\def\it{\fam\itfam\eightit}%
\textfont\itfam=\eightit
\def\sl{\fam\slfam\eightsl}%
\textfont\slfam=\eightsl
\def\bf{\fam\bffam\eightbf}%
\textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
\scriptscriptfont\bffam=\fivebf
\def\tt{\fam\ttfam\eighttt\raggedright}%
\textfont\ttfam=\eighttt
\tt \ttglue=.5em plus.25em minus.15em
\def\SS{\fam\ssfam\eightss}%
\textfont\ssfam=\eightss
\normalbaselineskip=9pt
\setbox\strutbox=\hbox{\vrule height7pt depth2pt width\z@}%
\normalbaselines \parskip=\normalbaselineskip \rm}
%
% This is borrowed and extended from plain.tex
%
% 0 1 2 3 4 5
\def\magstep#1{\ifcase#1 \@m\or 1200\or 1440\or 1728\or 2074\or 2488\or
2986\or 3583\or 4300\or 5160 \fi\relax}
% 6 7 8 9
\catcode`@=12
\message{}
\message{I suggest you set eight point, VIII}
\message{It also sets raggedright}
\message{}
{
\VIII
\newbox\AlphaCommands
\setbox\AlphaCommands=%
\vbox{\tabskip0sp\offinterlineskip
\def\tablerule{\noalign{\hrule}}
\halign{\vrule#&\strut\quad\tt#\hfil\quad
&\vrule#&\quad\hfil\tt#\hfil\quad
&\vrule#\cr
\multispan5\hfil Alphabetized Listing of {\tt web-mode} Commands\hfil\cr
\noalign{\vskip6truept}
\tablerule
&\bf Command&&\bf\hidewidth Key Binding\hidewidth&\cr
\tablerule
&web-change-file&&ESC C-c C-f&\cr\tablerule
&web-collect-module-names&&n/a${}^1$&\cr\tablerule
&web-count-changes&&ESC C-c C-c&\cr\tablerule
&web-count-modules&&ESC C-c C-m&\cr\tablerule
&web-count-sections&&ESC C-c C-s&\cr\tablerule
&web-delimiter-match-check&&ESC C-d C-m&\cr\tablerule
&web-determine-characteristics&&ESC C-d C-c&\cr\tablerule
&web-edit-module&&ESC C-e C-m&\cr\tablerule
&web-file&&ESC C-w C-f&\cr\tablerule
&web-goto-change-corresponding-to-module&&ESC C-g C-c&\cr\tablerule
&web-goto-module&&ESC C-g C-m&\cr\tablerule
&web-goto-section&&ESC C-g C-s&\cr\tablerule
&web-include-file&&ESC C-i C-f&\cr\tablerule
&web-insert-index-entry&&ESC C-i C-i&\cr\tablerule
&web-insert-module-name&&n/a${}^2$&\cr\tablerule
&web-is-this-a-new-module-beginning&&n/a${}^3$&\cr\tablerule
&web-mode&&n/a${}^1$&\cr\tablerule
&web-mode-save-buffers-kill-emacs&&C-x C-c&\cr\tablerule
&web-newline&&n/a${}^4$&\cr\tablerule
&web-next-change&&ESC C-n C-c&\cr\tablerule
&web-next-define&&ESC C-n C-d&\cr\tablerule
&web-next-index&&ESC C-n C-i&\cr\tablerule
&web-next-module&&ESC C-n C-m&\cr\tablerule
&web-next-section&&ESC C-n C-s&\cr\tablerule
&web-next-use&&ESC C-n C-u&\cr\tablerule
&web-previous-change&&ESC C-p C-c&\cr\tablerule
&web-previous-define&&ESC C-p C-d&\cr\tablerule
&web-previous-index&&ESC C-p C-i&\cr\tablerule
&web-previous-module&&ESC C-p C-m&\cr\tablerule
&web-previous-section&&ESC C-p C-s&\cr\tablerule
&web-previous-use&&ESC C-p C-u&\cr\tablerule
&web-rename-module&&ESC C-r C-m&\cr\tablerule
&web-view-changed-modules-list&&ESC C-v C-c&\cr\tablerule
&web-view-index&&ESC C-v C-i&\cr\tablerule
&web-view-module-names-list&&ESC C-v C-m&\cr\tablerule
&web-view-section-names-list&&ESC C-v C-s&\cr\tablerule
&web-what-change&&ESC C-w C-c&\cr\tablerule
&web-what-module&&ESC C-w C-m&\cr\tablerule
&web-what-section&&ESC C-w C-s&\cr\tablerule
\noalign{\vskip6truept}
\multispan5\rm${}^1$ No keybinding for this function.\hfil\cr
\multispan5\rm${}^2$ Invoked whenever {\tt\char`<} is pressed.\hfil\cr
\multispan5\rm${}^3$ Invoked whenever {\tt\char`@} is pressed.\hfil\cr
\multispan5\rm${}^4$
Invoked whenever the newline character is pressed.
Suggested by Donald Knuth.\hidewidth\hfil\cr
}
}
$$\box\AlphaCommands$$
}
With the exception of two functions
\item{$\bullet$} {\tt web-file} and
\item{$\bullet$} {\tt web-mode-save-buffers-kill-emacs}
\noindent notice that all keybindings have a similar form that consists
of three parts. Each command is prefaced with the escape key. The next
part of the keybinding is the control key followed by the first letter
of the second word of the function name. The second part of the
keybinding is the control key followed by the first letter of the third
word of the function name.
{\VIII
\newbox\Files
\setbox\Files=\vbox{\hbox to 103truept{\hfil Movement Among\hfil}
\hbox to 103truept{\hfil Files\hfil}
}
\ht\Files=0sp \wd\Files=0sp
\newbox\Modules
\setbox\Modules=\vbox{\hbox to 103truept{\hfil Movement Among\hfil}
\hbox to 103truept{\hfil Modules\hfil}
}
\ht\Modules=0sp \wd\Modules=0sp
\newbox\Sections
\setbox\Sections=\vbox{\hbox to 103truept{\hfil Interactive Access to\hfil}
\hbox to 103truept{\hfil and\hfil}
\hbox to 103truept{\hfil Movement Among\hfil}
\hbox to 103truept{\hfil Sections\hfil}
}
\ht\Sections=0sp \wd\Sections=0sp
\newbox\Index
\setbox\Index=\vbox{\hbox to 103truept{\hfil Interactive Access to\hfil}
\hbox to 103truept{\hfil Index\hfil}
}
\ht\Index=0sp \wd\Index=0sp
\newbox\ModNames
\setbox\ModNames=\vbox{\hbox to 103truept{\hfil Interactive Access\hfil}
\hbox to 103truept{\hfil to Modules\hfil}
}
\ht\ModNames=0sp \wd\ModNames=0sp \dp\ModNames=0sp
\newbox\Change
\setbox\Change=\vbox{\hbox to 103truept{\hfil Change File\hfil}
\hbox to 103truept{\hfil Editing and Movement\hfil}
}
\ht\Change=0sp \wd\Change=0sp
\newbox\Structure
\setbox\Structure=\vbox{\hbox to 103truept{\hfil{\tt Web}\hfil}
\hbox to 103truept{\hfil Structure\hfil}
\hbox to 103truept{\hfil Information\hfil}
}
\ht\Structure=0sp \wd\Structure=0sp
\newbox\Misc
\setbox\Misc=\vbox{\hbox to 103truept{\hfil Miscellaneous\hfil}}
\ht\Misc=0sp \wd\Misc=0sp
\def\tablerule{\noalign{\hrule}}
\newbox\FuncCommands
\setbox\FuncCommands=%
\vbox{\offinterlineskip\tabskip0sp%
\halign{\vrule#%
&\quad\hbox to 103truept{\hfil#\hfil}\quad%
&\vrule#%
&\quad\hbox to 200truept{\tt#\hfil}\quad%
&\vrule#%
&\quad\tt\hfil#\hfil\quad%
&\vrule#\cr
\multispan7\hfil Alphabetized Listing of {\tt web-mode} Commands by
Functionality\hfil\cr
\noalign{\vskip6truept}
\tablerule
&\strut\bf\hfil Functionality\hfil
&&\bf Command&&\bf\hidewidth Key Binding\hidewidth&\cr
\tablerule
%
&\omit\quad\strut\box\Files&&web-change-file&&ESC C-c C-f&\cr
&&&\strut web-file&&ESC C-w C-f&\cr
&&&\strut web-include-file&&ESC C-i C-f&\cr\tablerule
%
&\omit\quad\strut\box\Modules&&web-goto-module&&ESC C-g C-m&\cr
&&&\strut web-next-module&&ESC C-n C-m&\cr
&&&\strut web-previous-module&&ESC C-p C-m&\cr\tablerule
%
&\omit\quad\strut\raise6truept\box\Sections%
&&web-goto-section&&ESC C-g C-s&\cr
&&&\strut web-next-section&&ESC C-n C-s&\cr
&&&\strut web-previous-section&&ESC C-p C-s&\cr
&&&\strut web-view-section-names-list&&ESC C-v C-s&\cr\tablerule
%
&\strut Inserting a Module&&web-insert-module-name%
&&n/a${}^{1\mathstrut}$&\cr
\tablerule
%
&\omit\quad\strut\box\Index&&web-next-index&&ESC C-n C-i&\cr
&&&\strut web-previous-index&&ESC C-p C-i&\cr
&&&\strut web-view-index&&ESC C-v C-i&\cr\tablerule
%
&&&\strut web-collect-module-names&&n/a${}^{2\mathstrut}$&\cr
&&&\strut web-next-define&&ESC C-n C-d&\cr
&\omit\quad\strut\raise6truept\box\ModNames&&web-next-use&&ESC C-n C-u&\cr
&&&\strut web-previous-define&&ESC C-p C-d&\cr
&&&\strut web-previous-use&&ESC C-p C-u&\cr
&&&\strut web-view-module-names-list&&ESC C-v C-m&\cr\tablerule
%
&&&\strut web-edit-module&&ESC C-e C-m&\cr
&\omit\quad\strut\raise6truept\box\Change%
&&web-goto-change-corresponding-to-module&&ESC C-g C-c&\cr
&&&\strut web-next-change&&ESC C-n C-c&\cr
&&&\strut web-previous-change&&ESC C-p C-c&\cr\tablerule
%
&&&\strut web-count-changes&&ESC C-c C-c&\cr
&&&\strut web-count-modules&&ESC C-c C-m&\cr
&&&\strut web-count-sections&&ESC C-c C-s&\cr
&\omit\quad\strut\raise6truept\box\Structure%
&&web-delimiter-match-check&&ESC C-d C-m&\cr
&&&\strut web-determine-characteristics&&ESC C-d C-c&\cr
&&&\strut web-view-changed-modules-list&&ESC C-v C-c&\cr
&&&\strut web-what-change&&ESC C-w C-c&\cr
&&&\strut web-what-module&&ESC C-w C-m&\cr
&&&\strut web-what-section&&ESC C-w C-s&\cr\tablerule
%
&&&\strut web-insert-index-entry&&ESC C-i C-i&\cr
&&&\strut web-is-this-a-new-module-beginning&&n/a${}^3$&\cr
&\omit\quad\strut\box\Misc&&web-mode&&n/a${}^2$&\cr
&&&\strut web-mode-save-buffers-kill-emacs&&C-x C-c&\cr
&&&\strut web-newline&&n/a${}^4$&\cr
&&&\strut web-rename-module&&ESC C-r C-m&\cr\tablerule
\noalign{\vskip6truept}
\multispan7\rm${}^1$ Invoked whenever {\tt\char`<} is pressed.\hfil\cr
\multispan7\rm${}^2$ No keybinding for this function.\hfil\cr
\multispan7\rm${}^3$ Invoked whenever {\tt\char`@} is pressed.\hfil\cr
\multispan7\rm${}^4$
Invoked whenever the newline character is pressed.
Suggested by Donald Knuth\hfil\cr
}
}
$$\box\FuncCommands$$
}
The non-interactive functions in {\tt web-mode} are:
\medskip
{\parindent0sp\parskip0sp\tt\obeylines
web-any-modules-undefined-initially
web-append-a-stub-module
web-binary-search-of-names
web-check-if-buffer-is-one-of-the-web-files
web-collect-list-of-changed-module-numbers
web-collect-location-of-modules
web-collect-module-names-in-buffer
web-collect-section-names
web-convert-list-to-string
web-count-the-matches
web-determine-characteristics-for-buffer
web-determine-module-name-ending
web-display-module-names
web-eliminate-control-sequences
web-eliminate-white-space
web-initialize-location-of-module-vector
web-initialize-module-names-list
web-insert-limbo-material
web-journal
web-next-or-previous-define-or-use
web-next-or-previous-index
web-options-for-module-name-insertion
web-reformat-the-index
web-update-the-location-of-module-vector
web-update-the-module-name-defined-in-used-in-list
web-write-module-names-to-a-file
}
\vfil\eject
\centerline{\BF Appendix B}
\bigskip
The global variables used in {\tt web-mode} are:
\medskip
{\parindent0sp\parskip0sp\tt\obeylines
web-buffer-name
web-change-buffer-name
web-default-directory
web-defined-in-occurrence
web-defined-in-used-in-location
web-files
web-index-buffer-name
web-index-entry
web-interactive-function-usage
web-interactive-functions
web-journal-on
web-location-in-selected-index-entry-occurrences
web-location-of-module
web-max-number-of-modules
web-mode-map
web-module-begins
web-module-changed-then-goto-change
web-module-name
web-module-name-defined-in-used-in
web-module-names
web-number-of-lines-in-window
web-number-of-module-names
web-number-of-modules-in-file
web-selected-index-entry-occurrences
web-selected-module-name
web-used-in-occurrence
}
The documentation for the above can be viewed at any time by issuing
the command
$$\line{\hskip\parindent\tt M-x describe-variable\hfil
\kern2pt\hbox{\vrule\vtop{\vbox{\hrule
\hbox{\strut\kern2pt{\tt C-h v}\kern2pt}}
\hrule}\vrule}}
$$
At the prompt, the name of the variable of interest should be entered.
\vfil\eject
\centerline{\BF Appendix C}
\bigskip
In order to get {\tt WEAVE} to create a separate file containing the
index and module names, the following changes were made to module 239:
\verbatim
@x
@* Phase three processing.
We are nearly finished! \.{WEAVE}'s only remaining task is to write out the
index, after sorting the identifiers and index entries.
@<Phase III: Output the cross-reference index@>=
phase_three:=true; print_nl('Writing the index...');
if change_exists then
begin finish_line; @<Tell about changed modules@>;
end;
finish_line; out4("\")("i")("n")("x"); finish_line;
@.\\inx@>
@<Do the first pass of sorting@>;
@<Sort and output the index@>;
out4("\")("f")("i")("n"); finish_line;
@.\\fin@>
@<Output all the module names@>;
out4("\")("c")("o")("n"); finish_line;
@.\\con@>
print('Done.');
@y
@* Phase three processing.
We are nearly finished! \.{WEAVE}'s only remaining task is to write out the
index, after sorting the identifiers and index entries.
If the user has set the |no_xref| flag (the -x option on the command line),
just finish off the page, omitting the index, module name list, and table of
contents.
@<Phase III: Output the cross-reference index@>=
if no_xref then begin
finish_line;
out("\"); out5("v")("f")("i")("l")("l");
out4("\")("e")("n")("d");
finish_line;
end
else begin
phase_three:=true; print_nl('Writing the index...');
finish_line;
out("\"); out5("i")("n")("p")("u")("t"); out(" ");
out5("I")("N")("D")("E")("X");
finish_line;
out("\"); out5("i")("n")("p")("u")("t"); out5(" ")("M")("O")("D")("U");
out5("L")("E")("_")("N")("A"); out3("M")("E")("S");
finish_line;
rewrite(tex_file,'INDEX.tex');
if change_exists then
begin @<Tell about changed modules@>;
end;
finish_line; finish_line; out4("\")("i")("n")("x"); finish_line;
@.\\inx@>
@<Do the first pass of sorting@>;
@<Sort and output the index@>;
out4("\")("f")("i")("n"); finish_line;
@.\\fin@>
rewrite(tex_file,'MODULE_NAMES.tex');
@<Output all the module names@>;
out4("\")("c")("o")("n"); finish_line;
@.\\con@>
print('Done.');
end;
@z
?endverbatim
\vfil\eject
Similarly, module 181 had to be changed in the {\tt WEAVE} for \Web s
written in C\null. The changes are:
\verbatim
@x
@ @c phase_three() {
if (no_xref) {
finish_line();
out_str("\\vfill\\end");
finish_line();
}
else {
phase=3; printf("\nWriting the index...");
if (change_exists) {
finish_line(); @<Tell about changed modules@>;
}
finish_line(); out_str("\\inx"); finish_line();
@.\\inx@>
@<Do the first pass of sorting@>;
@<Sort and output the index@>;
out_str("\\fin"); finish_line();
@.\\fin@>
@<Output all the module names@>;
out_str("\\con"); finish_line();
@.\\con@>
}
printf("Done.");
check_complete(); /* was all of the change file used? */
}
@y
@ @c phase_three() {
if (no_xref) {
finish_line();
out_str("\\vfill\\end");
finish_line();
}
else {
phase=3; printf("\nWriting the index...");
finish_line();
out_str("\\input INDEX"); finish_line(); finish_line();
out_str("\\input MODULE_NAMES"); finish_line(); fclose(tex_file);
if ((tex_file=fopen("INDEX.tex","w"))==NULL)
fatal("! Cannot open ouput file ","INDEX.tex");
if (change_exists) { @<Tell about changed modules@>;
finish_line(); finish_line(); }
out_str("\\inx"); finish_line();
@.\\inx@>
@<Do the first pass of sorting@>;
@<Sort and output the index@>;
out_str("\\fin"); finish_line(); fclose(tex_file);
@.\\fin@>
if ((tex_file=fopen("MODULE_NAMES.tex","w"))==NULL)
fatal("! Cannot open ouput file ","MODULE_NAMES.tex");
@<Output all the module names@>;
out_str("\\con"); finish_line(); fclose(tex_file);
@.\\con@>
}
printf("Done.");
check_complete(); /* was all of the change file used? */
}
@z
?endverbatim
\bye
|