summaryrefslogtreecommitdiff
path: root/usr.bin/mg/mg.doc
blob: fe238aee14d4ee06588ceab5b5e1d1e8ac417b18 (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
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
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202


















                          The MG Reference Manual

                                Release MG2A


                            Sandra J. Loosemore









                   Copyright (C)1987, Sandra J. Loosemore
   This   document,  or  sections  of  this   document,  may  be  freely

   redistributed  provided that  the copyright notice  and the following
   disclaimer  remain intact:  The author  bears no responsibilities for
   errors  in  this document  or the  software it  describes;  and shall
   not  be held  liable for any  indirect, incidental,  or consequential
   damages.














Contents




 1  Introduction                                                           2
   1.1   Implementations of MG. . . . . . . . . . . . . . . . . . . . .    3
   1.2   A Note on Character Sets . . . . . . . . . . . . . . . . . . .    3
   1.3   Notation and Conventions . . . . . . . . . . . . . . . . . . .    4
   1.4   Getting Started. . . . . . . . . . . . . . . . . . . . . . . .    5
 2  Using Commands                                                         7
   2.1   Command Arguments. . . . . . . . . . . . . . . . . . . . . . .    7
   2.2   Prefix Arguments . . . . . . . . . . . . . . . . . . . . . . .    7
   2.3   Aborting . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
   2.4   Extended Commands. . . . . . . . . . . . . . . . . . . . . . .    8
 3  Moving the Cursor                                                      9

 4  Text Insertion Commands                                               12
 5  Killing, Deleting, and Moving Text                                    14

 6  Searching and Replacing                                               16
   6.1   Searching. . . . . . . . . . . . . . . . . . . . . . . . . . .   16
   6.2   Replacing. . . . . . . . . . . . . . . . . . . . . . . . . . .   17
   6.3   Regular Expressions. . . . . . . . . . . . . . . . . . . . . .   18
 7  Windows                                                               21

 8  Files and Buffers                                                     23
   8.1   Buffer Manipulation. . . . . . . . . . . . . . . . . . . . . .   23
   8.2   Reading and Writing Files. . . . . . . . . . . . . . . . . . .   24
   8.3   Backup Files . . . . . . . . . . . . . . . . . . . . . . . . .   25
   8.4   Changing the Directory . . . . . . . . . . . . . . . . . . . .   25
 9  Modes                                                                 26
   9.1   No Tab Mode. . . . . . . . . . . . . . . . . . . . . . . . . .   26
   9.2   Overwrite Mode . . . . . . . . . . . . . . . . . . . . . . . .   27
   9.3   Auto Fill. . . . . . . . . . . . . . . . . . . . . . . . . . .   27
   9.4   Auto Indent. . . . . . . . . . . . . . . . . . . . . . . . . .   27
   9.5   Blink. . . . . . . . . . . . . . . . . . . . . . . . . . . . .   28


                                     1







   9.6   Dired Mode . . . . . . . . . . . . . . . . . . . . . . . . . .   28

 10 Miscellaneous                                                         30
   10.1  Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   30
   10.2  Keyboard Macros. . . . . . . . . . . . . . . . . . . . . . . .   30
   10.3  Changing Case. . . . . . . . . . . . . . . . . . . . . . . . .   31
   10.4  Odds and Ends. . . . . . . . . . . . . . . . . . . . . . . . .   31
 11 Customization                                                         33
   11.1  Key Bindings . . . . . . . . . . . . . . . . . . . . . . . . .   33
   11.2  Startup Files. . . . . . . . . . . . . . . . . . . . . . . . .   34
Fundamental Mode Key Bindings                                             36

Index                                                                     38

































                                     2













Chapter 1




Introduction



MG is  a small, fast,  and portable Emacs-style  text editor intended to  be
used by people who can't  run a real Emacs for one reason or another  --- as
their main editor on smaller machines with limited memory  or file space, or
as a  ``quick-start'' editor on larger  systems, useful for composing  short
mail messages and the like.
   We've made  MG compatible  with GNU  Emacs because that  is the  ``big'',
full-featured editor  that many of  us use regularly  and are most  familiar
with.   GNU Emacs is the creation of  Richard M. Stallman, who was  also the
author of the original Emacs  editor.  However, MG is not associated  in any
way with  the GNU project, and  the MG authors  individually may or may  not
agree with the opinions expressed by Richard Stallman and the GNU project.
   MG is largely  public domain.  You  can use, modify, and  redistribute MG
as you  like.  A  few modules, however,  are copyrighted; specifically,  the
regular expression  code, the  VMS termcap routines,  and the Amiga  support
code.  Look at the source code for the exact copyright restrictions.
   There  are several  other  editors  in existence  which  call  themselves
MicroEmacs.  The  original public domain version was written by  Dave Conroy
and circulated  as version  1.6.   Derived from  this, there  is another  PD
version by Dave  Conroy numbered v30;  a significantly larger PD version  by
Daniel Lawrence  which is now up  to version 3.9;  at least one  proprietary
implementation;  an  implementation for  the  Atari  ST with  an  integrated
command shell, by Prabhaker  Mateti; and probably others that we  don't know
about.
   MG is derived from the v30 MicroEmacs, with  key bindings, command names,
and general functionality  made more compatible with  GNU Emacs.  Like  v30,
MG  is fairly  small and  quite  robust.   We  have  generally resisted  the
temptation to overfeaturize.  Some features which are  large and complex are
flagged for conditional compilation.
   Many people  have contributed  their time to  developing, improving,  and


                                     3







porting MG. Mike Meyer,  Mic Kaczmarczik, and Bob Larson  deserve particular
mention for their efforts.
   Questions, suggestions, and offers of help should be addressed to:

        mg-developers@ucbvax.berkeley.edu   (ARPA)
        ucbvax!mg-developers                (UUCP)


1.1 Implementations of MG

MG runs on many  different kinds of hardware under many  different operating
systems.  Currently, these include:

  -  4.2 and 4.3 BSD Unix (including Ultrix-32)

  -  System V Unix

  -  VAX/VMS

  -  Primos

  -  OS9/68k

  -  Amiga

  -  Atari ST

  -  MS-DOS


   This document describes release MG2A. When we talk  of different versions
of MG  in this manual, the  term version is used  to refer to the  different
support MG provides for  the various machines and operating systems  it runs
under, not to different releases of MG itself.   For example, we might speak
of how the VMS version of MG differs from the Unix version.
   As  mentioned above,  some  MG commands  may not  be  implemented in  all
versions; these  are noted in the documentation.   Some versions of  MG also
support features (such as mouse handling) that are not described here.

1.2 A Note on Character Sets

MG  uses  the  128-character  ASCII  character  set,  and  provides  support
for  8-bit characters.    Whether  the particular  version  of MG  that  you
are running  knows about  extended character  sets depends  on whether  your


                                     4







terminal and  the host operating  system know about them.   Moreover,  since
there is  no standard  8-bit character  set, the same  character codes  will
probably give different  glyphs on different systems.   Most versions of  MG
use the DEC multinational character set.


1.3 Notation and Conventions

In this manual,  commands and other things  that must be typed in  literally
are indicated in  a typewriter font, like  next-line.  Placeholders such  as
command argument names use an italic font.
   The terms  command and  function are  synonymous.   We often  speak of  a
command being bound to  a particular key, although you may actually  have to
type more than one character to form a single key.   Most commands are bound
to keys with control and meta modifiers.
   To type a control character, use the control key on  your keyboard like a
shift key:  hold down  the control key while typing the character.   In this
manual, we  will indicate control characters like  C-x --- here, typing  the
character ``x'' while holding down the control key.
   Some keyboards  also have  a meta key  that works  like the control  key.
(It may be  labelled something else; on the  Atari ST, for example,  the key
marked ``Alternate''  is the meta  key.)   If your  keyboard doesn't have  a
meta key, don't  panic.  You can also  use the escape key as a  meta prefix;
first type  the escape,  and then the  character.   Meta characters will  be
indicated as M-x.
   Besides the meta prefix, two other characters are used  as prefixes:  C-x
and C-h.   A few keys  have special notation:   SPC is the space  character,
DEL is  the delete  or rubout  character, RET  is carriage  return, and  ESC
is the  escape character.   NUL is  the null character  (ASCII 0), which  is
usually equivalent to either C-SPC or C-@.
   Uppercase and  lowercase characters are  generally equivalent in  command
keystrokes.
   When you run MG  from a shell, command line arguments are  interpreted as
the names of  files you want to  visit, or edit.   Each file is read into  a
buffer in memory.   No changes are actually  made to the file until  you ask
it to be written out to disk.
   Within MG,  the large  top part  of the  screen serves as  a window  into
the buffer being  edited.  Below this  is the mode line, which  displays the
name of the  buffer.  Finally,  at the very bottom  of the screen, there  is
a one-line  minibuffer which is used  for displaying messages and  answering
questions.
   MG keeps track of two pointers into each window, the  point and the mark.
The cursor appears  at the point in the  current window, and we  often speak
of moving the cursor rather than of moving the point.   The text between the


                                     5







point and the mark is referred to as the region.
   Some commands deal with words and paragraphs.   Generally, whitespace and
punctuation separate  words.   Lines  that are  empty or  that contain  only
spaces or  tabs separate paragraphs without  being part of  a paragraph.   A
non-empty line that starts with a space or tab also begins a new paragraph.
   A number of  commands are defined as toggles.   If no prefix  argument is
supplied, these  commands toggle an action.   The action  is turned on if  a
negative or zero argument is supplied, and turned on  if a positive argument
is supplied.


1.4 Getting Started

This document  is intended primarily  as a  reference manual.   If you  have
never used any Emacs-like text editor before, it  is strongly suggested that
you run the on-line  tutorial supplied with the MG distribution,  instead of
reading this manual.
   Do not  be put  off by  the large  number of commands  described in  this
manual!   It is possible to  get by with only  a handful of basic  commands.
Here are the ones that are probably used most frequently:

C-p             Move the cursor to the previous line

C-n             Move the cursor to the next line

C-b             Move the cursor backwards

C-f             Move the cursor forwards

C-v             Scroll forwards one screenful

M-v             Scroll backwards one screenful

M-<             Go to the beginning of the buffer

M->             Go to the end of the buffer

C-a             Go to the beginning of the line

C-e             Go to the end of the line

DEL             Delete the previous character

C-k             Kill (delete) to the end of line


                                     6







C-y             Reinsert killed text.

C-x C-c         Exit MG

C-x C-s         Save the current buffer









































                                     7













Chapter 2




Using Commands



2.1 Command Arguments

Some commands require  arguments.  For example,  if you want to read  a file
into a buffer, you must  type in the name of the file.   In the descriptions
of commands  in this  manual,  if arguments  are required,  they are  listed
following the command name.
   MG  prompts  for  command  arguments in  the  minibuffer.     Within  the
minibuffer, the following characters can be used for editing:


DEL, C-h        Erase the last character.

C-x, C-u        Erase the entire input line.

C-w             Erase to the beginning of the previous word.

C-q, n          Quote the next character typed.

RET             Signifies that you have completed typing in the argument.

C-g             Abort the command in progress.

2.2 Prefix Arguments

All commands  accept an  optional numeric prefix  argument.   This is  often
interpreted as  a repetition count.   For  example, the function  next-line,
if given a  prefix argument, will move  the cursor forward that many  lines;
without an  argument,  it will move  the cursor  forward one  line.   A  few
commands behave differently if given a prefix argument  than they do without


                                     8







one, and others ignore the prefix argument entirely.

digit-argument              M-0, M-1, M-2, M-3, M-4, M-5, M-6, M-7, M-8, M-9
negative-argument                                                        M--
One way to  specify a command argument  is to use the  escape key as a  meta
prefix,  and then  type one  or more  digits.   A  dash  may be  used for  a
negative argument.

universal-argument                                                       C-u

Another way to specify a  command prefix is to type C-u.  Typing one  C-u is
equivalent to a  prefix argument of 4, typing  two gives a value of 16,  and
so on.   In addition,  you can type digits following  C-u to form a  numeric
prefix argument.

2.3 Aborting


keyboard-quit                                                            C-g
Typing C-g cancels any command.  It is particularly  useful for cancelling a
command when MG is prompting for input in the minibuffer.


2.4 Extended Commands


execute-extended-command command                                         M-x
Commands  that  are not  bound  to  keys  can be  executed  through  execute
extended-command.   If a prefix  argument is supplied,  it is passed to  the
command being executed.
















                                     9













Chapter 3




Moving the Cursor



The commands  described in this  chapter move  the cursor (sometimes  called
the point or  dot) within the current window.   Commands which set  the mark
are included here as well.

backward-char                                                            C-b
Moves the  cursor backward (left) one  character.  If  the cursor is at  the
left margin, it will be moved to the end of the previous line.

backward-paragraph                                                       M-[
Moves the  cursor backwards to  the beginning of  the current paragraph,  or
to the beginning of  the previous paragraph if the cursor is already  at the
beginning of a paragraph.

backward-word                                                            M-b

Moves the cursor backwards  to the beginning of the current word, or  to the
beginning of the previous word if the cursor is already  at the beginning of
a word.

beginning-of-buffer                                                      M-<
Moves the cursor backwards to the beginning of the buffer.

beginning-of-line                                                        C-a
Moves the  cursor backwards  to the  beginning of  the current line.    This
command has  no effect  if the  cursor is  already at the  beginning of  the
line.

end-of-buffer                                                            M->
Moves the cursor forwards to the end of the buffer.


                                     10








end-of-line                                                              C-e
Moves the cursor forwards to the end of the current line.   This command has
no effect if the cursor is already at the end of the line.

exchange-point-and-mark                                              C-x C-x

Set the mark at the current cursor position, and move  the cursor to the old
location of the mark.

forward-char                                                             C-f
Moves the cursor forwards one  character.  If the cursor is at the end  of a
line, it will be moved to the first character on the next line.

forward-paragraph                                                        M-]
Moves the cursor forwards to the next paragraph delimiter.

forward-word                                                             M-f
Moves the cursor forwards to  the end of the current word, or to the  end of
the next word if the cursor is already at the end of a word.

goto-line line-number
Moves the cursor to the beginning of line line-number in the buffer.

next-line                                                                C-n

Moves the  cursor down  one line.   The  cursor remains in  the same  column
unless it would  be past the end of the  line, in which case it is  moved to
the end of the line.  At the end of the buffer, C-n will create new lines.

previous-line                                                            C-p
Moves the cursor up one line.  The cursor remains  in the same column unless
it would be past the end  of the line, in which case it is moved  to the end
of the line.

recenter                                                                 C-l
Redraws the  entire screen,  scrolling the  current window  if necessary  so
that the cursor is near the center.  With a  positive prefix argument n, the
window is scrolled so that  the cursor is n lines from the top.   A negative
prefix argument  puts the  cursor that  many lines  from the  bottom of  the
window.

redraw-display



                                     11







Redraws the entire screen, but never scrolls.

scroll-down                                                              M-v
Scrolls the display down  (moving backward through the buffer).   Without an
argument, it scrolls  slightly less than one  windowful.  A prefix  argument
scrolls that many lines.

scroll-one-line-down
scroll-one-line-up

These functions  are similar  to scroll-down  and scroll-up  (respectively),
but when  invoked without an  argument, cause the display  to scroll by  one
line only.  These functions are enabled by  defining the compile-time option
GOSMACS.

scroll-other-window                                                    M-C-v
Scrolls the ``other'' window forward as for scroll-up.

scroll-up                                                                C-v
Scrolls the display up  (moving forward through the buffer).  Without  an an
argument, it scrolls  slightly less than one  windowful.  A prefix  argument
scrolls that many lines.

set-mark-command                                                         NUL
Set the mark at the current cursor position.

what-cursor-position                                                   C-x =
Prints some information in the minibuffer about where the cursor is.


















                                     12













Chapter 4




Text Insertion Commands



The  usual  way  to  insert  text into  a  buffer  is  simply  to  type  the
characters.    The  default  binding  for  all of  the  printing  characters
(self-insert-command) causes  them to  be inserted literally  at the  cursor
position.

insert string
Insert string into the current buffer at the cursor position.

newline                                                                  RET
Insert a line break  into the current buffer at the cursor  position, moving
the cursor forward to the beginning of the new line.

newline-and-indent                                                       C-j

Insert a  line break into  the current buffer at  the cursor position,  then
add extra  whitespace so that the  cursor is aligned  in the same column  as
the first non-whitespace character in the previous line.

open-line                                                                C-o
Inserts a line  break into the current  buffer at the current position,  but
does not move the cursor forward.

quoted-insert                                                            C-q
This command  acts as a  prefix to cancel the  normal interpretation of  the
next keystroke.   If  C-q is followed by  one to three  octal digits, it  is
interpreted as  the code of  the character  to insert.   Otherwise a  single
key is  read and  the character typed  is inserted  into the buffer  instead
of interpreted  as a command.   This is  used for inserting literal  control
characters into a buffer.


                                     13








self-insert-command
This  is the  default binding  for keys  representing printable  characters.
The character is  inserted into the buffer  at the cursor position, and  the
cursor moved forward.









































                                     14













Chapter 5




Killing, Deleting, and Moving Text



When text is deleted,  it is erased completely.  Killing text, on  the other
hand, moves it  into a temporary storage area  called the kill buffer.   The
saved  text in  the kill  buffer is  erased when  another block  of text  is
killed.   Until then, however, you  can retrieve text from the  kill buffer.
This can  be used to  move or  copy blocks of  text, as  well as to  restore
accidentally killed text.

backward-kill-word                                                     M-DEL
Kill the  text backwards from  the cursor position to  the beginning of  the
current  word.   Typing  M-DEL  several times  in succession  prepends  each
killed word to the kill buffer.

copy-region-as-kill                                                      M-w
Copies the  text in  the region into  the kill buffer,  without removing  it
from the current buffer.

delete-backward-char                                                     DEL

Deletes the character to the left of the cursor.

delete-blank-lines                                                   C-x C-o
Deletes all blank lines  after the current line, and if the current  line is
blank, deletes it and all blank lines preceeding it as well.

delete-char                                                              C-d
Deletes the character underneath the cursor.

delete-horizontal-space                                                  M-n
Deletes all spaces and tabs on either side of the cursor.


                                     15








just-one-space                                                         M-SPC
This is  like delete-horizontal-space,  except it leaves  a single space  at
the cursor position.

kill-line                                                                C-k

If no prefix argument is specified, this function kills text  up to the next
newline; or if  the cursor is at the end  of a line, the newline  is killed.
A prefix  argument specifies how  many lines  to kill.   Typing C-k  several
times in succession appends each line to the kill buffer.

kill-paragraph
This command  kills the  entire paragraph  containing the  cursor.   If  the
cursor is positioned between paragraphs, the next paragraph is killed.

kill-region                                                              C-w
The region (all text between point and mark) is killed.

kill-word                                                                M-d
Text is  killed forward from the  cursor position to  the next end of  word.
If the  cursor is at  the end  of the word,  then the  next word is  killed.
Typing M-d several times appends the killed text to the kill buffer.

yank                                                                     C-y
Text is copied  from the kill buffer into  the current buffer at  the cursor
position.  The cursor is moved to the end of the inserted text.



















                                     16













Chapter 6




Searching and Replacing



6.1 Searching

The ordinary search  command in MG differs  from that in many other  editors
in that it is incremental:  it begins searching as  soon as you begin typing
the search string, instead of waiting for you to type the entire string.
   All   of   the   search  commands   described   in   this   section   are
case-insensitive.

isearch-backward pattern                                                 C-r
isearch-forward pattern                                                  C-s

These  commands   perform  an  incremental   search  backward  and   forward
(respectively) for  pattern.  MG  will move the cursor  to the place in  the
buffer that  matches as much  of the pattern  as you have  typed so far,  as
each character is entered.
   Within the incremental  search, the following characters  are interpreted
specially:

DEL             Erase the last character in the search string.

ESC             Stop searching; exit  from incremental search mode,  leaving
                the cursor where the search brought it.

C-g             If a match has been found, exits from incremental search but
                leaves the cursor in its  original position.  If  the search
                has failed, this will  just erase the characters which  have
                not been found from the end of the search pattern.   In this
                case, you must type C-g again to abort the search.



                                     17







C-s             Search forward for the next occurrence of the same pattern.

C-r             Search backward  for  the previous  occurrence of  the  same
                pattern.

C-q             ``Quotes''  the next  character  typed,  forcing  it  to  be
                interpreted as a literal character in the search pattern.

   In  addition,  normal commands  such  as C-a  that  do not  have  special
meanings within  incremental search cause the  search to be terminated,  and
then are executed in the ordinary way.

search-again
search-backward pattern                                                  M-r
search-forward pattern                                                   M-s

These commands  perform ordinary,  non-incremental searches.    Search-again
uses the same pattern and direction as the previous search.

6.2 Replacing


query-replace pattern replacement                                        M-%
The primary  replace command  in MG  is an  interactive query replace.    MG
searches forward for occurrences  of pattern, and asks you what to  do about
each one.  The choices are:


SPC             Replace this match with replacement, and go on to the next.

DEL             Skip to the next match without replacing this one.

.               Replace this match, and then quit.

!               Replace all remaining occurrences without asking again.

ESC             Quit.

   By  default, query-replace  adjusts  the case  of lower-case  letters  in
the replacement  string to match  that of the  particular occurrence of  the
pattern;  for example, replacing  ``Foo'' with  ``bar'' results in  ``Bar''.
Upper case letters in the replacement string are always left  uppercase.  In
addition, supplying a prefix argument will also  tell query-replace to leave
the case of the replacement string as-is.


                                     18







   Note that query-replace always performs a case-insensitive search.


6.3 Regular Expressions

Regular expressions provide a means for specifying  complex search patterns,
instead  of just  a  literal string.    The  commands  in this  section  are
available only if MG is compiled with the REGEX option defined.
   Regular expression  syntax uses  the following  rules.   Most  characters
in  a regular  expression  are considered  to  be ordinary  characters,  and
will match  themselves and  nothing else.   The  exceptions are the  special
characters listed below.

.               Matches any single character except a newline.

*               A suffix operator that  matches zero or more repetitions  of
                the (smallest) preceding regular expression.

+               A suffix operator  that matches one  or more repetitions  of
                the (smallest) preceding regular expression.

?               A suffix operator that matches either zero or  one occurence
                of the (smallest) preceding regular expression.

[... ]          Matches  any one  character  listed  in  the  character  set
                between the square brackets.  See examples below.

^               Matches at the beginning of a line.

$               Matches at the end of a line.

n               Except for  the situations listed  below, acts  as a  prefix
                operator which causes the character following to  be treated
                as an ordinary character.

n|              An infix binary or operator.  It applies to  the two largest
                surrounding expressions.

n(... n)        A grouping  construct,  usually  used  to specify  a  larger
                expression for postfix operators such  as * or to  limit the
                scope of operands to \|.

ndigit          Matches  the  same  text  matched  by  the  digitth  \(...\)
                construct.  These are numbered from 1 to 9 in the order that


                                     19







                the open-parentheses appear.

n`              Matches at the beginning of the buffer.

n'              Matches at the end of the buffer.

nb              Matches at the beginning or end of a word.

nB              Matches anyplace except at the beginning or end of a word.

n<              Matches at the beginning of a word.

n>              Matches at the end of a word.

nw              Matches any word-constituent character.

nW              Matches any character which is not a word-constituent.

   Some examples may help clarify the rules.


foo             Matches the literal string foo.

;.*             Matches  all  strings  which  begin  with  a  semicolon  and
                continue to the end of a line.

c[ad]+r         Matches strings of the form car, cdr, caar, cadr, and so on.

[a-z]           Matches any lowercase letter.

[^a-z]          Matches any character except lowercase letters.

[0-9+---]       Matches a digit or sign.

n(foon|barn)    Matches either the string foo or the string bar.


count-matches pattern
count-non-matches pattern
These commands count the  number of lines which do or do  not (respectively)
match the specified pattern.

delete-matching-lines pattern
delete-non-matching-lines pattern


                                     20







These commands delete all lines which do or do  not (respectively) match the
specified pattern.

query-replace-regexp pattern replacement
This is the regular expression version of query-replace.
   The replacement  string may  be a  constant, or  it can refer  to all  or
part of  the string matched by  the pattern.   \& in the replacement  string
expands into the entire text being replaced, while \n (where  n is a number)
replaces the nth parenthesized expression in pattern.

re-search-again
re-search-backward pattern
re-search-forward pattern

These  are  the   regular  expression  equivalents  of  the   ordinary  non-
incremental search commands.

set-case-fold-search
This command toggles an internal variable that controls  whether the regular
expression search and replace  commands pay attention to case.   By default,
regular expression  searches are  case-insensitive.   Ordinary searches  are
always  case-insensitive  and  are not  affected  by  the  setting  of  this
variable.























                                     21













Chapter 7




Windows



MG initially has only one  text window displayed.  However, you can  have as
many windows as will fit  on the screen.  Each window has its own  mode line
and must display at least two lines of text.   (Note that a MG's ``windows''
are distinct from the  ``windows'' handled by screen managers such as  the X
Window System.)
   Multiple windows may be used to display different buffers.   You can also
have the same buffer  displayed in more than one window, which is  useful if
you want  to see one  part of a  file at  the same time  as you are  editing
another part.
   Although  many windows  can be  displayed  at once,  only  one window  is
active at any given time.  This is the window where the cursor appears.
   Some  commands refer  to  the  ``other'' window.     This is  the  window
directly below  the current  window, or  the top  window if you  are in  the
bottom window.

delete-other-windows                                                   C-x 1
Makes the current window the only window.

delete-window                                                          C-x 0
Deletes the current window, making the ``other''  window the current window.
This command doesn't  do anything useful if  there is only one window  being
displayed.

enlarge-window                                                           C-^

Makes the  current window  larger.   Without a prefix  argument, the  window
grows one line;  otherwise, the prefix argument specifies how many  lines to
grow.



                                     22







other-window                                                           C-x o
Makes the ``other'' window the current window.

previous-window

This is  like other-window,  except that  it cycles through  the windows  in
reverse order.  This  command is available only if MG was compiled  with the
GOSMACS option defined.

shrink-window
Makes the  current window smaller.   Without a  prefix argument, the  window
loses one line;  otherwise, the prefix argument specifies how many  lines go
away.

split-window-vertically                                                C-x 2
Split the current window into two windows, both using the same buffer.






























                                     23













Chapter 8




Files and Buffers



Most buffers are used to  contain a file being edited.  It is  also possible
to have  buffers that are not  associated with any file;  MG uses these  for
purposes such  as displaying help text,  for example.   However, since  most
commands for dealing with files also deal with buffers,  we have grouped all
of these commands together into one chapter.

8.1 Buffer Manipulation


insert-buffer buffer-name

Inserts the  contents of  the named buffer  into the  current buffer at  the
cursor location.  The cursor moves to the end of the inserted text.

kill-buffer buffer-name                                                C-x k
The named  buffer and  its contents are  deleted.   If the  buffer has  been
marked as modified, MG will  ask you if you really want to delete it.   Note
that, contrary to its  name, this command does not save the  buffer contents
in the kill buffer.
   If a buffer  is being displayed in a  window when it is deleted,  MG will
find some other buffer to display in the same window.

list-buffers                                                         C-x C-b
This command  writes information  about the  buffers currently in  use to  a
buffer named *Buffer List*.  This buffer is then  displayed in the ``other''
window;  if there is  only one window,  this command  will split the  screen
into two windows.

not-modified                                                             M-~


                                     24







This command makes MG  think that the current buffer has not  been modified,
even if  it really  has been  changed.   This  affects the  behavior of  the
kill-buffer and the buffer-saving commands described below.
   MG indicates modified buffers with two stars at the left  end of the mode
line.

switch-to-buffer buffer-name                                           C-x b
The current window is mapped onto the named buffer.   If there isn't already
a buffer with that name around, MG will create one.

switch-to-buffer-other-window buffer-name                            C-x 4 b

This command works  like switch-to-buffer, except that the  ``other'' window
is used.  If  there is only one window, this command splits the  screen into
two windows and maps the named buffer onto one of them.

8.2 Reading and Writing Files


find-file file-name                                                    C-x f
find-file-other-window file-name                                   C-x 4 C-f
These  commands  are analagous  to  switch-to-buffer  and  switch-to-buffer-
other-window, respectively.  The difference is that  these commands look for
a buffer associated  with the named file.   If no matching buffer  is found,
MG will  create a  new buffer  with a name  derived from  the filename,  and
attempt to  read the  file into the  buffer.   If the  named file cannot  be
opened, the buffer remains empty.

insert-file file-name                                                  C-x i

This  command reads  in the  contents of  the named  file  into the  current
buffer at the cursor position.  The cursor remains in the same place.

save-buffer                                                          C-x C-s
If the current buffer has been modified, it is saved.   Buffers that are not
associated with files cannot be written out with this command.

save-buffers-kill-emacs                                              C-x C-c
This command is  used to leave MG and  return control to the shell  or other
program that was  used to start MG. If  there are modified buffers,  MG will
ask you if you want to save them before exiting.

save-some-buffers                                                      C-x s
MG will  ask you if you  want to save  modified buffers that are  associated


                                     25







with files.

write-file file-name                                                 C-x C-w
The  current buffer  is written  out using  the file  name supplied.    This
is useful  for saving  buffers that are  not associated with  files, or  for
writing out a file with a different name than what was used to read it in.


8.3 Backup Files

MG provides  a way to  save a copy  of the original  version of files  which
have been  modified and then written  out again.   The backup copy  reflects
the state of the file as it existed the first time it  was read into MG. The
name used for the backup file varies, depending on the operating system.
   This feature is disabled if MG is compiled with NOBACKUP defined.

make-backup-files
This command is  a toggle which controls  the state of an internal  variable
that determines whether MG creates backup files.


8.4 Changing the Directory

The commands in this section are disabled by defining NODIR.

cd directory-name
This command changes  MG's notion of the ``current'' directory  or pathname.
This is used to supply defaults for functions that read or write files.
   The syntax  for directory-name  is obviously specific  to the  particular
operating system MG is running on.

pwd
Display what MG thinks is the current directory.













                                     26













Chapter 9




Modes



Modes are used to  locally alter the bindings of keys on  a buffer-by-buffer
basis.  MG is normally in fundamental mode, and  these are the bindings that
are listed  with the  command descriptions  in this  manual.   Modes  define
additional keymaps  that are  searched for bindings  before the  fundamental
mode bindings are  examined; see the section  on key binding below for  more
details on how this works.

set-default-mode mode-name
Normally,  when  MG visits  a  file,  it  puts the  associated  buffer  into
fundamental mode.  Using the set-default-mode command,  you can specify that
MG should default to use some other mode on all  subsequent buffers that are
created.  This command  is a toggle.  With no prefix argument,  if the named
mode is not already on  the list of default modes, then it will be  added to
the list; otherwise, it is removed from the list.


9.1 No Tab Mode

In notab mode, tabs  are expanded into spaces instead of  inserted literally
into the  buffer.   Literal tab  characters are displayed  as ^I (much  like
other control characters).   These commands are available if MG  is compiled
with the  symbol NOTAB defined.   (This  mode is mainly  for use on  systems
such as PRIMOS that do not treat tab as a series of spaces.)

no-tab-mode
This command is a toggle to control whether notab mode is in effect.

space-to-tabstop
Insert enough  spaces to move  the cursor to  the next tab stop.   In  notab


                                     27







mode, this function is bound to C-i.


9.2 Overwrite Mode

Normally, when  characters are  inserted into the  buffer, they are  spliced
into the  existing text.   In overwrite mode,  inserting a character  causes
the  character already  at the  cursor position  to be  replaced.   This  is
useful for editing pictures, tables, and the like.

overwrite-mode
This  command is  a  toggle  which controls  whether  overwrite mode  is  in
effect.

9.3 Auto Fill

Fill mode  causes newlines  to be  added automatically at  word breaks  when
text is added at the  end of a line, extending past the right margin.   Auto
fill is useful for editing text and documentation files.

auto-fill-mode

This command is a toggle which controls whether fill mode is in effect.

insert-with-wrap
This command  works like self-insert,  except that it checks  to see if  the
cursor has passed the right  margin.  If so, it fills the line  by inserting
a line break between words.  This command is bound to SPC in fill mode.

fill-paragraph                                                           M-q
Fill the paragraph containing the cursor.

set-fill-column                                                        C-x f
Without  a prefix  argument,  this  command sets  the  right margin  at  the
current  cursor column.    If a  prefix  argument is  supplied,  it is  used
instead as the line width.


9.4 Auto Indent

Indent  mode binds  RET to  newline-and-indent,  so that  each  new line  is
indented to the same level as the preceeding line.   This mode is useful for
editing code.



                                     28







auto-indent-mode
This  command is  a toggle  which controls  whether auto-indent  mode is  in
effect.


9.5 Blink

Blink  mode makes  it  easier  to match  parentheses,  brackets,  and  other
paired delimiters.   When the closing  delimiter is typed, the cursor  moves
momentarily to the matching  opening delimiter (if it is on the  screen), or
displays the line containing the matching delimiter on the echo  line.  This
is useful for editing Lisp or C code, or for  preparing input files for text
processors such as LaTeX that use paired delimiters.

blink-matching-paren
This command is a toggle which controls whether blink mode is in effect.

blink-matching-paren-hack
This function  behaves like self-insert, except  that it finds the  matching
delimiter as described above.   In blink mode, this function is bound  to ),
which flashes the matching (.  This function also  knows about the pairs {},
[], and <>.  All other characters match with themselves.


9.6 Dired Mode

``Dired'' is  an abbreviation for  ``directory editor'',  and it provides  a
way to browse through  the contents of a directory from with MG.  Dired puts
a directory listing  into a buffer; you  can use normal editing commands  to
move around the  buffer, and a special  group of commands to manipulate  the
files.  For example,  there are commands to delete and rename files,  and to
read a file into an MG buffer.
   Since dired mode rebinds many keys, a table may be helpful:

    C-d      dired-flag-file-deleted
    SPC      next-line
    c        dired-copy-file
    d        dired-flag-file-deleted
    e        dired-find-file
    f        dired-find-file
    n        next-line
    o        dired-find-file-other-window
    p        previous-line
    r        dired-renamefile


                                     29







    u        dired-unflag
    x        dired-do-deletions
    DEL      dired-backup-unflag

   The commands in this section are disabled by defining NODIRED.

dired directory-name                                                   C-x d
Creates a  dired buffer  for the given  directory name,  and displays it  in
the current window.   The files in  the directory are listed,  usually along
with information about the file  such as its size and timestamp.   The exact
format of the information is system-specific.

dired-backup-unflag

This  function  removes the  deletion  flag  from  the file  listed  on  the
previous line of the dired buffer.

dired-copy-file new-name
Copy the file listed on the current line of the dired buffer.

dired-do-deletions
Deletes the files that have been flagged for deletion.

dired-find-file
dired-find-file-other-window
These function works like find-file and  find-file-other-window, except that
the filename is taken from the current line in the dired buffer.

dired-flag-file-deleted

Flag the file  listed on the current line  for deletion.  This  is indicated
in the  buffer by putting  a ``D'' at  the left  margin.   No files are  not
actually deleted until the function dired-do-deletions is executed.

dired-other-window directory-name
This function works  just like dired, except  that it puts the dired  buffer
in the ``other'' window.

dired-rename-file new-name
Renames the file listed on the current line of the dired  buffer.  Note that
the dired buffer is not updated to reflect the change.

dired-unflag
Remove the deletion flag for the file on the current line.


                                     30













Chapter 10




Miscellaneous



10.1 Help

Most of the commands in this section write useful  information to the *help*
buffer, which is then displayed in the ``other'' window.
   These commands can be disabled at compile-time by defining NOHELP.

apropos topic                                                          C-h a

This  command lists  all functions  whose names  contain  a string  matching
topic in the *help* buffer.

describe-bindings                                                      C-h b
Information  about the  key bindings  in  effect in  the current  buffer  is
listed in the *help* buffer.

describe-key-briefly key                                               C-h c
Information about the binding of key is printed in the minibuffer.

help-help option                                                     C-h C-h
This command lists all  of the help options available and prompts  for which
one to  run.   Currently,  these include  only a to  run apropos,  b to  run
describe-bindings, and c to run describe-key-briefly.


10.2 Keyboard Macros

A keyboard macro  is a saved set of  commands from the keyboard that  can be
reexecuted later on.   There can only  be one keyboard macro defined  at any
one time.


                                     31







   The  commands  in  this section  are  available  unless  they  have  been
disabled by defining NOMACRO.

call-last-kbd-macro                                                    C-x e
Execute the saved keyboard macro.  A prefix argument  can be used to specify
a repetition count.

end-kbd-macro                                                          C-x )
start-kbd-macro                                                        C-x (

These functions  are used  to define  a keyboard  macro.   All keys  entered
after start-kbd-macro is executed, up to a end-kbd-macro,  are remembered as
they are executed.   You can then reexecute the same sequence  of operations
using call-last-kbd-macro.

10.3 Changing Case

MG provides a number of functions for changing the case of text.

capitalize-word                                                          M-c
downcase-region                                                      C-x C-l
downcase-word                                                            M-l
upcase-region                                                        C-x C-u
upcase-word                                                              M-u
All of these commands do the obvious.


10.4 Odds and Ends

This  section describes  miscellaneous  commands  that don't  fit  into  any
particular category.

emacs-version
Prints  information  about  the  version  of  MG  you  are  running  in  the
minibuffer.

meta-key-mode
If the particular  version of MG you are  running supports a meta key,  this
function can be used  to determine whether MG actually pays attention  to it
or not.    If no  prefix argument is  supplied, the  internal variable  that
controls the use  of the meta key is  toggled; a positive value  enables the
meta key, while a negative value disables it.




                                     32







prefix-region
set-prefix-string string
Prefix-region is  used to  prefix each  line of  the region  with a  string.
This is  useful for indenting  quoted text, making  block comments, and  the
like.  The function set-prefix-string can be used to  set the string used as
the prefix.

suspend-emacs                                                            C-z

This command  temporarily suspends MG  so that you  can run other  programs,
and later  resume editing.   The exact behavior  depends on which  operating
system you  are running MG  under.   Typically, MG will  either spawn a  new
shell as a subprocess, or return you to the parent process.

transpose-chars                                                          C-t
This command transposes the previous two characters.






























                                     33













Chapter 11




Customization



MG provides a limited  support for customization.  However,  unlike ``real''
Emacs,  there  is no  extension  language  for interpretively  defining  new
functions.

11.1 Key Bindings

MG  allows keys  to be  rebound  locally or  globally.    To understand  the
difference between the two, some discussion on how  modes are implemented is
necessary.
   An  internal data  structure  called a  keymap is  used  to look  up  the
function that  is bound to  a particular  key.   The keymap for  fundamental
mode contains all of the default bindings which are  listed with the command
descriptions  in this  manual.   Modes  define additional  keymaps that  are
searched  for a  binding before  the fundamental  mode  keymap is  examined.
Keymaps have the same name as the mode they are associated with.
   MG does not  provide commands for defining  new modes, but you can  alter
the keymaps for existing modes.

define-key keymap-name key command

This command can be used to modify the keymap for the named mode.

global-set-key key command
global-unset-key key
These  commands  modify   the  keymap  for  fundamental  mode.      Bindings
established by global-set-key will be inherited by all  other modes, as long
as they do not establish local rebindings of the same key.

local-set-key key command


                                     34







local-unset-key key
These commands modify the keymap currently in effect.


11.2 Startup Files

Although MG does  not include a general-purpose extension language,  it does
provide  a way  to read  and evaluate  commands using  a somewhat  different
syntax than that  used for executing extended  commands.  This is  typically
used in a startup file to modify key bindings.
   A startup  file consists  of one or  more expressions.   Each  expression
must appear  on a  separate line in  the file;  there may  not be more  than
one  expression per  line,  nor may  expressions  span across  line  breaks.
Whitespace (spaces  and tabs)  separate the tokens  in an  expression.   For
historical  reasons, parentheses  are also  considered to  be whitespace  in
this context.  A semicolon acts as a comment character,  causing the rest of
the line to be discarded.
   An expression  consists of a function  name, an optional prefix  argument
(given as an integer constant), and arguments to be  passed to the function.
If an argument  includes literal whitespace or nonprintable  characters (for
example, as  in a  keystroke argument to  one of  the key binding  functions
described  in  the previous  section),  it  must  be supplied  as  a  string
constant enclosed in double quotes.
   Within string  constants, the following  backslash escapes are  available
to specify nonprintable characters:

nt, nT          Tab

nn, nN          Newline

nr, nR          Carriage return

ne, nE          Escape (Meta prefix)

n^              Control prefix

nn              Specifies a character by its ASCII code, where n may consist
                of from one to three octal digits

nfn, nFn        Specifies the  keycode for  the nth  function  key.   N  may
                consist of one or two decimal digits.

   The  following commands  which deal  with evaluation  of expressions  are
disabled by defining the compile-time option NOSTARTUP.


                                     35







   The  Rutgers Sun  version  will attempt  to  read two  different  startup
files,  a  general  startup  file  and  a  terminal-specific  startup  file.
The  terminal-specific startup  file  is intended  primarily to  define  the
keypad.     The  general  startup  file  is  .mg  in  your  home  directory.
If  there  is  no such  file,  /usr/local/lib/mg/mg  will  be  used.     The
terminal-specific startup file  is .mg-TYPE, where TYPE represents  the name
of  the terminal  type.   E.g  if your  terminal type  is set  to vt100,  MG
will  read a  file  .mg-vt100.   If  there  is no  such  file, it  will  try
/usr/local/lib/mg/mg-vt100.   Files  should exist  in /usr/local/lib/mg  for
the terminal types commonly in use at Rutgers.
   For  other versions,  see the  implementation notes  for your  particular
version of MG for information on how it handles startup files.

eval-current-buffer
Evaluate the expressions in the current buffer.

eval-expression expression

Evaluate the expression supplied.

load file-name
Read in the specified file and evaluate its contents.
























                                     36








Fundamental Mode Key Bindings
NUL       set-mark-command             C-x C-o   delete-blank-lines
C-a       beginning-of-line            C-x C-s   save-buffer
C-b       backward-char                C-x C-u   upcase-region
C-d       delete-char                  C-x C-w   write-file
C-e       end-of-line                  C-x C-x   exchange-point-and-mark
C-f       forward-char                 C-x (     start-kbd-macro
C-g       keyboard-quit                C-x )     end-kbd-macro
C-h       help                         C-x 0     delete-window
TAB       self-insert-command          C-x 1     delete-other-windows
C-j       newline-and-indent           C-x 2     split-window-vertically
C-k       kill-line                    C-x 4     c-x 4 prefix
C-l       recenter                     C-x =     what-cursor-position
RET       newline                      C-x ^     enlarge-window
C-n       next-line                    C-x b     switch-to-buffer
C-o       open-line                    C-x d     dired
C-p       previous-line                C-x e     call-last-kbd-macro
C-q       quoted-insert                C-x f     set-fill-column
C-r       isearch-backward             C-x i     insert-file
C-s       isearch-forward              C-x k     kill-buffer
C-t       transpose-chars              C-x o     other-window
C-u       universal-argument           C-x s     save-some-buffers
C-v       scroll-up                    C-x 4 C-f find-file-other-window
C-w       kill-region                  C-x 4 C-g keyboard-quit
C-x       c-x prefix                   C-x  4 b      switch-to-buffer-other-
C-y       yank                         window
C-z       suspend-emacs                C-x 4 f   find-file-other-window
ESC       meta prefix
SPC .. ~  self-insert-command          M-C-g     keyboard-quit
DEL       delete-backward-char         M-C-v     scroll-other-window
                                       M-SPC     just-one-space
C-h C-g   keyboard-quit                M-%       query-replace
C-h C-h   help-help                    M--       negative-argument
C-h a     apropos                      M-0       digit-argument
C-h b     describe-bindings            M-1       digit-argument
C-h c     describe-key-briefly         M-2       digit-argument
                                       M-3       digit-argument
C-x C-b   list-buffers                 M-4       digit-argument
C-x C-c   save-buffers-kill-emacs      M-5       digit-argument
C-x C-f   find-file                    M-6       digit-argument
C-x C-g   keyboard-quit                M-7       digit-argument
C-x C-l   downcase-region              M-8       digit-argument



                                     37







M-9       digit-argument
M-<       beginning-of-buffer
M->       end-of-buffer
M-[       backward-paragraph
M-\       delete-horizontal-space
M-]       forward-paragraph
M-b       backward-word
M-c       capitalize-word
M-d       kill-word
M-f       forward-word
M-l       downcase-word
M-q       fill-paragraph
M-r       search-backward
M-s       search-forward
M-u       upcase-word
M-v       scroll-down
M-w       copy-region-as-kill
M-x       execute-extended-command
M-~       not-modified
M-DEL     backward-kill-word


























                                     38











Index



apropos .......................  31      dired-other-window ............  30
auto-fill-mode ................  27      dired-rename-file .............  30
auto-indent-mode ..............  28      dired-unflag ..................  30
backward-char ..................  9      downcase-region ...............  32
backward-kill-word ............  14      downcase-word .................  32
backward-paragraph .............  9      emacs-version .................  32
backward-word ..................  9      end-kbd-macro .................  32
beginning-of-buffer ............  9      end-of-buffer ..................  9
beginning-of-line ..............  9      end-of-line ...................  10
blink-matching-paren ..........  28      enlarge-window ................  21
blink-matching-paren-hack .....  28      eval-current-buffer ...........  36
call-last-kbd-macro ...........  32      eval-expression ...............  36
capitalize-word ...............  32      exchange-point-and-mark .......  10
cd ............................  25      execute-extended-command .......  8
copy-region-as-kill ...........  14      fill-paragraph ................  27
count-matches .................  19      find-file .....................  24
count-non-matches .............  19      find-file-other-window ........  24
define-key ....................  34      forward-char ..................  10
delete-backward-char ..........  14      forward-paragraph .............  10
delete-blank-lines ............  14      forward-word ..................  10
delete-char ...................  14      global-set-key ................  34
delete-horizontal-space .......  15      global-unset-key ..............  34
delete-matching-lines .........  19      goto-line .....................  10
delete-non-matching-lines .....  19      help-help .....................  31
delete-other-windows ..........  21      insert ........................  12
delete-window .................  21      insert-buffer .................  23
describe-bindings .............  31      insert-file ...................  24
describe-key-briefly ..........  31      insert-with-wrap ..............  27
digit-argument .................  8      isearch-backward ..............  16
dired .........................  29      isearch-forward ...............  16
dired-backup-unflag ...........  29      just-one-space ................  15
dired-copy-file ...............  29      keyboard-quit ..................  8
dired-do-deletions ............  29      kill-buffer ...................  23
dired-find-file ...............  29      kill-line .....................  15
dired-find-file-other-window ..  29      kill-paragraph ................  15
dired-flag-file-deleted .......  29      kill-region ...................  15


                                     39







kill-word .....................  15      set-prefix-string .............  33
list-buffers ..................  23      shrink-window .................  22
load ..........................  36      space-to-tabstop ..............  26
local-set-key .................  34      split-window-vertically .......  22
local-unset-key ...............  35      start-kbd-macro ...............  32
make-backup-files .............  25      suspend-emacs .................  33
meta-key-mode .................  32      switch-to-buffer ..............  24
negative-argument ..............  8      switch-to-buffer-other-window .  24
newline .......................  12      transpose-chars ...............  33
newline-and-indent ............  12      universal-argument .............  8
next-line .....................  10      upcase-region .................  32
no-tab-mode ...................  26      upcase-word ...................  32
not-modified ..................  24      what-cursor-position ..........  11
open-line .....................  12      write-file ....................  25
other-window ..................  21      yank .........................  15
overwrite-mode ................  27
prefix-region .................  33
previous-line .................  10
previous-window ...............  22
pwd ...........................  25
query-replace .................  17
query-replace-regexp ..........  19
quoted-insert .................  12
re-search-again ...............  20
re-search-backward ............  20
re-search-forward .............  20
recenter ......................  10
redraw-display ................  11
save-buffer ...................  24
save-buffers-kill-emacs .......  24
save-some-buffers .............  25
scroll-down ...................  11
scroll-one-line-down ..........  11
scroll-one-line-up ............  11
scroll-other-window ...........  11
scroll-up .....................  11
search-again ..................  17
search-backward ...............  17
search-forward ................  17
self-insert-command ...........  13
set-case-fold-search ..........  20
set-default-mode ..............  26
set-fill-column ...............  27
set-mark-command ..............  11


                                     40