File: custom.texi

package info (click to toggle)
emacs-manual-ja 20.5-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,964 kB
  • ctags: 12
  • sloc: lisp: 119; ansic: 69; makefile: 43; sh: 28
file content (3832 lines) | stat: -rw-r--r-- 193,561 bytes parent folder | download
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
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
@c =============================================================
@c = $B85(B $BK](B $BLu(B: $B5WLnLw!wBgDM(B.$BC^GHBg3X(B
@c = $B2CI.=$@5(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1998/11/25
@c = 20.4$B2~D{(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1999/09/13
@c =============================================================
@c This is part of the Emacs manual.
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Customization, Quitting, Amusements, Top
@c @chapter Customization
@c @cindex customization
@chapter $B%+%9%?%^%$%:(B
@cindex $B%+%9%?%^%$%:(B

@c   This chapter talks about various topics relevant to adapting the
@c behavior of Emacs in minor ways.  See @cite{The Emacs Lisp Reference
@c Manual} for how to make more far-reaching changes.
$BK\>O$G$O!"(BEmacs$B$NF0:n$r!J$"$^$jBgI}$G$J$/!K%+%9%?%^%$%:$9$kJ}K!$K(B
$B$D$$$F@bL@$7$^$9!#(B
$B$b$C$HBgI}$JJQ99$r9T$$$?$$>l9g$K$O(B
@cite{The Emacs Lisp Reference Manual}$B$r;2>H$7$F$/$@$5$$!#(B

@c   All kinds of customization affect only the particular Emacs session
@c that you do them in.  They are completely lost when you kill the Emacs
@c session, and have no effect on other Emacs sessions you may run at the
@c same time or later.  The only way an Emacs session can affect anything
@c outside of it is by writing a file; in particular, the only way to make
@c a customization ``permanent'' is to put something in your @file{.emacs}
@c file or other appropriate file to do the customization in each session.
@c @xref{Init File}.
$B%+%9%?%^%$%:$O!"(BEmacs$B$N(B1$B$D$N%;%C%7%g%s$NCf$@$1$G8z2L$r;}$A$^$9!#(B
Emacs$B$r=*N;$9$k$H%+%9%?%^%$%:$N8z2L$O<:$o$l$^$9$7!"(B
$BF1;~$K$"$k$$$O$"$H$GJL$N(BEmacs$B$rN)$A>e$2$?>l9g$K$b2?$N1F6A$b5Z$\$7$^$;$s!#(B
$B$"$k(BEmacs$B$N%;%C%7%g%s$,%;%C%7%g%s$rD6$($F1F6A$9$k$?$a$K$O!"(B
$B%U%!%$%k$K=q$/$7$+$"$j$^$;$s!#(B
$BFC$K!"%+%9%?%^%$%:$r!X915W2=!Y$7$?$$>l9g$K$O!"(B
$B8D?M$N(B@file{.emacs}$B%U%!%$%k$d(B
$B$=$NB>$N4XO"$9$k%U%!%$%k$KE,@Z$JFbMF$r=q$-9~$s$G$*$-!"(B
$B%;%C%7%g%s$4$H$K%+%9%?%^%$%:$,9T$o$l$k$h$&$K$7$^$9!#(B
@xref{Init File}$B!#(B

@menu
* Minor Modes::		Each minor mode is one feature you can turn on
			  independently of any others.
* Variables::		Many Emacs commands examine Emacs variables
			  to decide what to do; by setting variables,
			  you can control their functioning.
* Keyboard Macros::	A keyboard macro records a sequence of
			  keystrokes to be replayed with a single
			  command. 
* Key Bindings::	The keymaps say what command each key runs.
			  By changing them, you can "redefine keys".
* Keyboard Translations::
                        If your keyboard passes an undesired code
			   for a key, you can tell Emacs to
			   substitute another code. 
* Syntax::		The syntax table controls how words and
			   expressions are parsed.
* Init File::		How to write common customizations in the
			  @file{.emacs} file. 
@end menu

@node Minor Modes
@c @section Minor Modes
@c @cindex minor modes
@c @cindex mode, minor
@section $B%^%$%J%b!<%I!J(Bminor mode$B!K(B
@cindex $B%^%$%J%b!<%I!J(Bminor mode$B!K(B
@cindex $B%b!<%I!"%^%$%J(B

@c   Minor modes are optional features which you can turn on or off.  For
@c example, Auto Fill mode is a minor mode in which @key{SPC} breaks lines
@c between words as you type.  All the minor modes are independent of each
@c other and of the selected major mode.  Most minor modes say in the mode
@c line when they are on; for example, @samp{Fill} in the mode line means
@c that Auto Fill mode is on.
$B%^%$%J%b!<%I$O!"8DJL$K%*%s!?%*%U2DG=$J5!G=$G$9!#(B
$B$?$H$($P!"%^%$%J%b!<%I$G$"$k<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$r%*%s$K$9$k$H!"(B
@key{SPC}$B$G<+F0E*$K!JC18l$N@Z$lL\$G!K9TJ,$1$7$^$9!#(B
$B$9$Y$F$N%^%$%J%b!<%I$O8_$$$KFHN)$G$9$7!"(B
$B$I$N%a%8%c!<%b!<%I$H$bFHN)$G$9!#(B
$B$[$H$s$I$N%^%$%J%b!<%I$O!"$=$l$,%*%s$G$"$k$3$H$r%b!<%I9T$KI=<($7$^$9!#(B
$B$?$H$($P!"%b!<%I9T$K(B@samp{Fill}$B$HI=<($5$l$F$$$l$P!"(B
$B<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$,%*%s$G$"$k$3$H$r0UL#$7$^$9!#(B

@c   Append @code{-mode} to the name of a minor mode to get the name of a
@c command function that turns the mode on or off.  Thus, the command to
@c enable or disable Auto Fill mode is called @kbd{M-x auto-fill-mode}.  These
@c commands are usually invoked with @kbd{M-x}, but you can bind keys to them
@c if you wish.  With no argument, the function turns the mode on if it was
@c off and off if it was on.  This is known as @dfn{toggling}.  A positive
@c argument always turns the mode on, and an explicit zero argument or a
@c negative argument always turns it off.
$B%^%$%J%b!<%IL>$N$&$7$m$K(B@code{-mode}$B$rIU$12C$($k$H!"(B
$B$=$N%b!<%I$r%*%s!?%*%U$9$k%3%^%s%I4X?t$NL>A0$K$J$j$^$9!#(B
$B$7$?$,$C$F!"<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$r%*%s!?%*%U$9$k%3%^%s%I$O(B
@kbd{M-x auto-fill-mode}$B$H$$$&$3$H$K$J$j$^$9!#(B
$B$3$l$i$N%3%^%s%I$ODL>o(B@kbd{M-x}$B$r;H$C$F5/F0$7$^$9$,!"(B
$B$I$l$+$N%-!<$K%P%$%s%I$9$k$3$H$b$G$-$^$9!#(B
$B0z?t$r;XDj$7$J$$$H!"$3$l$i$N%3%^%s%I$O%b!<%I$,%*%U$N$H$-$O%*%s$K!"(B
$B%*%s$N$H$-$O%*%U$K@Z$jBX$($^$9!#(B
$B$3$l$r(B@dfn{$B%H%0%k$9$k(B}$B$H8F$S$^$9!#(B
$B$3$l$KBP$7!"@5$N0z?t$r;XDj$9$k$H$D$M$K%b!<%I$r%*%s$K$7$^$9$7!"(B
$BL@<(E*$K(B0$B$N0z?t$r;XDj$9$k$+!"$^$?$OIi$N0z?t$r;XDj$9$k$H(B
$B$D$M$K%b!<%I$r%*%U$K$7$^$9!#(B

@c   Enabling or disabling some minor modes applies only to the current
@c buffer; each buffer is independent of the other buffers.  Therefore, you
@c can enable the mode in particular buffers and disable it in others.  The
@c per-buffer minor modes include Abbrev mode, Auto Fill mode, Auto Save
@c mode, Font-Lock mode, Hscroll mode, ISO Accents mode, Outline minor
@c mode, Overwrite mode, and Binary Overwrite mode.
$B$$$/$D$+$N%^%$%J%b!<%I$N%*%s!?%*%U$O!"%+%l%s%H%P%C%U%!$KBP$7$F$N$_E,MQ$5$l!"(B
$BB>$N%P%C%U%!$K$O1F6A$7$^$;$s!#(B
$B$D$^$j!"$"$k%P%C%U%!$G$"$k%b!<%I$r%*%s$K$7!"(B
$BJL$N%P%C%U%!$G$O$=$N%b!<%I$r%*%U$K$G$-$k$o$1$G$9!#(B
$B$3$N$h$&$J!"%P%C%U%!$4$H$K%*%s!?%*%U$G$-$k%^%$%J%b!<%I$H$7$F$O!"(B
$BN,8l!J(Babbrev$B!K%b!<%I!"<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I!"(B
$B<+F0J]B8!J(Bauto-save$B!K%b!<%I!"%U%)%s%H%m%C%/!J(Bfont-lock$B!K%b!<%I!"(B
ISO$B%"%/%;%s%H!J(Biso-sccents$B!K%b!<%I!"%"%&%H%i%$%s!J(Boutline$B!K%^%$%J%b!<%I!"(B
$B>e=q$-!J(Boverwrite$B!K%b!<%I!"%P%$%J%j>e=q$-!J(Bbinary-overwrite$B!K%b!<%I$,$"$j$^$9!#(B

@c   Abbrev mode allows you to define abbreviations that automatically expand
@c as you type them.  For example, @samp{amd} might expand to @samp{abbrev
@c mode}.  @xref{Abbrevs}, for full information.
$BN,8l!J(Babbrev$B!K%b!<%I$G$O!"(B
$BN,8l$rBG$A9~$`$H<+F0E*$KE83+$5$l$k$h$&$JN,8l$rDj5A$G$-$^$9!#(B
$B$?$H$($P!"(B@samp{amd}$B$r(B@samp{abbrev mode}$B$HE83+$5$;$^$9!#(B
$B>\$7$/$O!"(B@xref{Abbrevs}$B!#(B

@c   Auto Fill mode allows you to enter filled text without breaking lines
@c explicitly.  Emacs inserts newlines as necessary to prevent lines from
@c becoming too long.  @xref{Filling}.
$B<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$G$O!"$$$A$$$A2~9T$G9TJ,$1$7$J$/$F$b(B
$B%F%-%9%H$r5M$a9~$s$GF~NO$G$-$^$9!#(B
$B9T$,D9$/$J$j$9$.$J$$$h$&$K(BEmacs$B$,E,592~9T$rA^F~$7$^$9!#(B
@xref{Filling}$B!#(B

@c   Auto Save mode causes the contents of a buffer to be saved
@c periodically to reduce the amount of work you can lose in case of a
@c system crash.  @xref{Auto Save}.
$B<+F0J]B8!J(Bauto-save$B!K%b!<%I$O%P%C%U%!$NFbMF$rDj4|E*$KJ]B8$9$k$3$H$G!"(B
$B%7%9%F%`%/%i%C%7%e$,5/$-$?$H$-J6<:$7$F$7$^$&:n6H$NNL$r>/$J$/$7$^$9!#(B
@xref{Auto Save}$B!#(B

@c   Enriched mode enables editing and saving of formatted text.
@c @xref{Formatted Text}.
$B%(%s%j%C%A!J(Benriched$B!K%b!<%I$O!"@07A:Q$_%F%-%9%H$NJT=8$r2DG=$K$7$^$9!#(B
@xref{Formatted Text}$B!#(B

@c   Flyspell mode automatically highlights misspelled words.
@c @xref{Spelling}.
$B%U%i%$%9%Z%k!J(Bflyspell$B!K%b!<%I$O!"(B
$BDV$j$K8m$j$N$"$kC18l$r<+F0E*$K6/D4I=<($7$^$9!#(B

@c   Font-Lock mode automatically highlights certain textual units found in
@c programs, such as comments, strings, and function names being defined.
@c This requires a window system that can display multiple fonts.
@c @xref{Faces}.
$B%U%)%s%H%m%C%/!J(Bfont-lock$B!K%b!<%I$O!"%3%a%s%H!"J8;zNs!"Dj5ACf$N4X?tL>$J$I$N(B
$B%W%m%0%i%`Cf$N7h$^$C$?C10L$r<+F0E*$K6/D4I=<($7$^$9!#(B
$B$3$l$K$O!"J#?t$N%U%)%s%H$rI=<($G$-$k%&%#%s%I%&%7%9%F%`$,I,MW$G$9!#(B
@xref{Faces}$B!#(B

@c   Hscroll mode performs horizontal scrolling automatically
@c to keep point on the screen.  @xref{Horizontal Scrolling}.
$B?eJ?%9%/%m!<%k!J(Bhscroll$B!K%b!<%I$O!"%]%$%s%H$,2hLLFb$KN1$^$k$h$&$K!"(B
$B<+F0E*$K?eJ?%9%/%m!<%k$r9T$$$^$9!#(B
@xref{Horizontal Scrolling}$B!#(B

@c   ISO Accents mode makes the characters @samp{`}, @samp{'}, @samp{"},
@c @samp{^}, @samp{/} and @samp{~} combine with the following letter, to
@c produce an accented letter in the ISO Latin-1 character set.
@c @xref{Single-Byte European Support}.
ISO$B%"%/%;%s%H!J(Biso-accents$B!K%b!<%I$O!"(B@samp{`}$B!"(B@samp{'}$B!"(B @samp{"}$B!"(B
@samp{^}$B!"(B@samp{/}$B!"(B@samp{~}$B$H$3$l$i$KB3$/$D$.$NJ8;z$r7k9g$7$F!"(B
ISO Latin-1$BJ8;z=89g$N%"%/%;%s%HIU$-J8;z$r:n$j=P$7$^$9!#(B
@xref{Single-Byte European Support}$B!#(B

@c   Outline minor mode provides the same facilities as the major mode
@c called Outline mode; but since it is a minor mode instead, you can
@c combine it with any major mode.  @xref{Outline Mode}.
$B%"%&%H%i%$%s%^%$%J!J(Boutline-minor$B!K%b!<%I$O!"%a%8%c!<%b!<%I$G$"$k(B
$B%"%&%H%i%$%s!J(Boutline$B!K%b!<%I$HF1$85!G=$rDs6!$7$^$9!#(B
$B$7$+$7!"%^%$%J%b!<%I$J$N$GG$0U$N%a%8%c!<%b!<%I$H0l=o$K;H$($^$9!#(B
@xref{Outline Mode}$B!#(B

@c @cindex Overwrite mode
@c @cindex mode, Overwrite
@cindex $B>e=q$-%b!<%I!J(BOverwrite mode$B!K(B
@cindex $B%b!<%I!"(BOverwrite
@findex overwrite-mode
@findex binary-overwrite-mode
@c   Overwrite mode causes ordinary printing characters to replace existing
@c text instead of shoving it to the right.  For example, if point is in
@c front of the @samp{B} in @samp{FOOBAR}, then in Overwrite mode typing a
@c @kbd{G} changes it to @samp{FOOGAR}, instead of producing @samp{FOOGBAR}
@c as usual.  In Overwrite mode, the command @kbd{C-q} inserts the next
@c character whatever it may be, even if it is a digit---this gives you a
@c way to insert a character instead of replacing an existing character.
$B>e=q$-!J(Boverwrite$B!K%b!<%I$G$O!"F~NO$5$l$??^7AJ8;z$O4{B8$NJ8;z$r1&$K2!$7$d$k(B
$B$+$o$j$K$=$NJ8;z$rCV$-49$($^$9!#(B
$B$?$H$($P!"%]%$%s%H$,(B@samp{FOOBAR}$B$N(B@samp{B}$B$N$^$($K$"$k$H$-$K(B
@kbd{G}$B$rBG$D$H(B@samp{FOOGAR}$B$H$J$j$^$9!#(B
$BDL>o$N%b!<%I$G$"$l$P(B@samp{FOOGBAR}$B$H$J$j$^$9!#(B
$B>e=q$-!J(Boverwrite$B!K%b!<%I$G%3%^%s%I(B@kbd{C-q}$B$rBG$D$H!"(B
$B$=$N$D$.$NJ8;z$,2?$G$"$C$F$b!J?t;z$G$"$C$F$b!K$=$NJ8;z$rA^F~$7$^$9!#(B
$B$D$^$j!">e=q$-!J(Boverwrite$B!K%b!<%I$NCf$GJ8;z$rA^F~$9$k$K$O(B
$B$3$NJ}K!$r;H$$$^$9!#(B

@c   Binary Overwrite mode is a variant of Overwrite mode for editing
@c binary files; it treats newlines and tabs like other characters, so that
@c they overwrite other characters and can be overwritten by them.
$B%P%$%J%j>e=q$-!J(Bbinary-overwrite$B!K%b!<%I$O>e=q$-!J(Boverwrite$B!K%b!<%I$NJQ7A$G!"(B
$B%P%$%J%j%U%!%$%kJT=8MQ$G$9!#(B
$B$3$N%b!<%I$G$O!"2~9T$d%?%V$bB>$NJ8;z$HF1$8$K07$o$l$k$N$G!"(B
$BB>$NJ8;z$r$3$l$i$NJ8;z$G>e=q$-$9$k$3$H$b!"(B
$B$3$l$i$NJ8;z$rB>$NJ8;z$G>e=q$-$9$k$3$H$b$G$-$^$9!#(B

@c   The following minor modes normally apply to all buffers at once.
@c Since each is enabled or disabled by the value of a variable, you
@c @emph{can} set them differently for particular buffers, by explicitly
@c making the corresponding variables local in those buffers.
@c @xref{Locals}.
$B0J2<$G@bL@$9$k%^%$%J%b!<%I$O!"$9$Y$F$N%P%C%U%!$K0l@F$KE,MQ$5$l$^$9!#(B
$B$?$@$7!"$3$l$i$OJQ?t$NCM$K1~$8$F%*%s!?%*%U$5$l$^$9$+$i!"(B
$B$=$NJQ?t$r%P%C%U%!$K%m!<%+%k$JJQ?t$K$9$l$P!"(B
$B%P%C%U%!$4$H$KFHN)$K%*%s!?%*%U$9$k$3$H$b2DG=$G$9!#(B
@xref{Locals}$B!#(B

@c   Icomplete mode displays an indication of available completions when
@c you are in the minibuffer and completion is active.  @xref{Completion
@c Options}.
$BJd40<(:6!J(Bicomplete$B!K%b!<%I$O!"%_%K%P%C%U%!$GF~NOCf$KJd405!G=$,F/$$$F$$$k$H$-!"(B
$B$I$N$h$&$JJd408uJd$,$"$k$+$rI=<($7$^$9!#(B
@xref{Completion Options}$B!#(B

@c   Line Number mode enables continuous display in the mode line of the
@c line number of point.  @xref{Mode Line}.
$B9THV9f!J(Bline-number$B!K%b!<%I$O!"(B
$B%]%$%s%H$N$"$k9T$N9THV9f$r@d$($:%b!<%I9T$KI=<($7$^$9!#(B
@xref{Mode Line}$B!#(B

@c   Resize-Minibuffer mode makes the minibuffer expand as necessary to
@c hold the text that you put in it.  @xref{Minibuffer Edit}.
$B%_%K%P%C%U%!%j%5%$%:!J(Bresize-minibuffer$B!K%b!<%I$O!"(B
$BBG$A9~$s$@%F%-%9%HNL$K1~$8$F<+F0E*$K%_%K%P%C%U%!$r9-$2$^$9!#(B
@xref{Minibuffer Edit}$B!#(B

@c   Scroll Bar mode gives each window a scroll bar (@pxref{Scroll Bars}).
@c Menu Bar mode gives each frame a menu bar (@pxref{Menu Bars}).  Both of
@c these modes are enabled by default when you use the X Window System.
$B%9%/%m!<%k%P!<!J(Bscroll-bar$B!K%b!<%I$O!"3F%&%#%s%I%&$K%9%/%m!<%k%P!<$rIU$1$^$9(B
$B!J(B@pxref{Scroll Bars}$B!K!#(B
$B%a%K%e!<%P!<!J(Bmenu-bar$B!K%b!<%I$O!"3F%U%l!<%`$K%a%K%e!<%P!<$rIU$1$^$9(B
$B!J(B@pxref{Menu Bars}$B!K!#(B
$B$I$A$i$N%b!<%I$b!"(BX$B%&%#%s%I%&%7%9%F%`$r;H$C$F$$$k$H$-$O(B
$B%G%U%)%k%H$G%*%s$K$J$C$F$$$^$9!#(B

@c   In Transient Mark mode, every change in the buffer contents
@c ``deactivates'' the mark, so that commands that operate on the region
@c will get an error.  This means you must either set the mark, or
@c explicitly ``reactivate'' it, before each command that uses the region.
@c The advantage of Transient Mark mode is that Emacs can display the
@c region highlighted (currently only when using X).  @xref{Setting Mark}.
$B;CDj%^!<%/!J(Btransient-mark$B!K%b!<%I$G$O!"(B
$B%P%C%U%!$NFbMF$rJQ99$9$k$H%^!<%/$O!XIT3h@-!Y$K$J$k$N$G!"(B
$B$=$N$"$H$G%j!<%8%g%s$rBP>]$H$9$k%3%^%s%I$r;H$&$H%(%i!<$K$J$j$^$9!#(B
$B$D$^$j!"%j!<%8%g%s$rBP>]$H$9$k%3%^%s%I$r;H$&$^$($K!"(B
$B2~$a$F%^!<%/$r@_Dj$9$k$+!"IT3h@-$K$J$C$?%^!<%/$r!X:FEY3h@-!Y$K$7$^$9!#(B
$B;CDj%^!<%/!J(Btransient-mark$B!K%b!<%I$NMxE@$O!"(B
$B!J:#$N$H$3$m(BX$B%&%#%s%I%&%7%9%F%`$r;H$C$F$$$k$H$-$N$_!K(B
Emacs$B$,%j!<%8%g%s$r6/D4I=<($9$k$3$H$G$9!#(B
@xref{Setting Mark}$B!#(B

@c   For most minor modes, the command name is also the name of a variable
@c which directly controls the mode.  The mode is enabled whenever this
@c variable's value is non-@code{nil}, and the minor-mode command works by
@c setting the variable.  For example, the command
@c @code{outline-minor-mode} works by setting the value of
@c @code{outline-minor-mode} as a variable; it is this variable that
@c directly turns Outline minor mode on and off.  To check whether a given
@c minor mode works this way, use @kbd{C-h v} to ask for documentation on
@c the variable name.
$B$[$H$s$I$N%^%$%J%b!<%I$K$O!"%3%^%s%IL>$HF1$8L>A0$NJQ?t$,$"$j!"(B
$B$=$NJQ?t$G%b!<%I$rD>@\@)8f$7$F$$$^$9!#(B
$B$D$^$j!"$=$NJQ?t$NCM$,(B@code{nil}$B0J30$J$i%b!<%I$O%*%s$G$"$j!"(B
$B3F%^%$%J%b!<%I%3%^%s%I$OJQ?t$NCM$r@_Dj$9$kF0:n$r$7$^$9!#(B
$B$?$H$($P!"%3%^%s%I(B@code{outline-minor-mode}$B$O!"(B
$BJQ?t(B@code{outline-minor-mode}$B$NCM$r@_Dj$9$kF0:n$r9T$$$^$9!#(B
$B$D$^$j!"$3$NJQ?t$,!"D>@\!">e=q$-!J(Boverwrite$B!K%b!<%I$r%*%s!?%*%U$7$F$$$k$N$G$9!#(B
$B$"$k%^%$%J%b!<%I$,$3$N$h$&$KF0:n$9$k$+$I$&$+$O!"(B
@kbd{C-h v}$B$r;H$C$F$=$NJQ?t$N@bL@J8;zNs$r;2>H$7$F$/$@$5$$!#(B

@c   These minor-mode variables provide a good way for Lisp programs to turn
@c minor modes on and off; they are also useful in a file's local variables
@c list.  But please think twice before setting minor modes with a local
@c variables list, because most minor modes are matter of user
@c preference---other users editing the same file might not want the same
@c minor modes you prefer.
$B$3$l$i$N%^%$%J%b!<%IJQ?t$O!"(BLisp$B%W%m%0%i%`$+$i%b!<%I$r(B
$B%*%s!?%*%U$9$k$N$KM-MQ$G$9!#(B
$B$^$?!"%U%!%$%k$N%m!<%+%kJQ?t%j%9%H$H$7$F;XDj$9$k$N$bJXMx$G$9!#(B
$B$?$@$7!"%m!<%+%kJQ?t%j%9%H$G@_Dj$9$k>l9g$K$O!"$h$/9M$($F$/$@$5$$!#(B
$B$H$$$&$N$O!"$[$H$s$I$N%^%$%J%b!<%I$O%f!<%6!<$N9%$_$NLdBj$G$"$j!"(B
$BF1$8%U%!%$%k$rJT=8$9$kJL$N%f!<%6!<$O9%$_$,0c$&$+$b$7$l$^$;$s!#(B

@node Variables
@c @section Variables
@c @cindex variable
@c @cindex option, user
@c @cindex user option
@section $BJQ?t(B
@cindex $BJQ?t(B
@cindex $B%f!<%6!<%*%W%7%g%s(B

@c   A @dfn{variable} is a Lisp symbol which has a value.  The symbol's
@c name is also called the name of the variable.  A variable name can
@c contain any characters that can appear in a file, but conventionally
@c variable names consist of words separated by hyphens.  A variable can
@c have a documentation string which describes what kind of value it should
@c have and how the value will be used.
@dfn{$BJQ?t(B}$B$OCM$r;}$D(BLisp$B%7%s%\%k!J5-9f!K$G$9!#(B
$B$=$N%7%s%\%k$NL>A0$N$3$H$r!"JQ?tL>$H$b8F$S$^$9!#(B
$BJQ?tL>$O%U%!%$%k$KF~$l$i$l$k$I$N$h$&$JJ8;z$G$b4^$`$3$H$,$G$-$^$9$,!"(B
$B=,47E*$K$O!"JQ?tL>$O1QC18l$r%O%$%U%s$G$D$J$2$?$b$N$G$9!#(B
$BJQ?t$K$O!"$=$NJQ?t$,$I$N$h$&$JCM$r;}$A!"(B
$B$I$N$h$&$K;H$o$l$k$+$r5-=R$7$?@bL@J8;zNs$r;}$?$;$k$3$H$,$G$-$^$9!#(B

@c   Lisp allows any variable to have any kind of value, but most variables
@c that Emacs uses require a value of a certain type.  Often the value should
@c always be a string, or should always be a number.  Sometimes we say that a
@c certain feature is turned on if a variable is ``non-@code{nil},'' meaning
@c that if the variable's value is @code{nil}, the feature is off, but the
@c feature is on for @emph{any} other value.  The conventional value to use to
@c turn on the feature---since you have to pick one particular value when you
@c set the variable---is @code{t}.
Lisp$B$G$O$I$NJQ?t$K$I$N$h$&$JCM$G$b3JG<$G$-$^$9$,!"(B
Emacs$B$NCf$G$O$[$H$s$I$NJQ?t$O$I$N$h$&$JCM$r;}$D$+$,7h$^$C$F$$$^$9!#(B
$B$?$H$($P!"$"$kJQ?t$O$D$M$KJ8;zNs$G$"$k!"JL$NJQ?t$O?tCM$G$"$k$H$$$C$?$0$"$$$G$9!#(B
$B$^$?!"!V$3$l$3$l$N5!G=$O$3$NJQ?t$,(B@code{nil}$B0J30$N$H$-$K%*%s$K$J$k!W(B
$B$H$$$&$$$$J}$b$7$^$9!#(B
$B$=$N>l9g$O!"$=$NJQ?t$K(B@code{nil}$B$,3JG<$5$l$F$$$k$H$-$O$=$N5!G=$O%*%U$G$9$,!"(B
$B$=$l0J30$N(B@emph{$B$I$s$J(B}$BCM$,3JG<$5$l$F$$$k$H$-$G$b$=$N5!G=$O%*%s$K$J$j$^$9!#(B
$B$G$9$,!"$"$k5!G=$r%*%s$K$9$k$?$a$K;H$&CM$H$7$F(B
$B2?$+A*$P$J$1$l$P$J$j$^$;$s$+$i!"(B@code{t}$B$H$$$&CM$r;H$&$N$,=,47$G$9!#(B

@c   Emacs uses many Lisp variables for internal record keeping, as any
@c Lisp program must, but the most interesting variables for you are the
@c ones that exist for the sake of customization.  Emacs does not (usually)
@c change the values of these variables; instead, you set the values, and
@c thereby alter and control the behavior of certain Emacs commands.  These
@c variables are called @dfn{user options}.  Most user options are
@c documented in this manual, and appear in the Variable Index
@c (@pxref{Variable Index}).
Emacs$B$O0lHL$N(BLisp$B%W%m%0%i%`$HF1MM!"(B
$BFbIt$G>pJs$rJ];}$9$k$?$a$K?tB?$/$NJQ?t$r;H$$$^$9$,!"(B
$B%f!<%6!<$K$H$C$FFC$K6=L#?<$$JQ?t$H$$$&$N$O!"(B
$B$b$C$Q$i%+%9%?%^%$%:8~$1$KMQ0U$5$l$?JQ?t$@$H$$$($^$9!#(B
Emacs$B$O!JDL>o$O!K$=$N$h$&$JJQ?t$NCM$rJQ99$7$^$;$s!#(B
$B$+$o$j$K!"%f!<%6!<$,CM$r@_Dj$9$k$H!"(B
$B$=$NCM$K1~$8$F$5$^$6$^$J(BEmacs$B%3%^%s%I$N$U$k$^$$$r(B
$BJQ99$7$?$j@)8f$7$?$j$G$-$k$N$G$9!#(B
$B$3$l$i$NJQ?t$N$3$H$r(B@dfn{$B%f!<%6!<%*%W%7%g%s(B}$B$H$$$$$^$9!#(B
$B$[$H$s$I$N%f!<%6!<%*%W%7%g%s$O$3$N%^%K%e%"%k$K5-:\$7$F$"$j$^$9$7!"(B
$BJQ?t:w0z!J(B@pxref{Variable Index}$B!K$K$b5-:\$7$F$"$j$^$9!#(B

@c   One example of a variable which is a user option is @code{fill-column}, which
@c specifies the position of the right margin (as a number of characters from
@c the left margin) to be used by the fill commands (@pxref{Filling}).
$B%f!<%6!<%*%W%7%g%s$G$"$k$h$&$JJQ?t$NNc$H$7$F(B@code{fill-column}$B$,$"$j$^$9!#(B
$B$3$NJQ?t$O!"5M$a9~$_%3%^%s%I!J(B@pxref{Filling}$B!K$,;H$&(B
$B1&C<$N7e0LCV$r!J:8C<$+$i2?J8;z1&$+$rI=$9?tCM$H$7$F!KJ];}$7$^$9!#(B

@menu
* Examining::	        Examining or setting one variable's value.
* Easy Customization::
                        Convenient and easy customization of variables.
* Hooks::	        Hook variables let you specify programs for parts
		          of Emacs to run on particular occasions.
* Locals::	        Per-buffer values of variables.
* File Variables::      How files can specify variable values.
@end menu

@node Examining
@c @subsection Examining and Setting Variables
@c @cindex setting variables
@subsection $BJQ?t$N@_Dj$H;2>H(B
@cindex $BJQ?t$N@_Dj(B

@table @kbd
@item C-h v @var{var} @key{RET}
@c Display the value and documentation of variable @var{var}
@c (@code{describe-variable}).
$BJQ?t(B@var{var}$B$NCM$H@bL@J8;zNs$rI=<($9$k(B
$B!J(B@code{describe-variable}$B!K!#(B
@item M-x set-variable @key{RET} @var{var} @key{RET} @var{value} @key{RET}
@c Change the value of variable @var{var} to @var{value}.
$BJQ?t(B@var{var}$B$NCM$r(B@var{value}$B$KJQ99$9$k!#(B
@end table

@c   To examine the value of a single variable, use @kbd{C-h v}
@c (@code{describe-variable}), which reads a variable name using the
@c minibuffer, with completion.  It displays both the value and the
@c documentation of the variable.  For example,
$BFCDj$NJQ?t$NCM$r8+$k$K$O!"(B@kbd{C-h v}$B!J(B@code{describe-variables}$B!K$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"%_%K%P%C%U%!$GJd405!G=IU$-$GJQ?tL>$rFI$_<h$j$^$9!#(B
$BJQ?t$NCM$H@bL@J8;zNs$NAPJ}$rI=<($7$^$9!#(B
$B$?$H$($P!"(B

@example
C-h v fill-column @key{RET}
@end example

@noindent
@c displays something like this:
$B$H$9$k$H!"$D$.$N$h$&$KI=<($5$l$^$9!#(B

@smallexample
fill-column's value is 75

Documentation:
*Column beyond which automatic line-wrapping should happen.
Automatically becomes buffer-local when set in any fashion.
@end smallexample

@noindent
@c The star at the beginning of the documentation indicates that this
@c variable is a user option.  @kbd{C-h v} is not restricted to user
@c options; it allows any variable name.
$B@bL@J8$N@hF,$K$"$k(B@kbd{*}$B$O!"(B
$B$3$NJQ?t$,%f!<%6!<%*%W%7%g%s$G$"$k$3$H$r<($7$^$9!#(B
@kbd{C-h v}$B$O!"%f!<%6!<%*%W%7%g%s$K8B$i$:G$0U$NJQ?t$r07$($^$9!#(B

@findex set-variable
@c   The most convenient way to set a specific user option is with @kbd{M-x
@c set-variable}.  This reads the variable name with the minibuffer (with
@c completion), and then reads a Lisp expression for the new value using
@c the minibuffer a second time.  For example,
$B%f!<%6!<%*%W%7%g%s$r@_Dj$9$k$$$A$P$s4JC1$JJ}K!$O(B@kbd{M-x set-variable}$B$r(B
$B;H$&$3$H$G$9!#(B
$B$3$N%3%^%s%I$O!"$^$:%_%K%P%C%U%!$G!JJd405!G=IU$-$G!KJQ?tL>$rFI$_<h$j!"(B
$B$D$.$K%_%K%P%C%U%!$GJQ?t$K@_Dj$9$k(BLisp$B<0$rFI$_<h$j$^$9!#(B
$B$?$H$($P!"(B

@example
M-x set-variable @key{RET} fill-column @key{RET} 75 @key{RET}
@end example

@noindent
@c sets @code{fill-column} to 75.
$B$H$9$k$H!"(B@code{fill-column}$B$K(B75$B$r@_Dj$7$^$9!#(B

@c  @kbd{M-x set-variable} is limited to user option variables, but you can
@c set any variable with a Lisp expression, using the function @code{setq}.
@c Here is a @code{setq} expression to set @code{fill-column}:
@kbd{M-x set-variable}$B$O%f!<%6!<%*%W%7%g%s$KBP$7$F$@$1;H$($^$9!#(B
$B$3$l$KBP$7!"(B@code{setq}$B$r;H$($P$I$NJQ?t$K$G$bCM$,@_Dj$G$-$^$9!#(B
$B$?$H$($P!"(B@code{setq}$B$r;H$C$F(B@code{fill-column}$B$K(B
$B@_Dj$9$k$K$O$D$.$N$h$&$K$7$^$9!#(B

@example
(setq fill-column 75)
@end example

@c   To execute an expression like this one, go to the @samp{*scratch*}
@c buffer, type in the expression, and then type @kbd{C-j}.  @xref{Lisp
@c Interaction}.
$B$3$N$h$&$J<0$r<B9T$9$k$K$O!"(B@samp{*scratch*}$B%P%C%U%!$K$$$-!"(B
$B<0$rBG$A9~$s$G$+$i(B@kbd{C-j}$B$rBG$A$^$9!#(B
@xref{Lisp Interaction}$B!#(B

@c   Setting variables, like all means of customizing Emacs except where
@c otherwise stated, affects only the current Emacs session.
$BJQ?t$r@_Dj$9$k$3$H$O!"FC5-$7$F$$$J$$8B$j!"(B
$BB>$N%+%9%?%^%$%:J}K!$HF1MM$K!"8=:_$N(BEmacs$B%;%C%7%g%s$@$1$K1F6A$7$^$9!#(B

@node Easy Customization
@c @subsection Easy Customization Interface
@subsection $B4JJX$J%+%9%?%^%$%:J}K!(B

@findex customize
@c @cindex customization buffer
@cindex $B%+%9%?%^%$%:%P%C%U%!(B
@c   A convenient way to find the user option variables that you want to
@c change, and then change them, is with @kbd{M-x customize}.  This command
@c creates a @dfn{customization buffer} with which you can browse through
@c the Emacs user options in a logically organized structure, then edit and
@c set their values.  You can also use the customization buffer to save
@c settings permanently.  (Not all Emacs user options are included in this
@c structure as of yet, but we are adding the rest.)
$BJQ99$7$?$$%f!<%6!<%*%W%7%g%sJQ?t$r$_$D$1$FCM$rJQ99$9$kJXMx$JJ}K!$O!"(B
@kbd{M-x customize}$B$r;H$&$3$H$G$9!#(B
$B$3$N%3%^%s%I$O(B@dfn{$B%+%9%?%^%$%:%P%C%U%!(B}$B$r:n@.$7!"(B
$B$=$N%P%C%U%!Fb$G$OO@M}E*$J=g=x$KJB$Y$?(BEmacs$B$N%f!<%6!<%*%W%7%g%s$r(B
$BD/$a$F$^$o$k$3$H$,$G$-$^$9$7!"$5$i$KCM$rJT=8$7$F@_Dj$G$-$^$9!#(B
$B$^$?!"%+%9%?%^%$%:%P%C%U%!$r;H$($P@_Dj$r915WE*$J$b$N$H$7$F(B
$BJ]B8$b$G$-$^$9!#(B
$B!J$^$@$3$N5!G=$G07$($J$$%f!<%6!<%*%W%7%g%s$b$"$k$,!"(B
$B$=$l$i$b07$($k$h$&$K8=:_:n6HCf!#!K(B

@menu
* Groups: Customization Groups.
                             How options are classified in a structure.
* Changing an Option::       How to edit a value and set an option.
* Face Customization::       How to edit the attributes of a face.
* Specific Customization::   Making a customization buffer for specific
                                options, faces, or groups.
@end menu

@node Customization Groups
@c @subsubsection Customization Groups
@c @cindex customization groups
@subsubsection $B%+%9%?%^%$%:%0%k!<%W(B
@cindex $B%+%9%?%^%$%:%0%k!<%W(B

@c   For customization purposes, user options are organized into
@c @dfn{groups} to help you find them.  Groups are collected into bigger
@c groups, all the way up to a master group called @code{Emacs}.
$B%+%9%?%^%$%:$N$?$a$K!"%f!<%6!<%*%W%7%g%s$r(B@dfn{$B%0%k!<%W(B}$B$K(B
$B$^$H$a$F$_$D$1$d$9$/$7$F$"$j$^$9!#(B
$B%0%k!<%W$O$5$i$KBg$-$J%0%k!<%W$K$^$H$a$i$l$F$$$F!"(B
$B$$$A$P$sBg$-$J!J$9$Y$F$N%0%k!<%W$r4^$`!K%0%k!<%W$O(B
@code{Emacs}$B$H$$$&L>A0$G$9!#(B

@c   @kbd{M-x customize} creates a customization buffer that shows the
@c top-level @code{Emacs} group and the second-level groups immediately
@c under it.  It looks like this, in part:
@kbd{M-x customize}$B$O!"%H%C%W%l%Y%k$N(B@code{Emacs}$B%0%k!<%W(B
$B$*$h$S$=$ND>2<$N!JBh(B2$B%l%Y%k$N!K%0%k!<%W$rI=<($7$?(B
$B%+%9%?%^%$%:%P%C%U%!$r:n@.$7$^$9!#(B
$B$=$NI=<($O$D$.$N$h$&$K$J$j$^$9!#(B

@smallexample
/- Emacs group: ---------------------------------------------------\
      [State]: visible group members are all at standard settings.
   Customization of the One True Editor.
   See also [Manual].

Editing group: [Go to Group] 
Basic text editing facilities.

External group: [Go to Group] 
Interfacing to external utilities.

@var{more second-level groups}

\- Emacs group end ------------------------------------------------/

@end smallexample

@noindent
@c This says that the buffer displays the contents of the @code{Emacs}
@c group.  The other groups are listed because they are its contents.  But
@c they are listed differently, without indentation and dashes, because
@c @emph{their} contents are not included.  Each group has a single-line
@c documentation string; the @code{Emacs} group also has a @samp{[State]}
@c line.
$B$3$NI=<($N@hF,ItJ,$O!"(B
$B$3$N%P%C%U%!$,(B@code{Emacs}$B%0%k!<%W$NFbMF$rI=<($7$F$$$k$3$H$r5-$7$F$$$^$9!#(B
$B;D$j$N%0%k!<%W$,I=<($5$l$k$N$O!"(B
$B$=$l$i$,(B@code{Emacs}$B%0%k!<%W$K4^$^$l$F$$$k$+$i$G$9!#(B
$B$?$@$7!"$=$l$i$O;z2<$2$d!V(B-$B!W$J$7$GI=<($5$l$F$$$F!"(B
$BI=<($K$O$=$l$i$N%0%k!<%W$NFbMF$,4^$^$l$F$O(B@emph{$B$$$J$$(B}$B$3$H$r<($7$F$$$^$9!#(B
$B3F%0%k!<%W$NI=<($K$O(B1$B9T$N@bL@J8;zNs$,IU?o$7$F$$$^$9!#(B
$B$^$?!"(B@code{Emacs}$B%0%k!<%W$K$D$$$F$O(B@samp{[State]}$B9T$,IU?o$7$F$$$^$9!#(B

@c @cindex editable fields (customization buffer)
@c @cindex active fields (customization buffer)
@cindex $BJT=82DG=%U%#!<%k%I!J%+%9%?%^%$%:%P%C%U%!!K(B
@cindex $B%"%/%F%#%V%U%#!<%k%I!J%+%9%?%^%$%:%P%C%U%!!K(B
@c   Most of the text in the customization buffer is read-only, but it
@c typically includes some @dfn{editable fields} that you can edit.  There
@c are also @dfn{active fields}; this means a field that does something
@c when you @dfn{invoke} it.  To invoke an active field, either click on it
@c with @kbd{Mouse-1}, or move point to it and type @key{RET}.
$B%+%9%?%^%$%:%P%C%U%!Fb$N%F%-%9%H$N$[$H$s$I$OJQ99$G$-$^$;$s$,!"(B
$B0lItJ,$O(B@dfn{$BJT=82DG=%U%#!<%k%I(B}$B$K$J$C$F$$$F!"JQ99$G$-$^$9!#(B
$B$^$?!"(B@dfn{$B%"%/%F%#%V%U%#!<%k%I(B}$B$H$$$&!"(B
$B$=$N>l=j$r(B@dfn{$B5/F0(B}$B$9$k$H$J$s$i$+$NF0:n$r9T$&$h$&$J>l=j$b$"$j$^$9!#(B
$B%"%/%F%#%V%U%#!<%k%I$r5/F0$9$k$K$O!"(B
@kbd{Mouse-1}$B$G$=$3$r%/%j%C%/$9$k$+!"(B
$B$^$?$O$=$3$K%]%$%s%H$r;}$C$F$$$C$F(B@key{RET}$B$rBG$A$^$9!#(B

@c   For example, the phrase @samp{[Go to Group]} that appears in a
@c second-level group is an active field.  Invoking the @samp{[Go to
@c Group]} field for a group creates a new customization buffer, which
@c shows that group and its contents.  This field is a kind of hypertext
@c link to another group.
$B$?$H$($P!"Bh(B2$B%l%Y%k%0%k!<%WCf$N(B@samp{[Go to Group]}$B$H5-$5$l$?ItJ,$O(B
$B%"%/%F%#%V%U%#!<%k%I$G$9!#(B
@samp{[Go to Group]}$B$N%U%#!<%k%I$r5/F0$9$k$H!"(B
$B$=$N%0%k!<%W$H$=$N%0%k!<%W$NFbMF$rI=<($9$k(B
$B?7$7$$%+%9%?%^%$%:%P%C%U%!$,:n$i$l!"(B
$B$=$N%0%k!<%W$HCf?H$,I=<($5$l$^$9!#(B
$B$3$N%U%#!<%k%I$OB>$N%0%k!<%W$X$N%O%$%Q!<%F%-%9%H%j%s%/$N0l<o$G$9!#(B

@c   The @code{Emacs} group does not include any user options itself, but
@c other groups do.  By examining various groups, you will eventually find
@c the options and faces that belong to the feature you are interested in
@c customizing.  Then you can use the customization buffer to set them.
@code{Emacs}$B%0%k!<%W$=$N$b$N$O%f!<%6!<%*%W%7%g%s$r(B1$B$D$b4^$s$G$$$^$;$s$,!"(B
$BB>$N%0%k!<%W$K$O$"$j$^$9!#(B
$B$5$^$6$^$J%0%k!<%W$rD/$a$F$_$k$H!"(B
$B6=L#$r;}$C$F%+%9%?%^%$%:$7$F$_$h$&$H;W$&$h$&$J5!G=$KB0$9$k(B
$B%*%W%7%g%s$d%U%'%$%9$r$_$D$1$k$3$H$,$G$-$k$G$7$g$&!#(B

@findex customize-browse
@c   You can view the structure of customization groups on a larger scale
@c with @kbd{M-x customize-browse}.  This command creates a special kind of
@c customization buffer which shows only the names of the groups (and
@c options and faces), and their structure.
$B%+%9%?%^%$%:%0%k!<%W72$N9=B$$r354Q$9$k$K$O!"(B
@kbd{M-x customize-browse}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"%0%k!<%WL>!J$H%*%W%7%g%s$d%U%'%$%9!K$H(B
$B$=$l$i$N9=B$$@$1$rI=<($9$kFCJL$J%+%9%?%^%$%:%P%C%U%!$r:n$j$^$9!#(B

@c   In this buffer, you can show the contents of a group by invoking
@c @samp{[+]}.  When the group contents are visible, this button changes to
@c @samp{[-]}; invoking that hides the group contents.
$B$3$N%P%C%U%!Cf$G$O!"%0%k!<%W$NCf?H$r8+$k$K$O(B@samp{[+]}$B$N$H$3$m$r5/F0$7$^$9!#(B
$B%0%k!<%W$NCf?H$,8+$($k$h$&$K$J$k$H!"$3$N%\%?%s$O(B@samp{[-]}$B$KJQ$o$j$^$9!#(B
$B$3$l$r5/F0$9$k$HCf?H$r!J$b$H$I$*$j!K1#$7$^$9!#(B

@c   Each group, option or face name in this buffer has an active field
@c which says @samp{[Group]}, @samp{[Option]} or @samp{[Face]}.  Invoking
@c that active field creates an ordinary customization buffer showing just
@c that group and its contents, just that option, or just that face.
@c This is the way to set values in it.
$B3F%0%k!<%W!"%*%W%7%g%s!"%U%'%$%9$K$O$=$l$>$l(B@samp{[Group]}$B!"(B
@samp{[Option]}$B!"(B@samp{[Face]}$B$H5-$5$l$?%"%/%F%#%V%U%#!<%k%I$,$"$j$^$9!#(B
$B$=$l$i$r5/F0$9$k$H!"$=$N%0%k!<%W!?%*%W%7%g%s!?%U%'%$%9$N$_$rI=<($7$?(B
$BDL>o$N%+%9%?%^%$%:%P%C%U%!$,:n@.$5$l$^$9!#(B
$B$=$N%P%C%U%!$GCM$r@_Dj$7$^$9!#(B

@node Changing an Option
@c @subsubsection Changing an Option
@subsubsection $B%*%W%7%g%s$NJQ99(B

@c   Here is an example of what a user option looks like in the
@c customization buffer:
$B%+%9%?%^%$%:%P%C%U%!$G%f!<%6!<%*%W%7%g%s$,$I$N$h$&$K8+$($k$+!"(B
$BNc$r$"$2$^$7$g$&!#(B

@smallexample
Kill Ring Max: [Hide] 30
   [State]: this option is unchanged from its standard setting.
Maximum length of kill ring before oldest elements are thrown away.
@end smallexample

@c   The text following @samp{[Hide]}, @samp{30} in this case, indicates
@c the current value of the option.  If you see @samp{[Show]} instead of
@c @samp{[Hide]}, it means that the value is hidden; the customization
@c buffer initially hides values that take up several lines.  Invoke
@c @samp{[Show]} to show the value.
@samp{[Hide]}$B$KB3$/%F%-%9%H!"$D$^$j!"(B@samp{30}$B$,%*%W%7%g%s$N8=:_$NCM$r(B
$B<($7$F$$$^$9!#(B
@samp{[Hide]}$B$G$O$J$/(B@samp{[Show]}$B$HI=<($5$l$F$$$l$P!"(B
$BCM$O1#$5$l$F$$$^$9!#(B
$B%+%9%?%^%$%:%P%C%U%!$G$O!"J#?t9T$K$o$?$k$h$&$JCM$O:G=i$O1#$5$l$F$$$F!"(B
@samp{[Show]}$B$r5/F0$9$k$HI=<($5$l$^$9!#(B

@c   The line after the option name indicates the @dfn{customization state}
@c of the option: in the example above, it says you have not changed the
@c option yet.  The word @samp{[State]} at the beginning of this line is
@c active; you can get a menu of various operations by invoking it with
@c @kbd{Mouse-1} or @key{RET}.  These operations are essential for
@c customizing the variable.
$B%*%W%7%g%sL>$KB3$/9T$O%*%W%7%g%s$N(B@dfn{$B%+%9%?%^%$%:>uBV(B}$B$r<($7$F$$$^$9!#(B
$B>e$NNc$G$O!"$^$@JQ99$7$F$$$J$$$HI=<($5$l$F$$$^$9!#(B
$B9TF,$N(B@samp{[State]}$B$N$H$3$m$,%"%/%F%#%V%U%#!<%k%I$G!"(B
$B$3$3$r(B@kbd{Mouse-1}$B$+(B@key{RET}$B$G5/F0$9$k$H$5$^$6$^$JA`:n$r(B
$B<($9%a%K%e!<$,I=<($5$l$^$9!#(B
$B$3$l$i$NA`:n$OJQ?t$r%+%9%?%^%$%:$9$k$&$($G$H$F$b=EMW$G$9!#(B

@c   The line after the @samp{[State]} line displays the beginning of the
@c option's documentation string.  If there are more lines of
@c documentation, this line ends with @samp{[More]}; invoke this to show
@c the full documentation string.
@samp{[State]}$B$N$D$.$N9T$K$O!"(B
$B$=$N%*%W%7%g%s$N@bL@J8;zNs$N@hF,ItJ,$,I=<($5$l$^$9!#(B
1$B9T$K<}$^$i$J$$>l9g$K$O!"9TKv$K(B@samp{[More]}$B$HI=<($5$l$^$9!#(B
$B$3$l$r5/F0$9$k$H@bL@J8;zNsA4BN$,I=<($5$l$^$9!#(B

@c   To enter a new value for @samp{Kill Ring Max}, move point to the value
@c and edit it textually.  For example, you can type @kbd{M-d}, then insert
@c another number.
@samp{Kill Ring Max}$B$K?7$7$$CM$r@_Dj$9$k$K$O!"(B
$B%]%$%s%H$rCM$N0LCV$X;}$C$F$$$C$FD>@\J8;zNs$rJQ99$7$^$9!#(B
$B$?$H$($P!"(B@kbd{M-d}$B$G8=:_$NCM$r:o=|$7$F$+$i!"(B
$B@_Dj$9$k?tCM$rBG$A9~$a$P$h$$$N$G$9!#(B

@c   When you begin to alter the text, you will see the @samp{[State]} line
@c change to say that you have edited the value:
$BJ8;zNs$rJQ99$7;O$a$k$H!"(B@samp{[State]}$B9T$NI=<($,JQ$o$C$F!"(B
$BCM$,JT=8$5$l$F$$$k$3$H$r<($9$h$&$K$J$j$^$9!#(B

@smallexample
[State]: you have edited the value as text, but not set the option.
@end smallexample

@c @cindex setting option value
@c   Editing the value does not actually set the option variable.  To do
@c that, you must @dfn{set} the option.  To do this, invoke the word
@c @samp{[State]} and choose @samp{Set for Current Session}.
@cindex $B%*%W%7%g%s$NCM$N@_Dj(B
$BJ8;zNs$rJQ99$7$?$@$1$G$O!"$^$@%*%W%7%g%sJQ?t$NCM$O@_Dj$5$l$^$;$s!#(B
$BCM$r(B@dfn{$B@_Dj$9$k(B}$B$K$O!"(B@samp{[State]}$B$N$H$3$m$r5/F0$7$F!"(B
@samp{Set for Current Session}$B$rA*Br$7$^$9!#(B

@c   The state of the option changes visibly when you set it:
$BCM$r@_Dj$9$k$H!"%*%W%7%g%s$N>uBVI=<($bBP1~$7$FJQ$o$j$^$9!#(B

@smallexample
[State]: you have set this option, but not saved it for future sessions.
@end smallexample

@c    You don't have to worry about specifying a value that is not valid;
@c setting the option checks for validity and will not really install an
@c unacceptable value.
$B@5$7$/$J$$CM$r@_Dj$7$F$7$^$&?4G[$O$"$j$^$;$s!#(B
$B$H$$$&$N$O!"%*%W%7%g%s$N@_Dj;~$K$O!"CM$N@5$7$5$r8!::$7$F!"(B
$B@5$7$/$J$$CM$O@_Dj$G$-$J$$$h$&$K$J$C$F$$$^$9!#(B

@c @kindex M-TAB @r{(customization buffer)}
@kindex M-TAB @r{$B!J%+%9%?%^%$%:%P%C%U%!!K(B}
@findex widget-complete
@c   While editing a value or field that is a file name, directory name,
@c command name, or anything else for which completion is defined, you can
@c type @kbd{M-@key{TAB}} (@code{widget-complete}) to do completion.
$B%G%#%l%/%H%jL>!"%U%!%$%kL>!"%3%^%s%IL>$G$"$kCM$d%U%#!<%k%I$rJT=8$9$k$H$-!"(B
$B$*$h$S!"$=$NB>2?$G$"$lJd40$,Dj5A$5$l$F$$$k$b$N$rJT=8$9$k$H$-$O!"(B
@kbd{M-@key{TAB}}$B!J(B@code{widget-complete}$B!K$rBG$F$PJd40$G$-$^$9!#(B

@c   Some options have a small fixed set of possible legitimate values.
@c These options don't let you edit the value textually.  Instead, an
@c active field @samp{[Value Menu]} appears before the value; invoke this
@c field to edit the value.  For a boolean ``on or off'' value, the active
@c field says @samp{[Toggle]}, and it changes to the other value.
@c @samp{[Value Menu]} and @samp{[Toggle]} edit the buffer; the changes
@c take effect when you use the @samp{Set for Current Session} operation.
$B$$$/$D$+$N%*%W%7%g%s$G$O!"@5$7$$CM$H$7$F$O7h$^$C$?>/?t$N$b$N$@$1$r;H$($^$9!#(B
$B$=$N$h$&$J%*%W%7%g%s$O!"%F%-%9%H$H$7$F$OJT=8$G$-$^$;$s!#(B
$B$+$o$j$K(B@samp{[Value Menu]}$B$H$$$&%"%/%F%#%V%U%#!<%k%I$,CM$N$^$($K8=$l$^$9!#(B
$B!X%*%s$+%*%U!Y$@$1$N??56CM$r;}$D%*%W%7%g%s$G$O!"(B
$B%"%/%F%#%V%U%#!<%k%I$O(B@samp{[Toggle]}$B$HI=<($5$l$F$$$F!"(B
$B$=$3$r5/F0$9$k$?$S$KCM$rH?E>$G$-$^$9!#(B
@samp{[Value Menu]}$B$b(B@samp{[Toggle]}$B$b%P%C%U%!$rJQ99$9$k$@$1$G$9!#(B
$BCM$,<B:]$K@_Dj$5$l$k$N$O(B@samp{Set for Current Session}$B$r5/F0$7$?$H$-$G$9!#(B

@c   Some options have values with complex structure.  For example, the
@c value of @code{load-path} is a list of directories.  Here is how it
@c appears in the customization buffer:
$B$$$/$D$+$N%*%W%7%g%s$O!"9~$_F~$C$?9=B$$NCM$r;}$A$^$9!#(B
$B$?$H$($P!"(B@code{load-path}$B$OCM$H$7$F%G%#%l%/%H%j$N%j%9%H$r;}$A$^$9!#(B
$B$3$l$r%+%9%?%^%$%:%P%C%U%!$KI=<($9$k$H!"$D$.$N$h$&$K$J$j$^$9!#(B

@smallexample
Load Path:
[INS] [DEL] [Current dir?]: /usr/local/share/emacs/20.3/site-lisp
[INS] [DEL] [Current dir?]: /usr/local/share/emacs/site-lisp
[INS] [DEL] [Current dir?]: /usr/local/share/emacs/20.3/leim
[INS] [DEL] [Current dir?]: /usr/local/share/emacs/20.3/lisp
[INS] [DEL] [Current dir?]: /build/emacs/e20/lisp
[INS] [DEL] [Current dir?]: /build/emacs/e20/lisp/gnus
[INS]
   [State]: this item has been changed outside the customization buffer.
List of directories to search for files to load....
@end smallexample

@noindent
@c Each directory in the list appears on a separate line, and each line has
@c several editable or active fields.
$B%j%9%HCf$N3F%G%#%l%/%H%j$,$=$l$>$lJL$N9T$KI=<($5$l!"(B
$B3F9T$K$O$$$/$D$+$NJT=82DG=!?%"%/%F%#%V%U%#!<%k%I$,$"$j$^$9!#(B

@c   You can edit any of the directory names.  To delete a directory from
@c the list, invoke @samp{[DEL]} on that line.  To insert a new directory in
@c the list, invoke @samp{[INS]} at the point where you want to insert it.
$B$I$N%G%#%l%/%H%jL>$bD>@\JT=8$G$-$^$9!#(B
$B%j%9%H$+$i%G%#%l%/%H%j$r:o=|$9$k$K$O!"(B
$B$=$N9T$N(B@samp{[DEL]}$B$r5/F0$7$^$9!#(B
$B%j%9%H$K?7$7$$%G%#%l%/%H%j$rDI2C$9$k$K$O!"(B
$BA^F~$7$?$$2U=j$N(B@samp{[INS]}$B$r5/F0$7$^$9!#(B

@c   You can also invoke @samp{[Current dir?]} to switch between including
@c a specific named directory in the path, and including @code{nil} in the
@c path.  (@code{nil} in a search path means ``try the current
@c directory.'')
@samp{[Current dir?]}$B$r5/F0$9$k$H!"%Q%9$KFCDj$N%G%#%l%/%H%j$r4^$a$k$N$+!"(B
$B$^$?$O!"(B@code{nil}$B$r4^$a$k$N$+$r@Z$jBX$($i$l$^$9!#(B
$B!JC5:w%Q%9$K$*$1$k(B@code{nil}$B$O!"(B
$B!X%+%l%s%H%G%#%l%/%H%j$rC5$;!Y$H$$$&0UL#!#!K(B

@c @kindex TAB @r{(customization buffer)}
@c @kindex S-TAB @r{(customization buffer)}
@kindex TAB @r{$B!J%+%9%?%^%$%:%P%C%U%!!K(B}
@kindex S-TAB @r{$B!J%+%9%?%^%$%:%P%C%U%!!K(B}
@findex widget-forward
@findex widget-backward
@c   Two special commands, @key{TAB} and @kbd{S-@key{TAB}}, are useful for
@c moving through the customization buffer.  @key{TAB}
@c (@code{widget-forward}) moves forward to the next active or editable
@c field; @kbd{S-@key{TAB}} (@code{widget-backward}) moves backward to the
@c previous active or editable field.
2$B$D$NFCJL$J%3%^%s%I!"(B@key{TAB}$B$H(B@kbd{S-@key{TAB}}$B$O!"(B
$B%+%9%?%^%$%:%P%C%U%!Fb$G$N0\F0$KLrN)$A$^$9!#(B
@key{TAB}$B!J(B@code{widget-forward}$B!K$O$D$.$N(B
$B%"%/%F%#%V!?JT=82DG=%U%#!<%k%I$X0\F0$7$^$9!#(B
@kbd{S-@key{TAB}}$B!J(B@code{widget-backward}$B!K$O!"(B
1$B$D$^$($N%"%/%F%#%V!?JT=82DG=%U%#!<%k%I$X0\F0$7$^$9!#(B

@c   Typing @key{RET} on an editable field also moves forward, just like
@c @key{TAB}.  The reason for this is that people have a tendency to type
@c @key{RET} when they are finished editing a field.  If you have occasion
@c to insert a newline in an editable field, use @kbd{C-o} or @kbd{C-q
@c C-j}.
$BJT=82DG=%U%#!<%k%I$G(B@key{RET}$B$rBG$D$H!"(B
@key{TAB}$B$HF1MM$K$D$.$N%U%#!<%k%I$X?J$_$^$9!#(B
$B$J$<$=$&$J$C$F$$$k$+$H$$$&$H!"JT=82DG=%U%#!<%k%I$r(B
$BJT=8$7=*$($k$H:G8e$K(B@key{RET}$B$rBG$D?M$,B?$$$+$i$G$9!#(B
$BJT=82DG=%U%#!<%k%I$K2~9TJ8;z$rF~$k$K$O!"(B
@kbd{C-o}$B$+(B@kbd{C-q C-j}$B$HBG$A$^$9!#(B

@c @cindex saving option value
@c   Setting the option changes its value in the current Emacs session;
@c @dfn{saving} the value changes it for future sessions as well.  This
@c works by writing code into your @file{~/.emacs} file so as to set the
@c option variable again each time you start Emacs.  To save the option,
@c invoke @samp{[State]} and select the @samp{Save for Future Sessions}
@c operation.
@cindex $B%*%W%7%g%s$NCM$NJ]B8(B
$B%*%W%7%g%s$r@_Dj$9$k$H!"$=$NCM$O8=:_$N(BEmacs$B%;%C%7%g%s$@$1$KM-8z$G$9!#(B
$B$=$NCM$r(B@dfn{$BJ]B8(B}$B$9$k$H!">-Mh$N%;%C%7%g%s$G$bM-8z$K$J$j$^$9!#(B
$BJ]B8$r9T$&$H!"8D?M$N(B@file{~/.emacs}$B%U%!%$%k$K%3!<%I$,DI2C$5$l$F!"(B
$B$D$.$K(BEmacs$B$r5/F0$7$?$H$-$K%*%W%7%g%sJQ?t$NCM$r@_Dj$9$k$h$&$K$J$j$^$9!#(B
$B%*%W%7%g%s$rJ]B8$9$k$K$O!"(B@samp{[State]}$B$r5/F0$7$F(B
@samp{Save for Future Sessions}$B$rA*$S$^$9!#(B

@c   You can also restore the option to its standard value by invoking
@c @samp{[State]} and selecting the @samp{Reset to Standard Settings}
@c operation.  There are actually three reset operations:
$B%*%W%7%g%s$rI8=`CM$KLa$7$?$1$l$P!"(B@samp{[State]}$B$r5/F0$7$F(B
@samp{Reset to Standard Settings}$B$rA*$S$^$9!#(B
$B<B:]$K$O$D$.$N(B3$B<oN`$N%j%;%C%HA`:n$,$"$j$^$9!#(B

@table @samp
@item Reset
@c If you have made some modifications and not yet set the option,
@c this restores the text in the customization buffer to match
@c the actual value.
$B$J$s$i$+$N=$@5$r9T$C$?$,!"$^$@%*%W%7%g%s$r@_Dj$7$F$$$J$1$l$P!"(B
$B$3$NA`:n$K$h$j!"%+%9%?%^%$%:%P%C%U%!>e$N%F%-%9%H$r(B
$B%*%W%7%g%s$N8=:_CM$H0lCW$5$;$i$l$k!#(B

@item Reset to Saved
@c This restores the value of the option to the last saved value,
@c and updates the text accordingly.
$B$3$NA`:n$G$O!"%*%W%7%g%s$NCM$r:G8e$KJ]B8$7$?CM$KLa$7!"(B
$B%+%9%?%^%$%:%P%C%U%!>e$N%F%-%9%H$b$=$NCM$K9g$o$;$k!#(B

@item Reset to Standard Settings
@c This sets the option to its standard value, and updates the text
@c accordingly.  This also eliminates any saved value for the option,
@c so that you will get the standard value in future Emacs sessions.
$B$3$NA`:n$G$O!"%*%W%7%g%s$rI8=`CM$K@_Dj$7!"(B
$B%+%9%?%^%$%:%P%C%U%!>e$N%F%-%9%H$b$=$NCM$K9g$o$;$k!#(B
$B$5$i$K!"0JA0$K$=$N%*%W%7%g%s$K$D$$$FJ]B8$7$?CM$b$9$Y$F$b$H$KLa$5$l$k$N$G!"(B
$B>-Mh$N(BEmacs$B%;%C%7%g%s$G$b$9$Y$FI8=`CM$,;H$o$l$k$h$&$K$J$k!#(B
@end table

@c   The state of a group indicates whether anything in that group has been
@c edited, set or saved.  You can select @samp{Set for Current Session},
@c @samp{Save for Future Sessions} and the various kinds of @samp{Reset}
@c operation for the group; these operations on the group apply to all
@c options in the group and its subgroups.
$B%0%k!<%W$N(B@samp{[State]}$B$O$=$N%0%k!<%W$KB0$9$k$b$N$N$I$l$+$,(B
$BJT=8$5$l$?!?@_Dj$5$l$?!?J]B8$5$l$?$3$H$r<($7$^$9!#(B
@samp{Set for Current Session}$B!"(B@samp{Save for Future Sessions}$B!"(B
$B$*$h$S3F<o$N(B@samp{Reset}$B$r%0%k!<%WA4BN$KBP$7$FE,MQ$G$-$^$9!#(B
$B$3$l$i$NA`:n$O%0%k!<%W$*$h$S$=$N%5%V%0%k!<%W$KB0$9$k$9$Y$F$N(B
$B%*%W%7%g%s$KBP$7$FE,MQ$5$l$^$9!#(B

@c   Near the top of the customization buffer there are two lines
@c containing several active fields:
$B%+%9%?%^%$%:%P%C%U%!$N@hF,IU6a$K$O!"(B
$B$$$/$D$+$N%"%/%F%#%V%U%#!<%k%I$r4^$s$@$D$.$N$h$&$J9T$,$"$j$^$9!#(B

@smallexample
 [Set for Current Session] [Save for Future Sessions]
 [Reset] [Reset to Saved] [Reset to Standard]   [Bury Buffer]
@end smallexample

@noindent
@c Invoking @samp{[Bury Buffer]} buries this customization buffer.  Each of
@c the other fields performs an operation---set, save or reset---on each of
@c the items in the buffer that could meaningfully be set, saved or reset.
@samp{[Bury Buffer]}$B$r5/F0$9$k$H!"%+%9%?%^%$%:%P%C%U%!$r>C$7$^$9!#(B
$BB>$N%U%#!<%k%I$O!"$=$N%P%C%U%!$K4^$^$l$F$$$k9`L\$=$l$>$l$K$D$$$F$=$l$>$l!"(B
$B@_Dj!"J]B8!"%j%;%C%H$r!J$=$l$i$NA`:n$,E,MQ2DG=$J$i!K<B9T$7$^$9!#(B

@node Face Customization
@c @subsubsection Customizing Faces
@subsubsection $B%U%'%$%9$N%+%9%?%^%$%:(B
@c @cindex customizing faces
@c @cindex bold font
@c @cindex italic font
@c @cindex fonts and faces
@cindex $B%U%'%$%9$N%+%9%?%^%$%:(B
@cindex $B%\!<%k%I%U%)%s%H(B
@cindex $B%$%?%j%C%/%U%)%s%H(B
@cindex $B%U%)%s%H$H%U%'%$%9(B

@c   In addition to user options, some customization groups also include
@c faces.  When you show the contents of a group, both the user options and
@c the faces in the group appear in the customization buffer.  Here is an
@c example of how a face looks:
$B$$$/$D$+$N%+%9%?%^%$%:%0%k!<%W$O!"(B
$B%f!<%6!<%*%W%7%g%s$K2C$($F%U%'%$%9$b4^$_$^$9!#(B
$B%0%k!<%W$NFbMF$rI=<($7$?$H$-!"(B
$B%*%W%7%g%s$H%U%'%$%9$NN>J}$,%+%9%?%^%$%:%P%C%U%!$K8=$l$^$9!#(B
$B%U%'%$%9$N8+$(J}$O!"$?$H$($P$D$.$N$h$&$K$J$j$^$9!#(B

@smallexample
Custom Changed Face: (sample)
   [State]: this face is unchanged from its standard setting.
Face used when the customize item has been changed.
Attributes: [ ] Bold: [toggle] off
            [X] Italic: [toggle] on
            [ ] Underline: [toggle] off
            [ ] Inverse-Video: [toggle] on
            [ ] Foreground: black (sample)
            [ ] Background: white (sample)
            [ ] Stipple:  
@end smallexample

@c   Each face attribute has its own line.  The @samp{[@var{x}]} field
@c before the attribute name indicates whether the attribute is
@c @dfn{enabled}; @samp{X} means that it is.  You can enable or disable the
@c attribute by invoking that field.  When the attribute is enabled, you
@c can change the attribute value in the usual ways.
$B%U%'%$%9$N3FB0@-$O$=$l$>$l$,(B1$B9T$r@j$a$^$9!#(B
$BB0@-$N$^$($N(B@samp{[@var{x}]}$B$H$$$&%U%#!<%k%I$O!"(B
$B$=$NB0@-$,(B@dfn{$B%*%s$K$J$C$F$$$k(B}$B$+$I$&$+$rI=<($7$F$$$^$9!#(B
@samp{X}$B$,I=<($5$l$F$$$l$P%*%s$K$J$C$F$$$^$9!#(B
$B$=$N%U%#!<%k%I$r5/F0$9$k$3$H$G%*%s!?%*%U$rH?E>$G$-$^$9!#(B
$BB0@-$,%*%s$K$J$C$F$$$k>l9g$O!"(B
$B$=$NB0@-$NCM$r%*%W%7%g%s$HF1MM$K$7$FJQ99$G$-$9!#(B

@c   On a black-and-white display, the colors you can use for the
@c background are @samp{black}, @samp{white}, @samp{gray}, @samp{gray1},
@c and @samp{gray3}.  Emacs supports these shades of gray by using
@c background stipple patterns instead of a color.
$BGr9u%G%#%9%W%l%$$G$O!"GX7J$K@_Dj2DG=$JI=<(?'$O(B@samp{black}$B!"(B
@samp{white}$B!"(B@samp{gray}$B!"(B@samp{gray1}$B!"(B@samp{gray3}$B$N$$$:$l$+$G$9!#(B
Emacs$B$OI=<(?'$N$+$o$j$K%I%C%H%Q%?!<%s$G3%?'$N3,D4$rI=$7$^$9!#(B

@c   Setting, saving and resetting a face work like the same operations for
@c options (@pxref{Changing an Option}).
$B%U%'%$%9$r@_Dj!?J]B8!?%j%;%C%H$9$k$N$O!"%*%W%7%g%s$HF1MM$K$7$F$G$-$^$9(B
$B!J(B@pxref{Changing an Option}$B!K!#(B

@c   A face can specify different appearances for different types of
@c display.  For example, a face can make text red on a color display, but
@c use a bold font on a monochrome display.  To specify multiple
@c appearances for a face, select @samp{Show Display Types} in the menu you
@c get from invoking @samp{[State]}.
$B%U%'%$%9$G$O!"%G%#%9%W%l%$$N<oJL$4$H$K0[$J$k8+$(J}$r;XDj$G$-$^$9!#(B
$B$?$H$($P!"$"$k%U%'%$%9$r%+%i!<%G%#%9%W%l%$$G$O@V$GI=<($7!"(B
$BGr9u%G%#%9%W%l%$$G$O$+$o$j$K%\!<%k%IBN$GI=<($9$k$h$&$K$G$-$^$9!#(B
$B$"$k%U%'%$%9$KJ#?t$N8+$(J}$r;XDj$9$k$K$O!"(B
@samp{[State]}$B%a%K%e!<$rI=<($5$;$F(B@samp{Show Display Types}$B$rA*$S$^$9!#(B

@findex modify-face
@c   Another more basic way to set the attributes of a specific face is
@c with @kbd{M-x modify-face}.  This command reads the name of a face, then
@c reads the attributes one by one.  For the color and stipple attributes,
@c the attribute's current value is the default---type just @key{RET} if
@c you don't want to change that attribute.  Type @samp{none} if you want
@c to clear out the attribute.
$B%U%'%$%9$NB0@-$r@_Dj$9$k$b$C$H4pK\E*$JJ}K!$O!"(B
@kbd{M-x modify-face}$B$r;H$&$3$H$G$9!#(B
$B$3$N%3%^%s%I$O!"$^$:%U%'%$%9$NL>A0$rJ9$$$F$-$F!"(B
$BB3$$$FB0@-$r(B1$B$D$:$D=g$KJ9$$$F$-$^$9!#(B
$BI=<(?'$d%Q%?!<%s$NB0@-$G$O!"$=$NB0@-$N8=:_$NCM$,%G%U%)%k%H$K$J$C$F$$$^$9!#(B
$B$3$l$i$rJQ99$7$?$/$J$1$l$P!"C1$K!"(B@key{RET}$B$rBG$F$P$h$$$N$G$9!#(B
$BB0@-$r6u$K$7$?$1$l$P(B@samp{none}$B$HBG$A$^$9!#(B

@node Specific Customization
@c @subsubsection Customizing Specific Items
@subsubsection $BFCDj9`L\$N%+%9%?%^%$%:(B

@c   Instead of finding the options you want to change by moving down
@c through the structure of groups, you can specify the particular option,
@c face or group that you want to customize.
$B%0%k!<%W9=B$$r(B1$BCJ$:$D9_$j$F$$$C$FL\;X$9%*%W%7%g%s$rC5$9$+$o$j$K!"(B
$B%+%9%?%^%$%:$7$?$$%*%W%7%g%s!?%U%'%$%9!?%0%k!<%W$NL>A0$r(B
$BD>@\$K;XDj$9$k$3$H$b$G$-$^$9!#(B

@table @kbd
@item M-x customize-option @key{RET} @var{option} @key{RET}
@c Set up a customization buffer with just one option, @var{option}.
$B;XDj$7$?%*%W%7%g%s(B@var{option}$B$@$1$r4^$`%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@item M-x customize-face @key{RET} @var{face} @key{RET}
@c Set up a customization buffer with just one face, @var{face}.
$B;XDj$7$?%U%'%$%9(B@var{face}$B$@$1$r4^$`%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@item M-x customize-group @key{RET} @var{group} @key{RET}
@c Set up a customization buffer with just one group, @var{group}.
$B;XDj$7$?%0%k!<%W(B@var{group}$B$@$1$r4^$`%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@item M-x customize-apropos @key{RET} @var{regexp} @key{RET}
@c Set up a customization buffer with all the options, faces and groups
@c that match @var{regexp}.
$B;XDj$7$?@55,I=8=(B@var{regexp}$B$K0lCW$9$k$9$Y$F$N(B
$B%*%W%7%g%s!?%U%'%$%9!?%0%k!<%W$r4^$`%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@item M-x customize-changed-options @key{RET} @var{version} @key{RET}
@c Set up a customization buffer with all the options, faces and groups
@c whose meaning has changed since Emacs version @var{version}.
Emacs$B$N%P!<%8%g%s(B@var{version}$B0J9_$K0UL#$,JQ99$5$l$?$9$Y$F$N(B
$B%*%W%7%g%s!?%U%'%$%9!?%0%k!<%W$r4^$`%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@item M-x customize-saved 
@c Set up a customization buffer containing all options and faces that you
@c have saved with customization buffers.
$B%+%9%?%^%$%:%P%C%U%!$GJ]B8$7$?$9$Y$F$N%*%W%7%g%s$H%U%'%$%9$r4^$`(B
$B%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@item M-x customize-customized
@c Set up a customization buffer containing all options and faces that you
@c have customized but not saved.
$B%+%9%?%^%$%:$7$?$,!"$^$@J]B8$7$F$$$J$$$9$Y$F$N%*%W%7%g%s$H%U%'%$%9$r4^$`(B
$B%+%9%?%^%$%:%P%C%U%!$r3+$/!#(B
@end table

@findex customize-option
@c   If you want to alter a particular user option variable with the
@c customization buffer, and you know its name, you can use the command
@c @kbd{M-x customize-option} and specify the option name.  This sets up
@c the customization buffer with just one option---the one that you asked
@c for.  Editing, setting and saving the value work as described above, but
@c only for the specified option.
$BL>A0$N$o$+$C$F$$$k%*%W%7%g%sJQ?t$r%+%9%?%^%$%:%P%C%U%!$GJQ99$7$?$$>l9g$O!"(B
$B%3%^%s%I(B@kbd{M-x customize-option}$B$GD>@\L>A0$r;XDj$7$^$9!#(B
$B$3$l$K$h$j!"$=$N%*%W%7%g%s$@$1$r4^$`%+%9%?%^%$%:%P%C%U%!$,8=$l$^$9!#(B
$BJT=8!?@_Dj!?J]B8$O$3$l$^$G@bL@$7$?$H$*$j$K9T$$$^$9$,!"(B
$B@_Dj$NBP>]$K$J$k$N$O;XDj$7$?%*%W%7%g%s$@$1$G$9!#(B

@findex customize-face
@c   Likewise, you can modify a specific face, chosen by name, using
@c @kbd{M-x customize-face}.
$BF1MM$K$7$F!"(B@kbd{M-x customize-face}$B$G$O%U%'%$%9L>$r;XDj$7$FJQ99$G$-$^$9!#(B

@findex customize-group
@c   You can also set up the customization buffer with a specific group,
@c using @kbd{M-x customize-group}.  The immediate contents of the chosen
@c group, including option variables, faces, and other groups, all appear
@c as well.  However, these subgroups' own contents start out hidden.  You
@c can show their contents in the usual way, by invoking @samp{[Show]}.
$BF1MM$K!"(B@kbd{M-x customize-group}$B$G$O%0%k!<%WL>$r;XDj$7$F(B
$B%+%9%?%^%$%:%P%C%U%!$r3+$/$3$H$,$G$-$^$9!#(B
$B$=$N%+%9%?%^%$%:%P%C%U%!$K$O!";XDj$7$?%0%k!<%W$KD>@\4^$^$l$F$$$k%*%W%7%g%s!"(B
$B%U%'%$%9!"B>$N!J2<0L$N!K%0%k!<%W$,8=$l$^$9!#(B
$B$?$@$7!"%5%V%0%k!<%W$NFbMF$O:G=i$O1#$5$l$F$$$^$9!#(B
$B$=$l$i$rI=<($7$?$$>l9g$O!"DL>o$I$*$j(B@samp{[Show]}$B$r5/F0$7$^$9!#(B

@findex customize-apropos
@c   To control more precisely what to customize, you can use @kbd{M-x
@c customize-apropos}.  You specify a regular expression as argument; then
@c all options, faces and groups whose names match this regular expression
@c are set up in the customization buffer.  If you specify an empty regular
@c expression, this includes @emph{all} groups, options and faces in the
@c customization buffer (but that takes a long time).
@kbd{M-x customize-apropos}$B$r;H$&$H!"(B
$B%+%9%?%^%$%:$9$k$b$N$r$b$C$H:Y$+$/@)8f$G$-$^$9!#(B
$B$3$N%3%^%s%I$G$O0z?t$H$7$F@55,I=8=$r;XDj$7!"(B
$B$=$l$K0lCW$9$k$9$Y$F$N%*%W%7%g%s!?%U%'%$%9!?%0%k!<%W$r(B
$B4^$s$@%+%9%?%^%$%:%P%C%U%!$,8=$l$^$9!#(B
$B6u$N@55,I=8=$r;XDj$9$k$H!"(B@emph{$B$9$Y$F$N(B}$B%*%W%7%g%s!?%U%'%$%9!?%0%k!<%W$r(B
$B4^$`%+%9%?%^%$%:%P%C%U%!$,$G$-$^$9(B
$B!J$?$@$7$9$4$/;~4V$,$+$+$k!K!#(B

@findex customize-changed-options
@c   When you upgrade to a new Emacs version, you might want to customize
@c new options and options whose meanings or default values have changed.
@c To do this, use @kbd{M-x customize-changed-options} and specify a
@c previous Emacs version number using the minibuffer.  It creates a
@c customization buffer which shows all the options (and groups) whose
@c definitions have been changed since the specified version.
Emacs$B$N?7HG$X99?7$7$?$H$-$K$O!"?7$7$$%*%W%7%g%s!"(B
$B0UL#$d%G%U%)%k%HCM$,JQ99$5$l$?%*%W%7%g%s$r%+%9%?%^%$%:$7$?$$$O$:$G$9!#(B
$B$=$l$K$O!"(B@kbd{M-x customize-changed-options}$B$r;H$$!"(B
$B%_%K%P%C%U%!$G0JA0$NHG$N(BEmacs$B$N%P!<%8%g%sHV9f$r;XDj$7$^$9!#(B
$B$9$k$H!";XDj$7$?%P!<%8%g%s0J9_$KDj5A$,JQ99$5$l$?(B
$B$9$Y$F$N%*%W%7%g%s!J$H%0%k!<%W!K$r4^$s$@%+%9%?%^%$%:%P%C%U%!$r:n$j$^$9!#(B

@findex customize-saved
@findex customize-customized
@c   If you change option values and then decide the change was a mistake,
@c you can use two special commands to revisit your previous changes.  Use
@c @kbd{customize-saved} to look at the options and faces that you have
@c saved.  Use @kbd{M-x customize-customized} to look at the options and
@c faces that you have set but not saved.
$B%*%W%7%g%s$rJQ99$7$?$"$H$G$^$A$,$C$?$H5$$E$$$?$H$-$O!"(B
$BJQ99$7$?$b$N$r:F8!F$$9$k$?$a$K(B2$B$D$N%3%^%s%I$,;H$($^$9!#(B
$BJ]B8$7$F$7$^$C$?%*%W%7%g%s$K$D$$$F$O(B@kbd{customize-saved}$B$r!"(B
$BJQ99$7$?$1$l$I$^$@J]B8$7$F$$$J$$%*%W%7%g%s$K$D$$$F$O(B
@kbd{M-x customize-customized}$B$r;H$$$^$9!#(B

@node Hooks
@c @subsection Hooks
@subsection $B%U%C%/(B
@c @cindex hook
@cindex $B%U%C%/(B

@c   A @dfn{hook} is a variable where you can store a function or functions
@c to be called on a particular occasion by an existing program.  Emacs
@c provides a number of hooks for the sake of customization.
@dfn{$B%U%C%/(B}$B$H$O$"$kFCDj$N>u67$G4{B8$N%W%m%0%i%`$+$i8F$S=P$5$l$k(B
$B4X?t!?4X?t72$r3JG<$7$F$*$/JQ?t$r$$$$$^$9!#(B
Emacs$B$K$O!"%+%9%?%^%$%:MQ$N%U%C%/$,?tB?$/$"$j$^$9!#(B

@c   Most of the hooks in Emacs are @dfn{normal hooks}.  These variables
@c contain lists of functions to be called with no arguments.  The reason
@c most hooks are normal hooks is so that you can use them in a uniform
@c way.  Every variable in Emacs whose name ends in @samp{-hook} is a
@c normal hook.
Emacs$BCf$N$[$H$s$I$N%U%C%/$O(B@dfn{$B%N!<%^%k%U%C%/(B}$B$G$9!#(B
$B$3$l$i$NJQ?t$O!"0z?t$J$7$G8F$S=P$5$l$k4X?t$N%j%9%H$rJ];}$7$^$9!#(B
$B$[$H$s$I$N%U%C%/$,%N!<%^%k%U%C%/$J$N$O!"$=$l$i$rE}0lE*$K07$($k$+$i$G$9!#(B
Emacs$B$G$O!"(B@samp{-hook}$B$G=*$o$kL>A0$NJQ?t$O$9$Y$F%N!<%^%k%U%C%/$G$9!#(B

@c   Most major modes run hooks as the last step of initialization.  This
@c makes it easy for a user to customize the behavior of the mode, by
@c overriding the local variable assignments already made by the mode.  But
@c hooks may also be used in other contexts.  For example, the hook
@c @code{suspend-hook} runs just before Emacs suspends itself
@c (@pxref{Exiting}).
$B$[$H$s$I$N%a%8%c!<%b!<%I$O=i4|@_Dj$N:G=*CJ3,$G%U%C%/$r<B9T$7$^$9!#(B
$B%b!<%I$,@_Dj$7$?%m!<%+%kJQ?t$r%U%C%/$GJQ99$9$l$P$h$$$N$G!"(B
$B%b!<%I$N$U$k$^$$$r%f!<%6!<$,%+%9%?%^%$%:$9$k$3$H$,MF0W$K$J$j$^$9!#(B
$B$7$+$7!"%U%C%/$O$=$l0J30$N>lLL$G$b;H$o$l$^$9!#(B
$B$?$H$($P!"(B@code{suspend-hook}$B$O!"(BEmacs$B$,5Y;_$9$kD>A0$K<B9T$5$l$^$9(B
$B!J(B@pxref{Exiting}$B!K!#(B

@c   The recommended way to add a hook function to a normal hook is by
@c calling @code{add-hook}.  You can use any valid Lisp function as the
@c hook function.  For example, here's how to set up a hook to turn on Auto
@c Fill mode when entering Text mode and other modes based on Text mode:
$B%N!<%^%k%U%C%/$K%U%C%/4X?t$rDI2C$9$k$*4+$a$N$d$jJ}$O!"(B
@code{add-hook}$B$r8F$V$3$H$G$9!#(B
$B%U%C%/4X?t$H$7$F$OG$0U$N(BLisp$B4X?t$r;H$($^$9!#(B
$B$?$H$($P!"%F%-%9%H!J(Btext$B!K%b!<%I$d%F%-%9%H!J(Btext$B!K%b!<%I$r(B
$B4p$K$7$F$$$k%b!<%I$K$*$$$F!"(B
$B<+F0E*$K<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$r%*%s$K$9$k$K$O$D$.$N$h$&$K$7$^$9(B

@example
(add-hook 'text-mode-hook 'turn-on-auto-fill)
@end example

@c   The next example shows how to use a hook to customize the indentation
@c of C code.  (People often have strong personal preferences for one
@c format compared to another.)  Here the hook function is an anonymous
@c lambda expression.
$B$D$.$NNc$O!"(BC$B%3!<%I$N;z2<$2$r%+%9%?%^%$%:$9$k$N$K%U%C%/$r(B
$B;H$&J}K!$r<($7$^$9!#(B
$B!JC/$G$b;z2<$2$K$OFH<+$N9%$_$,$"$k!K!#(B
$B$3$3$G$O!"%U%C%/4X?t$OL>A0$N$J$$%i%`%@<0$G$9!#(B

@example
@group
(setq my-c-style
  '((c-comment-only-line-offset . 4)
@end group
@group
    (c-cleanup-list . (scope-operator
		       empty-defun-braces
		       defun-close-semi))
@end group
@group
    (c-offsets-alist . ((arglist-close . c-lineup-arglist)
			(substatement-open . 0)))))
@end group

@group
(add-hook 'c-mode-common-hook
  (function (lambda ()
    (c-add-style "my-style" my-c-style t))))
@end group
@end example

@c   It is best to design your hook functions so that the order in which
@c they are executed does not matter.  Any dependence on the order is
@c ``asking for trouble.''  However, the order is predictable: the most
@c recently added hook functions are executed first.
$B$I$N=gHV$G<B9T$5$l$F$bBg>fIW$J$h$&$K%U%C%/4X?t$r@_7W$9$k$N$,:GNI$G$9!#(B
$B<B9T=g=x$K0MB8$9$k$N$O!"!X;v8N$r8F$S9~$`!Y$h$&$J$b$N$G$9!#(B
$B$7$+$7!"=gHV$OM=B,$G$-$^$9!#(B
$B$b$C$H$b:G6a$KDI2C$7$?%U%C%/4X?t$[$I@h$K<B9T$5$l$^$9!#(B

@node Locals
@c @subsection Local Variables
@subsection $B%m!<%+%kJQ?t(B

@table @kbd
@item M-x make-local-variable @key{RET} @var{var} @key{RET}
@c Make variable @var{var} have a local value in the current buffer.
$BJQ?t(B@var{var}$B$,%+%l%s%H%P%C%U%!$G%m!<%+%k$KCM$r;}$D$h$&$K$9$k!#(B
@item M-x kill-local-variable @key{RET} @var{var} @key{RET}
@c Make variable @var{var} use its global value in the current buffer.
$BJQ?t(B@var{var}$B$,%+%l%s%H%P%C%U%!$G$O%0%m!<%P%kCM$r;H$&$h$&$K$9$k!#(B
@item M-x make-variable-buffer-local @key{RET} @var{var} @key{RET}
@c Mark variable @var{var} so that setting it will make it local to the
@c buffer that is current at that time.
$BJQ?t(B@var{var}$B$r!"CM$r@_Dj$7$?$H$-$K$=$N;~E@$N%+%l%s%H%P%C%U%!$G%m!<%+%k(B
$B$KCM$r;}$D$h$&$K$9$k!#(B
@end table

@c @cindex local variables
@cindex $B%m!<%+%kJQ?t(B
@c   Almost any variable can be made @dfn{local} to a specific Emacs
@c buffer.  This means that its value in that buffer is independent of its
@c value in other buffers.  A few variables are always local in every
@c buffer.  Every other Emacs variable has a @dfn{global} value which is in
@c effect in all buffers that have not made the variable local.
$B$[$H$s$I$NJQ?t$O(BEmacs$B%P%C%U%!$KBP$7$F(B@dfn{$B%m!<%+%k(B}$B$K$G$-$^$9!#(B
$B$D$^$j!"$=$NJQ?t$N%P%C%U%!Cf$G$NCM$OB>$N%P%C%U%!$G$NCM$H$O(B
$BFHN)$K$J$j$^$9!#(B
$B$$$/$D$+$NJQ?t$O$D$M$K$9$Y$F$N%P%C%U%!$K$*$$$F%m!<%+%k$G$9!#(B
$B$=$l0J30$NJQ?t$O$9$Y$F!"(B@dfn{$B%0%m!<%P%k(B}$B$JCM!"(B
$B$D$^$j$=$NJQ?t$r%m!<%+%k$K$7$F$$$J$$$9$Y$F$N%P%C%U%!$K$*$$$F(B
$B6&M-$5$l$kCM$r;}$A$^$9!#(B

@findex make-local-variable
@c   @kbd{M-x make-local-variable} reads the name of a variable and makes it
@c local to the current buffer.  Further changes in this buffer will not
@c affect others, and further changes in the global value will not affect this
@c buffer.
@kbd{M-x make-local-variable}$B$OJQ?tL>$r<u$1<h$j!"(B
$B$=$NJQ?t$r%+%l%s%H%P%C%U%!$K$*$$$F%m!<%+%k$K$7$^$9!#(B
$B$=$l0J9_!"$3$N%P%C%U%!Fb$G$=$NJQ?t$rJQ99$7$F$b(B
$BB>$N%P%C%U%!$K$O1F6A$7$^$;$s$7!"(B
$B$=$NJQ?t$N%0%m!<%P%k$JCM$rJQ99$7$F$b$3$N%P%C%U%!Fb$G$NCM$K$O1F6A$7$^$;$s!#(B

@findex make-variable-buffer-local
@c @cindex per-buffer variables
@cindex $B%P%C%U%!$4$H$NJQ?t(B
@c   @kbd{M-x make-variable-buffer-local} reads the name of a variable and
@c changes the future behavior of the variable so that it will become local
@c automatically when it is set.  More precisely, once a variable has been
@c marked in this way, the usual ways of setting the variable automatically
@c do @code{make-local-variable} first.  We call such variables
@c @dfn{per-buffer} variables.
@kbd{M-x make-variable-buffer-local}$B$O!"JQ?tL>$r<u$1<h$j!"(B
$BCM$,@_Dj$5$l$k$H$=$NJQ?t$,<+F0E*$K%m!<%+%k$K$J$k$h$&$K$7$^$9!#(B
$B$b$C$H@53N$K$$$($P!"$3$N$h$&$KFCJL$J0u$rJQ?t$KIU$1$F$*$/$H!"(B
$BDL>o$NJ}K!$GJQ?t$KCM$r@_Dj$9$k$H$-$K$O$D$M$K$^$:(B
@code{make-local-variable}$B$,<B9T$5$l$k$h$&$K$J$k$N$G$9!#(B
$B$3$N$h$&$JJQ?t$r(B@dfn{$B%P%C%U%!$4$H$NJQ?t(B}$B$H8F$S$^$9!#(B

@c   Major modes (@pxref{Major Modes}) always make variables local to the
@c buffer before setting the variables.  This is why changing major modes
@c in one buffer has no effect on other buffers.  Minor modes also work by
@c setting variables---normally, each minor mode has one controlling
@c variable which is non-@code{nil} when the mode is enabled (@pxref{Minor
@c Modes}).  For most minor modes, the controlling variable is per buffer.
$B%a%8%c!<%b!<%I!J(B@pxref{Major Modes}$B!K$G$O!"(B
$BJQ?t$r@_Dj$9$k$^$($K$D$M$K%m!<%+%k$K$7$^$9!#(B
$B$3$N$?$a!"$"$k%P%C%U%!$G%a%8%c!<%b!<%I$rJQ99$7$F$b(B
$BB>$N%P%C%U%!$K$O1F6A$,5Z$S$^$;$s!#(B
$B%^%$%J%b!<%I!J(B@pxref{Minor Modes}$B!K$bF1MM$G!"DL>o!"(B
$B%^%$%J%b!<%I$4$H$K%*%s!?%*%U$r@)8f$9$kJQ?t$,$"$j!"(B
$B$=$NJQ?t$,(B@code{nil}$B0J30$N$H$-$K$=$N%^%$%J%b!<%I$O%*%s$K$J$j$^$9!#(B
$B$[$H$s$I$N%^%$%J%b!<%I$G$O!"$=$N@)8fMQJQ?t$O%P%C%U%!$4$H$NJQ?t$G$9!#(B

@c   Emacs contains a number of variables that are always per-buffer.
@c These include @code{abbrev-mode}, @code{auto-fill-function},
@c @code{case-fold-search}, @code{comment-column}, @code{ctl-arrow},
@c @code{fill-column}, @code{fill-prefix}, @code{indent-tabs-mode},
@c @code{left-margin}, @code{mode-line-format}, @code{overwrite-mode},
@c @code{selective-display-ellipses}, @code{selective-display},
@c @code{tab-width}, and @code{truncate-lines}.  Some other variables are
@c always local in every buffer, but they are used for internal
@c purposes.@refill
Emacs$B$K$O!"$D$M$K%P%C%U%!$4$H$NJQ?t$G$"$k$h$&$JJQ?t$,?tB?$/$"$j$^$9!#(B
@code{abbrev-mode}$B!"(B@code{auto-fill-function}$B!"(B@code{case-fold-search}$B!"(B
@code{comment-column}$B!"(B@code{ctl-arrow}$B!"(B@code{fill-column}$B!"(B
@code{fill-prefix}$B!"(B@code{indent-tabs-mode}$B!"(B@code{left-margin}$B!"(B
@code{mode-line-format}$B!"(B@code{overwrite-mode}$B!"(B
@code{selective-display-ellipses}$B!"(B@code{selective-display}$B!"(B
@code{tab-width}$B!"(B@code{truncate-lines}$B$,$=$N$h$&$JJQ?t$G$9!#(B
$B$3$l0J30$K$b$D$M$K3F%P%C%U%!$G%m!<%+%k$JJQ?t$O$"$j$^$9$,!"(B
$B$=$l$i$OFbIt:n6HMQ$NJQ?t$G$9!#(B

@c   A few variables cannot be local to a buffer because they are always
@c local to each display instead (@pxref{Multiple Displays}).  If you try to
@c make one of these variables buffer-local, you'll get an error message.
$B$$$/$D$+$NJQ?t$O%G%#%9%W%l%$$KBP$7$F%m!<%+%k$K$J$C$F$$$k$?$a!"(B
$B%P%C%U%!$KBP$7$F%m!<%+%k$K$O$G$-$^$;$s(B
$B!J(B@pxref{Multiple Displays}$B!K!#(B
$B$3$l$i$NJQ?t$r%P%C%U%!$K%m!<%+%k$K$7$h$&$H$9$k$H!"(B
$B%(%i!<%a%C%;!<%8$,I=<($5$l$^$9!#(B

@findex kill-local-variable
@c   @kbd{M-x kill-local-variable} reads the name of a variable and makes
@c it cease to be local to the current buffer.  The global value of the
@c variable henceforth is in effect in this buffer.  Setting the major mode
@c kills all the local variables of the buffer except for a few variables
@c specially marked as @dfn{permanent locals}.
@kbd{M-x kill-local-variable}$B$O!"JQ?tL>$r<u$1<h$j!"(B
$B$=$NJQ?t$r%+%l%s%H%P%C%U%!$KBP$7$F%m!<%+%k$G$J$/$7$^$9!#(B
$B$=$l0J9_$=$N%P%C%U%!$G$O!"$=$NJQ?t$N%0%m!<%P%k$JCM$,;H$o$l$^$9!#(B
$B%a%8%c!<%b!<%I$r@_Dj$9$k$H!"(B@dfn{$B$D$M$K%m!<%+%k(B}$B$H0u$,IU$$$?>/?t$NFCJL$J(B
$BJQ?t$r=|$$$F!"$=$N%P%C%U%!$K%m!<%+%k$J$9$Y$F$NJQ?t$r%m!<%+%k$G$J$/$7$^$9!#(B

@findex setq-default
@c   To set the global value of a variable, regardless of whether the
@c variable has a local value in the current buffer, you can use the Lisp
@c construct @code{setq-default}.  This construct is used just like
@c @code{setq}, but it sets variables' global values instead of their local
@c values (if any).  When the current buffer does have a local value, the
@c new global value may not be visible until you switch to another buffer.
@c Here is an example:
$B$"$kJQ?t$,%+%l%s%H%P%C%U%!$G%m!<%+%k$+H]$+$K78$o$i$:(B
$B$=$NJQ?t$N%0%m!<%P%k$JCM$r@_Dj$7$?$1$l$P!"(B@code{setq-default}$B$r;H$$$^$9!#(B
$B$3$l$O(B@code{setq}$B$N$h$&$K;H$o$l$^$9$,!"(B
$B!J$?$H$(%m!<%+%k$JCM$,$"$C$?$H$7$F$b!K$D$M$K%0%m!<%P%k$JCM$N$[$&$r@_Dj$7$^$9!#(B
$B$=$NJQ?t$,%m!<%+%k$JCM$r;}$C$F$$$k>l9g!"(B
$B?7$?$K@_Dj$7$?%0%m!<%P%k$JCM$OJL$N%P%C%U%!$K@Z$jBX$($k$^$G$O;2>H$G$-$^$;$s!#(B
$B0J2<$KNc$r$"$2$^$9!#(B

@example
(setq-default fill-column 75)
@end example

@noindent
@c @code{setq-default} is the only way to set the global value of a variable
@c that has been marked with @code{make-variable-buffer-local}.
@code{setq-default}$B$O!"(B
@code{make-variable-buffer-local}$B$G0u$rIU$1$?JQ?t$N(B
$B%0%m!<%P%k$JCM$r@_Dj$9$kM#0l$NJ}K!$G$9!#(B

@findex default-value
@c   Lisp programs can use @code{default-value} to look at a variable's
@c default value.  This function takes a symbol as argument and returns its
@c default value.  The argument is evaluated; usually you must quote it
@c explicitly.  For example, here's how to obtain the default value of
@c @code{fill-column}:
Lisp$B%W%m%0%i%`Cf$G$O!"JQ?t$N%G%U%)%k%HCM$r;2>H$9$k$?$a$K$O(B
@code{default-value}$B$r;H$($^$9!#(B
$B$3$N4X?t$O%7%s%\%k$r0z?t$H$7!"$=$NJQ?t$N%G%U%)%k%HCM$rJV$7$^$9!#(B
$B0z?t$OI>2A$5$l$k$N$G!"IaDL$O0z?t$r%/%)!<%H$7$^$9!#(B
$B$?$H$($P!"(B@code{fill-column}$B$N%G%U%)%k%HCM$r<hF@$9$k$K$O$D$.$N$h$&$K$7$^$9!#(B

@example
(default-value 'fill-column)
@end example

@node File Variables
@c @subsection Local Variables in Files
@subsection $B%U%!%$%k$K%m!<%+%k$JJQ?t(B
@c @cindex local variables in files
@c @cindex file local variables
@cindex $B%U%!%$%kCf$N%m!<%+%kJQ?t(B
@cindex $B%U%!%$%k$K%m!<%+%k$JJQ?t(B

@c   A file can specify local variable values for use when you edit the
@c file with Emacs.  Visiting the file checks for local variable
@c specifications; it automatically makes these variables local to the
@c buffer, and sets them to the values specified in the file.
Emacs$B$G%U%!%$%k$rJT=8$9$k:]$K!"$=$N%U%!%$%k$KBP1~$7$?%m!<%+%kJQ?t$H(B
$B$=$NCM$r;XDj$9$k$3$H$,$G$-$^$9!#(B
Emacs$B$O%U%!%$%k$rK,Ld$9$k$H!"%m!<%+%kJQ?t;XDj$NM-L5$r8!::$7!"(B
$B$"$l$P;XDj$5$l$?JQ?t$r<+F0E*$K%P%C%U%!$K%m!<%+%k$K$7$F!"(B
$B$=$NCM$r%U%!%$%k$G;XDj$5$l$?CM$K@_Dj$7$^$9!#(B

@c   There are two ways to specify local variable values: in the first
@c line, or with a local variables list.  Here's how to specify them in the
@c first line:
$B%m!<%+%kJQ?t$H$=$NCM$r@_Dj$9$k$K$O(B2$B$D$NJ}K!$,$"$j$^$9!#(B
1$B$D$O%U%!%$%k$N@hF,9T$K=q$/$3$H$G!"(B
$B$b$&(B1$B$D$O%m!<%+%kJQ?t%j%9%H$r=q$/$3$H$G$9!#(B
$B@hF,9T$K=q$/>l9g$O!"$?$H$($P$D$.$N$h$&$K$7$^$9!#(B

@example
-*- mode: @var{modename}; @var{var}: @var{value}; @dots{} -*-
@end example

@noindent
@c You can specify any number of variables/value pairs in this way, each
@c pair with a colon and semicolon as shown above.  @code{mode:
@c @var{modename};} specifies the major mode; this should come first in the
@c line.  The @var{value}s are not evaluated; they are used literally.
@c Here is an example that specifies Lisp mode and sets two variables with
@c numeric values:
$BJQ?t$H$=$NCM$r!V(B:$B!W$G6h@Z$C$?BP$r!V(B;$B!W$G6h@Z$C$FJB$Y!"(B
$B$$$/$D$G$b;XDj$G$-$^$9!#(B
@code{mode: @var{modename};}$B$O%a%8%c!<%b!<%I$r;XDj$9$k$b$N$G!"(B
$B9T$N:G=i$K$"$kI,MW$,$"$j$^$9!#(B
@var{value}$B$OI>2A$5$l$:$K=q$+$l$F$$$k$H$*$j$N$^$^;H$o$l$^$9!#(B
$B0J2<$O!"(BLisp$B%b!<%I$G(B2$B$D$NJQ?t$K?tCM$r@_Dj$9$kNc$G$9!#(B

@smallexample
;; -*-mode: Lisp; fill-column: 75; comment-column: 50; -*-
@end smallexample

@c   You can also specify the coding system for a file in this way: just
@c specify a value for the ``variable'' named @code{coding}.  The ``value''
@c must be a coding system name that Emacs recognizes.  @xref{Coding
@c Systems}.
$B$3$NJ}K!$G$O!"%U%!%$%k$N%3!<%G%#%s%0%7%9%F%`$b;XDj$G$-$^$9!#(B
$B$D$^$j!"(B@code{coding}$B$H$$$&L>A0$N!XJQ?t!Y$KCM$r;XDj$9$l$P$h$$$N$G$9!#(B
$B!XCM!Y$O!"(BEmacs$B$,G'<1$G$-$k%3!<%G%#%s%0%7%9%F%`L>$G$"$kI,MW$,$"$j$^$9!#(B
@xref{Coding Systems}$B!#(B

@c   A @dfn{local variables list} goes near the end of the file, in the
@c last page.  (It is often best to put it on a page by itself.)  The local
@c variables list starts with a line containing the string @samp{Local
@c Variables:}, and ends with a line containing the string @samp{End:}.  In
@c between come the variable names and values, one set per line, as
@c @samp{@var{variable}:@: @var{value}}.  The @var{value}s are not
@c evaluated; they are used literally.  If a file has both a local
@c variables list and a @samp{-*-} line, Emacs processes @emph{everything}
@c in the @samp{-*-} line first, and @emph{everything} in the local
@c variables list afterward.
$B0lJ}!"(B@dfn{$B%m!<%+%kJQ?t%j%9%H(B}$B$O%U%!%$%k$NKvHx!J:G8e$N%Z!<%8!K$KCV$-$^$9!#(B
$B!J:G8e$N%Z!<%8$K$O%m!<%+%kJQ?t%j%9%H$@$1$rCV$/$H$$$&$N$r4+$a$^$9!#!K(B
$B%m!<%+%kJQ?t%j%9%H$O(B@samp{Local Variables:}$B$H$$$&FbMF$r4^$`9T$G;O$^$j!"(B
@samp{End:}$B$H$$$&FbMF$r4^$`9T$G=*$j$^$9!#(B
$B$3$l$i$N9T$N$"$$$@$K!"(B1$B$D$NJQ?t$K$D$-(B1$B9T$:$D!"(B
@samp{@var{variable}:@: @var{value}}$B$H$$$&7A$GJQ?t$NL>A0$HCM$r;XDj$7$^$9!#(B
@var{value}$B$OI>2A$5$l$:$K%U%!%$%k$K=q$+$l$?$H$*$j$K$=$N$^$^;H$o$l$^$9!#(B
$B%U%!%$%k$K%m!<%+%kJQ?t%j%9%H$H(B@samp{-*-}$B$N9T$,N>J}4^$^$l$F$$$?>l9g$K$O!"(B
Emacs$B$O$^$:(B@samp{-*-}$B$N9T$r(B@emph{$B$9$Y$F(B}$B=hM}$7$F$+$i!"(B
$BB3$$$F%m!<%+%kJQ?t%j%9%H$NFbMF$r(B@emph{$B$9$Y$F(B}$B=hM}$7$^$9!#(B

@c Here is an example of a local variables list:
$B0J2<$K%m!<%+%kJQ?t%j%9%H$NNc$r<($7$^$9!'(B

@example
;;; Local Variables: ***
;;; mode:lisp ***
;;; comment-column:0 ***
;;; comment-start: ";;; "  ***
;;; comment-end:"***" ***
;;; End: ***
@end example

@c   As you see, each line starts with the prefix @samp{;;; } and each line
@c ends with the suffix @samp{ ***}.  Emacs recognizes these as the prefix
@c and suffix based on the first line of the list, by finding them
@c surrounding the magic string @samp{Local Variables:}; then it
@c automatically discards them from the other lines of the list.
$B>e$NNc$G$O!"3F9T$O(B@samp{;;;}$B$G;O$^$j(B@samp{***}$B$G=*$C$F$$$^$9!#(B
Emacs$B$O$3$l$i$N@\F,<-$H@\Hx<-$r%j%9%H$N:G=i$NFbMF$K4p$E$$$FG'<1$7$^$9!#(B
$B$D$^$j!"FCJL$JJ8;zNs(B@samp{Local Variables:}$B$NA08e$NJ8;zNs$r!"(B
$B$=$l$>$l!"@\F,<-!"@\Hx<-$H$_$J$7!"(B
$B$=$l0J9_$N9T$K$D$$$F$O$3$N@\F,<-$H@\Hx<-$rL5;k$7$^$9!#(B

@c   The usual reason for using a prefix and/or suffix is to embed the
@c local variables list in a comment, so it won't confuse other programs
@c that the file is intended as input for.  The example above is for a
@c language where comment lines start with @samp{;;; } and end with
@c @samp{***}; the local values for @code{comment-start} and
@c @code{comment-end} customize the rest of Emacs for this unusual syntax.
@c Don't use a prefix (or a suffix) if you don't need one.
$B@\F,<-$H@\Hx<-$r;H$&<g$JM}M3$O!"(B
$B%m!<%+%kJQ?t%j%9%H$r%3%a%s%H$NCf$KF~$l$k$3$H$G!"(B
$B$=$N%U%!%$%k$rFI$_9~$`B>$N%W%m%0%i%`$r:$OG$5$;$J$$$h$&$K$9$k$3$H$G$9!#(B
$B>e$NNc$G$O!"%3%a%s%H$,(B@samp{;;;}$B$G;O$^$j(B@samp{***}$B$G=*$k$h$&$J8@8l$r(B
$BA[Dj$7$F$$$^$9!#(B
$BJQ?t(B@code{comment-start}$B$H(B@code{comment-end}$B$N%m!<%+%k$JCM$G!"(B
$B$3$N$h$&$JJQ$J9=J8$KBP=h$9$k$h$&$K(BEmacs$B$r%+%9%?%^%$%:$9$k$N$G$9!#(B
$BI,MW$J$$$N$G$"$l$P!"@\F,<-!J$H@\Hx<-!K$O;H$o$J$$$G$/$@$5$$!#(B

@c   Two ``variable names'' have special meanings in a local variables
@c list: a value for the variable @code{mode} really sets the major mode,
@c and a value for the variable @code{eval} is simply evaluated as an
@c expression and the value is ignored.  @code{mode} and @code{eval} are
@c not real variables; setting variables named @code{mode} and @code{eval}
@c in any other context has no special meaning.  If @code{mode} is used to
@c set a major mode, it should be the first ``variable'' in the list.
$B%m!<%+%kJQ?t%j%9%H$K$*$$$F$O!"(B2$B$D$NJQ?tL>$,FCJL$J0UL#$r;}$A$^$9!#(B
$BJQ?t(B@code{mode}$B$KBP$9$kCM$O!"<B:]$K$O%a%8%c!<%b!<%I$r@_Dj$7$^$9!#(B
$BJQ?t(B@code{eval}$B$KBP$9$kCM$O!"<0$H$7$FI>2A$5$l$^$9$,!"(B
$B$=$N7k2L$O<N$F$i$l$^$9!#(B
@code{mode}$B$H(B@code{eval}$B$OK\Ev$NJQ?t$G$O$J$/!"B>$N>u67$G(B
$B$3$l$i$NL>A0$NJQ?t$KCM$r@_Dj$7$F$b$J$s$iFCJL$J0UL#$r;}$A$^$;$s!#(B
$B%a%8%c!<%b!<%I$r@_Dj$9$k$?$a$K(B@code{mode}$B$r;XDj$9$k>l9g$O!"(B
$B%m!<%+%kJQ?t%j%9%H$N@hF,$K=q$/I,MW$,$"$j$^$9!#(B

@c   You can use the @code{mode} ``variable'' to set minor modes as well as
@c major modes; in fact, you can use it more than once, first to set the
@c major mode and then to set minor modes which are specific to particular
@c buffers.  But most minor modes should not be specified in the file in
@c any fashion, because they represent user preferences.
$B2>A[E*$J!XJQ?t!Y(B@code{mode}$B$O!"%a%8%c!<%b!<%I$@$1$G$J$/%^%$%J%b!<%I$r(B
$B@_Dj$9$k$N$K$b;H$($^$9!#(B
$B<B$O!"$3$N;XDj$O(B2$B2s0J>e;H$&$3$H$,$G$-$F!"(B
$B:G=i$O%a%8%c!<%b!<%I$r@_Dj$7!"(B
$B$=$l0J9_$O!J$=$l$>$l!K%^%$%J%b!<%I$r@_Dj$7$^$9!#(B
$B$7$+$7!"%^%$%J%b!<%I$O%f!<%6!<$N9%$_$K1~$8$FA*$V$b$N$G$9$+$i!"(B
$BIaDL$O%U%!%$%k$G%^%$%J%b!<%I$r;XDj$9$k$Y$-$G$O$J$$$G$7$g$&!#(B

@c   For example, you may be tempted to try to turn on Auto Fill mode with
@c a local variable list.  That is a mistake.  The choice of Auto Fill mode
@c or not is a matter of individual taste, not a matter of the contents of
@c particular files.  If you want to use Auto Fill, set up major mode hooks
@c with your @file{.emacs} file to turn it on (when appropriate) for you
@c alone (@pxref{Init File}).  Don't use a local variable list to impose
@c your taste on everyone.
$B$?$H$($P!"%m!<%+%kJQ?t%j%9%H$G<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$r%*%s$K$7$?$$$H(B
$B;W$&$+$b$7$l$^$;$s$,!"$=$l$O$^$A$,$$$G$9!#(B
$B<+F05M$a9~$_$K$9$k$+$I$&$+$O!"8D?M$N9%$_$NLdBj$G$"$j!"(B
$B%U%!%$%k$NCf?H$K$h$C$F7h$^$k$b$N$G$O$J$$$+$i$G$9!#(B
$B$"$k<oJL$N%U%!%$%k$G$$$D$b<+F05M$a9~$_$K$7$?$1$l$P!"(B
$B8D?M$N(B@file{.emacs}$B%U%!%$%k$G!J>u67$K1~$8$F!K<+F05M$a9~$_!J(Bauto-fill$B!K%b!<%I$r(B
$B%*%s$K$9$k$h$&$J%a%8%c!<%b!<%I$N%U%C%/$r@_Dj$7$F$/$@$5$$(B
$B!J(B@pxref{Init File}$B!K!#(B
$B%m!<%+%kJQ?t%j%9%H$GB>?M$K9%$_$r2!$7IU$1$F$O$$$1$^$;$s!#(B

@c   The start of the local variables list must be no more than 3000
@c characters from the end of the file, and must be in the last page if the
@c file is divided into pages.  Otherwise, Emacs will not notice it is
@c there.  The purpose of this rule is so that a stray @samp{Local
@c Variables:}@: not in the last page does not confuse Emacs, and so that
@c visiting a long file that is all one page and has no local variables
@c list need not take the time to search the whole file.
$B%m!<%+%kJQ?t%j%9%H$O!"%U%!%$%k$NKvHx$+$i(B3000$BJ8;z0JFb$K$"$kI,MW$,$"$j!"(B
$B%U%!%$%k$,%Z!<%8$KJ,$+$l$F$$$k>l9g$K$O:G8e$N%Z!<%8$K$"$kI,MW$,$"$j$^$9!#(B
$B$3$l$i$,<i$i$l$F$$$J$$$H!"(B
Emacs$B$O%m!<%+%kJQ?t%j%9%H$,$"$k$3$H$rG'<1$7$^$;$s!#(B
$B$3$l$i$N5,B'$NL\E*$O!":G8e$G$O$J$$%Z!<%8$K6vA3(B
@samp{Local Variables:}$B$,$"$C$F$b(BEmacs$B$,8mG'$7$J$$$h$&$K$9$k$3$H$H!"(B
$BA4BN$,(B1$B%Z!<%8$G%m!<%+%kJQ?t%j%9%H$r;}$?$J$$D9$$%U%!%$%k$rK,Ld$9$k$H$-$G$b(B
$B%U%!%$%kA4BN$rC5$5$J$/$F$b$9$`$h$&$K$9$k$?$a$G$9!#(B

@c   Use the command @code{normal-mode} to reset the local variables and
@c major mode of a buffer according to the file name and contents,
@c including the local variables list if any.  @xref{Choosing Modes}.
$B%P%C%U%!$N%m!<%+%kJQ?t$d%a%8%c!<%b!<%I$r!"(B
$B%m!<%+%kJQ?t%j%9%H$,$"$k$H$-$K$O$=$l$K$h$k;XDj$b4^$a$F!"(B
$B%U%!%$%kL>$H%U%!%$%k$NFbMF$K4p$E$$$?$b$N$K%j%;%C%H$7$?$1$l$P!"(B
@code{normal-mode}$B%3%^%s%I$r;H$C$F$/$@$5$$!#(B
@xref{Choosing Modes}$B!#(B

@findex enable-local-variables
@c   The variable @code{enable-local-variables} controls whether to process
@c local variables in files, and thus gives you a chance to override them.
@c Its default value is @code{t}, which means do process local variables in
@c files.  If you set the value to @code{nil}, Emacs simply ignores local
@c variables in files.  Any other value says to query you about each file
@c that has local variables, showing you the local variable specifications
@c so you can judge.
$BJQ?t(B@code{enable-local-variables}$B$O!"(B
$B%U%!%$%kCf$N%m!<%+%kJQ?t;XDj$r=hM}$9$k$+H]$+$r@)8f$7$^$9!#(B
$B$D$^$j!"%m!<%+%kJQ?t;XDj$rL5;k$9$k$h$&$K$b$G$-$^$9!#(B
$B%G%U%)%k%H$O(B@code{t}$B$G!"%U%!%$%kCf$N%m!<%+%kJQ?t;XDj$r=hM}$7$^$9!#(B
$BCM$r(B@code{nil}$B$K$9$k$H!"%U%!%$%kCf$N%m!<%+%kJQ?t;XDj$rL5;k$7$^$9!#(B
$B$3$l$i0J30$NCM$N>l9g$O!"%U%!%$%kCf$K%m!<%+%kJQ?t;XDj$,$"$k$H!"(B
$B$=$NFbMF$rI=<($7$F=hM}$9$k$+$I$&$+Ld$$9g$o$;$^$9!#(B

@findex enable-local-eval
@c   The @code{eval} ``variable,'' and certain actual variables, create a
@c special risk; when you visit someone else's file, local variable
@c specifications for these could affect your Emacs in arbitrary ways.
@c Therefore, the option @code{enable-local-eval} controls whether Emacs
@c processes @code{eval} variables, as well variables with names that end
@c in @samp{-hook}, @samp{-hooks}, @samp{-function} or @samp{-functions},
@c and certain other variables.  The three possibilities for the option's
@c value are @code{t}, @code{nil}, and anything else, just as for
@c @code{enable-local-variables}.  The default is @code{maybe}, which is
@c neither @code{t} nor @code{nil}, so normally Emacs does ask for
@c confirmation about file settings for these variables.
$B2>A[E*$J!XJQ?t!Y(B@code{eval}$B$H$$$/$D$+$N!J<B:_$9$k!KJQ?t$KBP$9$k;XDj$O!"(B
$B$"$k<o$N4m81@-$r$b$?$i$7$^$9!#(B
$BB>?M$N%U%!%$%k$rK,Ld$7$?$H$-!"$=$3$K=q$+$l$F$$$k%m!<%+%kJQ?t;XDj$K(B
$B$h$C$F$"$J$?$,;H$C$F$$$k(BEmacs$B$N$U$k$^$$$,$I$N$h$&$K$G$bJQ99$G$-$k$+$i$G$9!#(B
$B$3$N$?$a!"%*%W%7%g%s(B@code{enable-local-eval}$B$K$h$j!"(B
$BJQ?t(B@code{eval}$B!"$5$i$K!"(B@samp{-hook}$B!"(B@samp{-hooks}$B!"(B@samp{-function}$B!"(B
@samp{-functions}$B$H$$$&L>A0$G=*$kJQ?t!"$*$h$S!"B>$N$$$/$D$+$NJQ?t$K(B
$BBP$9$k%m!<%+%kJQ?t;XDj$r=hM}$9$k$+$I$&$+@)8f$G$-$k$h$&$K$J$C$F$$$^$9!#(B
@code{enable-local-variables}$B$HF1$8$h$&$K;XDj$G$-$kCM$O(B3$B<oN`$"$C$F!"(B
@code{t}$B!"(B@code{nil}$B!"$3$l$i0J30$G$9!#(B
$B%G%U%)%k%H$O(B@code{maybe}$B$G!"$3$l$O(B@code{t}$B$G$b(B@code{nil}$B$G$b$"$j$^$;$s$+$i!"(B
Emacs$B$O$3$l$i$N%m!<%+%kJQ?t;XDj$,$"$k$H$-$O3NG'$r5a$a$F$-$^$9!#(B

@node Keyboard Macros
@c @section Keyboard Macros
@section $B%-!<%\!<%I%^%/%m(B

@c @cindex defining keyboard macros
@c @cindex keyboard macro
@cindex $B%-!<%\!<%I%^%/%m$NDj5A(B
@cindex $B%-!<%\!<%I%^%/%m(B
@c   A @dfn{keyboard macro} is a command defined by the user to stand for
@c another sequence of keys.  For example, if you discover that you are
@c about to type @kbd{C-n C-d} forty times, you can speed your work by
@c defining a keyboard macro to do @kbd{C-n C-d} and calling it with a
@c repeat count of forty.
@dfn{$B%-!<%\!<%I%^%/%m(B}$B$O!"(B
$B%f!<%6!<$,0lO"$N%-!<A`:n$K4p$E$$$FDj5A$7$?%3%^%s%I$G$9!#(B
$B$?$H$($P!"(B@kbd{C-n C-d}$B$H$$$&BG80$r(B40$B2s7+$jJV$9I,MW$,$"$k$H$o$+$C$?$i!"(B
@kbd{C-n C-d}$B$r<B9T$9$k%-!<%\!<%I%^%/%m$rDj5A$7!"(B
$B$=$l$r(B40$B2s7+$jJV$9;XDj$r$7$F8F$S=P$9$H?WB.$K:n6H$G$-$^$9!#(B

@c widecommands
@table @kbd
@item C-x (
@c Start defining a keyboard macro (@code{start-kbd-macro}).
$B%-!<%\!<%I%^%/%m$NDj5A$r3+;O$9$k(B
$B!J(B@code{start-kbd-macro}$B!K!#(B
@item C-x )
@c End the definition of a keyboard macro (@code{end-kbd-macro}).
$B%-!<%\!<%I%^%/%m$NDj5A$r=*N;$9$k(B
$B!J(B@code{end-kbd-macro}$B!K!#(B
@item C-x e
@c Execute the most recent keyboard macro (@code{call-last-kbd-macro}).
$B$b$C$H$b:G6a$N%-!<%\!<%I%^%/%m$r<B9T$9$k(B
$B!J(B@code{call-last-kbd-macro}$B!K!#(B
@item C-u C-x (
@c Re-execute last keyboard macro, then add more keys to its definition.
$B$b$C$H$b:G6a$N%-!<%\!<%I%^%/%m$r:F<B9T$7$?$&$($G!"(B
$B$=$NDj5A$K%-!<$rDI2C$9$k!#(B
@item C-x q
@c When this point is reached during macro execution, ask for confirmation
@c (@code{kbd-macro-query}).
$B%-!<%\!<%I%^%/%m$N<B9TCf$K$3$N>l=j$KE~C#$7$?$i!"(B
$B<B9T$N3NG'$r5a$a$k(B
$B!J(B@code{kbd-macro-query}$B!K!#(B
@item M-x name-last-kbd-macro
@c Give a command name (for the duration of the session) to the most
@c recently defined keyboard macro.
$B$b$C$H$b:G6a$KDj5A$7$?%-!<%\!<%I%^%/%m$K!J8=:_$N(BEmacs$B%;%C%7%g%s$@$1$GM-8z$J!K(B
$B%3%^%s%IL>$rM?$($k!#(B
@item M-x insert-kbd-macro
@c Insert in the buffer a keyboard macro's definition, as Lisp code.
$B%-!<%\!<%I%^%/%m$NDj5A$r(BLisp$B%3!<%I$H$7$F%P%C%U%!$KA^F~$9$k!#(B
@item C-x C-k
@c Edit a previously defined keyboard macro (@code{edit-kbd-macro}).
$B$^$($KDj5A$7$?%-!<%\!<%I%^%/%m$rJT=8$9$k(B
$B!J(B@code{edit-kbd-macro}$B!K!#(B
@item M-x apply-macro-to-region-lines
@c Run the last keyboard macro on each complete line in the region.
$B%j!<%8%g%sFb$N3F9T$KBP$7$F!":G8e$KDj5A$7$?%-!<%\!<%I%^%/%m$r<B9T$9$k!#(B
@end table

@c   Keyboard macros differ from ordinary Emacs commands in that they are
@c written in the Emacs command language rather than in Lisp.  This makes it
@c easier for the novice to write them, and makes them more convenient as
@c temporary hacks.  However, the Emacs command language is not powerful
@c enough as a programming language to be useful for writing anything
@c intelligent or general.  For such things, Lisp must be used.
$B%-!<%\!<%I%^%/%m$O!"$=$l$,(BLisp$B$G$O$J$/(BEmacs$B$N%3%^%s%I8@8l$G(B
$B5-=R$5$l$F$$$k$H$$$&E@$G!"DL>o$N(BEmacs$B%3%^%s%I$H$O0c$C$F$$$^$9!#(B
$B$3$N$?$a!"%-!<%\!<%I%^%/%m$O=i?4<T$G$b4JC1$K:n$l!"(B
$B4V$K9g$o$;$H$7$FDj5A$9$k$N$K$b8~$$$F$$$^$9!#(B
$B$7$+$7!"(BEmacs$B$N%3%^%s%I8@8l$O!"(B
$B%W%m%0%i%`8@8l$H$7$FCNE*$GHFMQE*$JF0:n$r5-=R$G$-$k$[$I6/NO$G$O$"$j$^$;$s!#(B
$B$=$&$$$&>l9g$K$O!"(BLisp$B$r;H$C$F$/$@$5$$!#(B

@c   You define a keyboard macro while executing the commands which are the
@c definition.  Put differently, as you define a keyboard macro, the
@c definition is being executed for the first time.  This way, you can see
@c what the effects of your commands are, so that you don't have to figure
@c them out in your head.  When you are finished, the keyboard macro is
@c defined and also has been, in effect, executed once.  You can then do the
@c whole thing over again by invoking the macro.
$B%-!<%\!<%I%^%/%m$O!"Dj5AFbMF$N%3%^%s%INs$r<B:]$K<B9T$7$J$,$iDj5A$G$-$^$9!#(B
$B$$$$$+$($l$P!"%-!<%\!<%I%^%/%m$rDj5A$7$F$$$k$H$-$K!"(B
$B$=$NDj5A$NBh(B1$B2sL\$N<B9T$,9T$o$l$k$3$H$K$J$j$^$9!#(B
$B$G$9$+$i!"%3%^%s%I$,$I$N$h$&$KF0:n$9$k$+$rL\$G8+$J$,$i3NG'$G$-!"(B
$BF,$NCf$@$1$GF0:n$r9M$($k$h$j$b3Z$KDj5A$G$-$^$9!#(B
$B%3%^%s%INs$N:G8e$^$G$-$F%-!<%\!<%I%^%/%m$rDj5A$7=*$k$H!"(B
$BBh(B1$B2sL\$N<B9T$b=*$C$?$3$H$K$J$j$^$9!#(B
$B$=$N$"$H$O!"%^%/%m$r8F$S=P$9$3$H$G2?2s$G$b$=$N%3%^%s%INsA4BN$r<B9T$G$-$^$9!#(B

@menu
* Basic Kbd Macro::     Defining and running keyboard macros.
* Save Kbd Macro::      Giving keyboard macros names; saving them in files.
* Kbd Macro Query::     Making keyboard macros do different things each time.
@end menu

@node Basic Kbd Macro
@c @subsection Basic Use
@subsection $B4pK\E*$J;H$$J}(B

@kindex C-x (
@kindex C-x )
@kindex C-x e
@findex start-kbd-macro
@findex end-kbd-macro
@findex call-last-kbd-macro
@c   To start defining a keyboard macro, type the @kbd{C-x (} command
@c (@code{start-kbd-macro}).  From then on, your keys continue to be
@c executed, but also become part of the definition of the macro.  @samp{Def}
@c appears in the mode line to remind you of what is going on.  When you are
@c finished, the @kbd{C-x )} command (@code{end-kbd-macro}) terminates the
@c definition (without becoming part of it!).  For example,
$B%-!<%\!<%I%^%/%m$NDj5A$r3+;O$9$k$K$O!"(B@kbd{C-x (}$B%3%^%s%I(B
$B!J(B@code{start-kbd-macro}$B!K$rBG$C$F$/$@$5$$!#(B
$B$=$l0J9_BG80$9$k$b$N$ODL>o$I$*$j<B9T$5$l$^$9$,!"(B
$B$=$l$HF1;~$K%-!<%\!<%I%^%/%m$NDj5A$H$7$F<h$j9~$^$l$^$9!#(B
$B%b!<%I9T$K$b$=$N$3$H$rI=$9(B@samp{Def}$B$H$$$&I=<($,8=$l$^$9!#(B
$BDj5A$N=*$j$^$G$-$?$i!"(B@kbd{C-x )}$B!J(B@code{end-kbd-macro}$B!K$rBG$A9~$`$H(B
$B%-!<%\!<%I%^%/%m$NDj5A$,40N;$7$^$9(B
$B!J(B@kbd{C-x )}$B$O%^%/%m$NFbMF$K$O4^$^$l$^$;$s!*!K!#(B
$B$?$H$($P!"(B

@example
C-x ( M-f foo C-x )
@end example

@noindent
@c defines a macro to move forward a word and then insert @samp{foo}.
$B$N$h$&$KBG80$9$k$H!"(B
1$BC18lJ,%]%$%s%H$rA0?J$5$;J8;zNs(B@samp{foo}$B$r%P%C%U%!$KA^F~$9$k!"(B
$B%-!<%\!<%I%^%/%m$rDj5A$G$-$^$9!#(B

@c   The macro thus defined can be invoked again with the @kbd{C-x e}
@c command (@code{call-last-kbd-macro}), which may be given a repeat count
@c as a numeric argument to execute the macro many times.  @kbd{C-x )} can
@c also be given a repeat count as an argument, in which case it repeats
@c the macro that many times right after defining it, but defining the
@c macro counts as the first repetition (since it is executed as you define
@c it).  Therefore, giving @kbd{C-x )} an argument of 4 executes the macro
@c immediately 3 additional times.  An argument of zero to @kbd{C-x e} or
@c @kbd{C-x )} means repeat the macro indefinitely (until it gets an error
@c or you type @kbd{C-g} or, on MS-DOS, @kbd{C-@key{BREAK}}).
$BDj5A$7=*$($?%-!<%\!<%I%^%/%m$O!"(B
$B%3%^%s%I(B@kbd{C-x e}$B!J(B@code{call-last-kbd-macro}$B!K$G:F<B9T$G$-$^$9$7!"(B
$B?t0z?t$H$7$FH?I|2s?t$r;XDj$9$k$3$H$GB??t2s<B9T$9$k$3$H$b$G$-$^$9!#(B
@kbd{C-x )}$B$K$b0z?t$H$7$FH?I|2s?t$r;XDj$G$-!"(B
$B$=$N>l9g$ODj5A40N;$H$H$b$K$?$@$A$K;XDj$7$?2s?t$@$1(B
$B%-!<%\!<%I%^%/%m$r<B9T$7$^$9$,!"(B
$BDj5A$7$F$$$k$H$-!J<B9T$7$F$$$k$N$G!K$r(B1$B2sL\$N<B9T$H$7$F?t$($^$9!#(B
$B$G$9$+$i!"(B@kbd{C-u 4 C-x )}$B$HBG$D$H!"%-!<%\!<%I%^%/%m$r$?$@$A$K(B3$B2s<B9T$7$^$9!#(B
@kbd{C-x e}$B$d(B@kbd{C-x )}$B$KH?I|2s?t(B0$B$r;XDj$9$k$H!"(B
$B%-!<%\!<%I%^%/%m$rL58B2s!"$D$^$j!"%(%i!<$,H/@8$9$k$+!"(B
@kbd{C-g}$B!J(BMS-DOS$B$G$O(B@kbd{C-@key{BREAK}}$B!K$,BG80$5$l$k$^$G!"(B
$B7+$jJV$7<B9T$7$^$9!#(B

@c   If you wish to repeat an operation at regularly spaced places in the
@c text, define a macro and include as part of the macro the commands to move
@c to the next place you want to use it.  For example, if you want to change
@c each line, you should position point at the start of a line, and define a
@c macro to change that line and leave point at the start of the next line.
@c Then repeating the macro will operate on successive lines.
$B%F%-%9%H>e$N5,B'E*$K$H$S$H$S$N0LCV$KBP$7$FA`:n$r9T$$$?$$>l9g$K$O!"(B
$B%-!<%\!<%I%^%/%m$rDj5A$9$k$H$-$K!"$D$.$KE,MQ$7$?$$0LCV$^$G%]%$%s%H$r(B
$B0\F0$9$k%3%^%s%I$r4^$a$F$*$-$^$9!#(B
$B$?$H$($P!"3F9T$K$D$$$FJQ99$r9T$$$?$1$l$P!"(B
$B%]%$%s%H$r9TF,$KCV$$$F$+$i%-!<%\!<%I%^%/%m$rDj5A$7;O$a!"(B
$B:G8e$K%]%$%s%H$r$D$.$N9T$N9TF,$KCV$$$?$H$3$m$GDj5A$r=*$($^$9!#(B
$B%-!<%\!<%I%^%/%m$r7+$jJV$7<B9T$9$k$H!"(B
$B<!!9$HO"B3$9$k9T$KBP$7$FA`:n$r<B9T$G$-$^$9!#(B

@c   After you have terminated the definition of a keyboard macro, you can add
@c to the end of its definition by typing @kbd{C-u C-x (}.  This is equivalent
@c to plain @kbd{C-x (} followed by retyping the whole definition so far.  As
@c a consequence it re-executes the macro as previously defined.
$B%-!<%\!<%I%^%/%m$NDj5A$r40N;$7$F$7$^$C$?$"$H$G$b!"(B
@kbd{C-u C-x (}$B$rBG$A9~$a$P!"$=$NDj5A$NKvHx$KFbMF$rDI2C$G$-$^$9!#(B
$B$3$N%3%^%s%I$O!"(B@kbd{C-x (}$B$KB3$$$F8=:_$N%-!<%\!<%I%^%/%m$N(B
$BDj5AFbMFA4BN$rBG80$7$?$N$HF1$88z2L$r;}$A$^$9!#(B
$B$=$N7k2L!"Dj5A$5$l$?$H$*$j$K%^%/%m$r:F<B9T$7$^$9!#(B

@c   You can use function keys in a keyboard macro, just like keyboard
@c keys.  You can even use mouse events, but be careful about that: when
@c the macro replays the mouse event, it uses the original mouse position
@c of that event, the position that the mouse had while you were defining
@c the macro.  The effect of this may be hard to predict.  (Using the
@c current mouse position would be even less predictable.)
$B%-!<%\!<%I%^%/%m$NCf$G!"DL>o$N%-!<$HF1MM$K%U%!%s%/%7%g%s%-!<$r(B
$B;H$&$3$H$b$G$-$^$9!#(B
$B%^%&%9%$%Y%s%H$r;H$&$3$H$5$($G$-$^$9$,!"$=$N>l9g$OCm0U$7$F$/$@$5$$!#(B
$B%-!<%\!<%I%^%/%m$O%^%&%9%$%Y%s%H$r:F8=$7$^$9$,!"(B
$B%^%&%90LCV$H$7$F$O:G=i$K%-!<%\!<%I%^%/%m$rDj5A$7$?$H$-$N0LCV$,(B
$B$=$N$^$^;H$o$l$^$9!#(B
$B$=$N7k2L$OM=A[$7Fq$$$b$N$K$J$j$^$9!#(B
$B!J8=:_$N%^%&%90LCV$r;H$C$F$b!"7k2L$O$5$i$KM=A[$7Fq$$$b$N$K$J$k!#!K(B

@c   One thing that doesn't always work well in a keyboard macro is the
@c command @kbd{C-M-c} (@code{exit-recursive-edit}).  When this command
@c exits a recursive edit that started within the macro, it works as you'd
@c expect.  But if it exits a recursive edit that started before you
@c invoked the keyboard macro, it also necessarily exits the keyboard macro
@c as part of the process.
$B%-!<%\!<%I%^%/%m$NCf$GI,$:$&$^$/$$$/$H$O8B$i$J$$$3$H$N(B1$B$D$K!"(B
@kbd{C-M-c}$B!J(B@code{exit-recursive-edit}$B!K%3%^%s%I$,$"$j$^$9!#(B
$B$3$N%3%^%s%I$,%^%/%m$NCf$G3+;O$5$;$?:F5"JT=8$r=*$i$;$k>l9g$K$O!"(B
$B4|BT$I$*$j$KF0$/$G$7$g$&!#(B
$B$7$+$7!"$3$N%3%^%s%I$,%-!<%\!<%I%^%/%m$r5/F0$9$k$^$($KF~$C$F$$$?:F5"JT=8$r(B
$B=*$i$;$k$H$9$k$H!"(B
$B$=$N=*N;=hM}$N2aDx$G%-!<%\!<%I%^%/%m$N<B9T$b=*$i$;$F$7$^$$$^$9!#(B

@findex edit-kbd-macro
@kindex C-x C-k
@c   You can edit a keyboard macro already defined by typing @kbd{C-x C-k}
@c (@code{edit-kbd-macro}).  Follow that with the keyboard input that you
@c would use to invoke the macro---@kbd{C-x e} or @kbd{M-x @var{name}} or
@c some other key sequence.  This formats the macro definition in a buffer
@c and enters a specialized major mode for editing it.  Type @kbd{C-h m}
@c once in that buffer to display details of how to edit the macro.  When
@c you are finished editing, type @kbd{C-c C-c}.
$BDj5A:Q$_$N%-!<%\!<%I%^%/%m$rJT=8$9$k$K$O!"(B
@kbd{C-x C-k}$B!J(B@code{edit-kbd-macro}$B!K$HBG$A$^$9!#(B
$B$3$N%3%^%s%I$KB3$1$F%^%/%m$r5/F0$9$kBG80!"$D$^$j!"(B
@kbd{C-x e}$B$d(B@kbd{M-x @var{name}}$B$J$I$N%-!<Ns$rF~$l$^$9!#(B
$B$9$k$H!"%-!<Ns$KBP1~$9$k%-!<%\!<%I%^%/%m$NFbMF$,@07A$5$l$F(B
$BFCJL$JJT=8MQ%a%8%c!<%b!<%I$N%P%C%U%!$KF~$j$^$9!#(B
$B$=$N%P%C%U%!Cf$G(B@kbd{C-h m}$B$HBG$D$HJT=8J}K!$,I=<($5$l$^$9!#(B
$BJT=8$7=*$($?$i(B@kbd{C-c C-c}$B$HBG$A$^$9!#(B

@findex apply-macro-to-region-lines
@c   The command @kbd{M-x apply-macro-to-region-lines} repeats the last
@c defined keyboard macro on each complete line within the current region.
@c It does this line by line, by moving point to the beginning of the line
@c and then executing the macro.
$B%3%^%s%I(B@kbd{M-x apply-macro-to-region-lines}$B$O:G8e$KDj5A$5$l$?(B
$B%-!<%\!<%I%^%/%m$r8=:_$N%j!<%8%g%s$N3F9T$KBP$7$F<B9T$7$^$9!#(B
$B$D$^$j!"3F9T$K$D$$$F!"9TF,$K%]%$%s%H$rCV$$$F$+$i%-!<%\!<%I%^%/%m$r<B9T$7$^$9!#(B

@node Save Kbd Macro
@c @subsection Naming and Saving Keyboard Macros
@subsection $B%-!<%\!<%I%^%/%m$NL?L>$HJ]B8(B

@c @cindex saving keyboard macros
@cindex $B%-!<%\!<%I%^%/%m$NJ]B8(B
@findex name-last-kbd-macro
@c   If you wish to save a keyboard macro for longer than until you define the
@c next one, you must give it a name using @kbd{M-x name-last-kbd-macro}.
@c This reads a name as an argument using the minibuffer and defines that name
@c to execute the macro.  The macro name is a Lisp symbol, and defining it in
@c this way makes it a valid command name for calling with @kbd{M-x} or for
@c binding a key to with @code{global-set-key} (@pxref{Keymaps}).  If you
@c specify a name that has a prior definition other than another keyboard
@c macro, an error message is printed and nothing is changed.
$B?7$?$K$D$.$N%-!<%\!<%I%^%/%m$rDj5A$7$?$"$H$G$b(B
$B8=:_$N%-!<%\!<%I%^%/%m$r;H$$$?$$$J$i!"(B
@kbd{M-x name-last-kbd-macro}$B$G%-!<%\!<%I%^%/%m$KL>A0$r(B
$BIU$1$F$*$/I,MW$,$"$j$^$9!#(B
$B$3$N%3%^%s%I$O!"%_%K%P%C%U%!$GL>A0$rFI$_<h$j!"(B
$B$=$NL>A0$G%-!<%\!<%I%^%/%m$r<B9T$G$-$k$h$&$KDj5A$7$^$9!#(B
$B%^%/%mL>$O(BLisp$B%7%s%\%k$G$"$j!"$3$N$h$&$KDj5A$5$l$F$$$k$N$G!"(B
@kbd{M-x}$B$G8F$S=P$7$?$j(B@code{global-set-key}
$B!J(B@pxref{Keymaps}$B!K$G%-!<$KBP1~IU$1$?$j$G$-$kM-8z$J%3%^%s%IL>$K$J$j$^$9!#(B
$B$=$NL>A0$K%-!<%\!<%I%^%/%m0J30$N$b$N$,$9$G$KDj5A$5$l$F$$$k$H!"(B
$B%(%i!<%a%C%;!<%8$,I=<($5$l2?$NJQ99$b5/$3$j$^$;$s!#(B

@findex insert-kbd-macro
@c   Once a macro has a command name, you can save its definition in a file.
@c Then it can be used in another editing session.  First, visit the file
@c you want to save the definition in.  Then use this command:
$B%-!<%\!<%I%^%/%m$K%3%^%s%IL>$rIU$1$k$H!"$=$NDj5A$r%U%!%$%k$KJ]B8$G$-$^$9!#(B
$B$=$&$9$k$H!"JL$NJT=8%;%C%7%g%s$G;H$($k$h$&$K$J$j$^$9!#(B
$B$^$:!"Dj5A$rJ]B8$7$?$$%U%!%$%k$rK,Ld$7$F$+$i!"(B
$B$D$.$N%3%^%s%I$r;H$C$F$/$@$5$$!#(B

@example
M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
@end example

@noindent
@c This inserts some Lisp code that, when executed later, will define the
@c same macro with the same definition it has now.  (You need not
@c understand Lisp code to do this, because @code{insert-kbd-macro} writes
@c the Lisp code for you.)  Then save the file.  You can load the file
@c later with @code{load-file} (@pxref{Lisp Libraries}).  If the file you
@c save in is your init file @file{~/.emacs} (@pxref{Init File}) then the
@c macro will be defined each time you run Emacs.
$B$3$N%3%^%s%I$O!"<B9T$9$k$H$=$N%-!<%\!<%I%^%/%m$H(B
$BF1$8F0:n$r9T$&(BLisp$B%3!<%I$r%P%C%U%!$KA^F~$7$^$9!#(B
$B!J(B@code{insert-kbd-macro}$B$,(BLisp$B%3!<%I$N@8@.$rBe9T$9$k$N$G!"(B
Lisp$B%3!<%I$rM}2r$9$kI,MW$O$J$$!#!K(B
$B$=$&$7$?$i!"$3$N%U%!%$%k$rJ]B8$7$^$9!#(B
@code{load-file}$B!J(B@pxref{Lisp Libraries}$B!K$G%U%!%$%k$r%m!<%I$G$-$^$9!#(B
$BJ]B8$9$k%U%!%$%k$H$7$F(B@file{~/.emacs}$B!J(B@pxref{Init File}$B!K$r;H$($P!"(B
Emacs$B$r5/F0$9$k$H$D$M$K$=$N%^%/%m$,Dj5A$5$l$^$9!#(B

@c   If you give @code{insert-kbd-macro} a numeric argument, it makes
@c additional Lisp code to record the keys (if any) that you have bound to the
@c keyboard macro, so that the macro will be reassigned the same keys when you
@c load the file.
@code{insert-kbd-macro}$B$K?t0z?t$r;XDj$9$k$H!"(B
$B$5$i$K!J$b$7$"$l$P!K%-!<%\!<%I%^%/%m$K3d$jEv$F$?%-!<$r(B
$B5-O?$9$k(BLisp$B%3!<%I$,DI2C$5$l$k$N$G!"(B
$B%U%!%$%k$r%m!<%I$7$?$H$-$KF1$8%-!<$,%^%/%m$K3d$jEv$F$i$l$^$9!#(B

@node Kbd Macro Query
@c @subsection Executing Macros with Variations
@subsection $BJQ2=$N$"$k%^%/%m$N<B9T(B

@kindex C-x q
@findex kbd-macro-query
@c   Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect
@c similar to that of @code{query-replace}, where the macro asks you each
@c time around whether to make a change.  While defining the macro,
@c type @kbd{C-x q} at the point where you want the query to occur.  During
@c macro definition, the @kbd{C-x q} does nothing, but when you run the
@c macro later, @kbd{C-x q} asks you interactively whether to continue.
@kbd{C-x q}$B!J(B@code{kbd-macro-query}$B!K$r;H$&$H!"(B
@code{query-replace}$B$HF1MM$KJQ99$9$k$+$I$&$+?R$M$F$/$k(B
$B%-!<%\!<%I%^%/%m$r:n$l$^$9!#(B
$B%-!<%\!<%I%^%/%m$rDj5A$7$F$$$k$H$-$K!"Ld$$9g$o$;$,5/$-$F$[$7$$2U=j$G(B
@kbd{C-x q}$B$rBG$A$^$9!#(B
$B%^%/%m$NDj5ACf$O(B@kbd{C-x q}$B$O2?$NF0:n$b$7$^$;$s$,!"(B
$B$"$H$G%^%/%m$r<B9T$5$;$?$H$-$K$O(B@kbd{C-x q}$B$N2U=j$G=hM}$r(B
$BB3$1$k$+$I$&$+?R$M$F$/$k$h$&$K$J$j$^$9!#(B

@c   The valid responses when @kbd{C-x q} asks are @key{SPC} (or @kbd{y}),
@c @key{DEL} (or @kbd{n}), @key{RET} (or @kbd{q}), @kbd{C-l} and @kbd{C-r}.
@c The answers are the same as in @code{query-replace}, though not all of
@c the @code{query-replace} options are meaningful.
@kbd{C-x q}$B$NLd$$9g$o$;$KBP$9$kM-8z$J1~Ez$O!"(B@key{SPC}$B!J$^$?$O(B@kbd{y}$B!K!"(B
@key{DEL}$B!J$^$?$O(B@kbd{n}$B!K!"(B@key{RET}$B!J$^$?$O(B@kbd{q}$B!K!"(B@kbd{C-l}$B!"(B
@kbd{C-r}$B$G$9!#(B
$B$3$l$i$N0UL#$O(B@code{query-replace}$B$HF1$8$G$9$,!"(B
@code{query-replace}$B$N$9$Y$F$N1~Ez$,0UL#$r;}$D$H$O8B$j$^$;$s!#(B

@c   These responses include @key{SPC} to continue, and @key{DEL} to skip
@c the remainder of this repetition of the macro and start right away with
@c the next repetition.  @key{RET} means to skip the remainder of this
@c repetition and cancel further repetitions.  @kbd{C-l} redraws the screen
@c and asks you again for a character to say what to do.
@key{SPC}$B$OB39T!"(B@key{DEL}$B$O$3$N2s$NH?I|$N;D$j$rHt$P$7$F$?$@$A$K$D$.$N(B
$BH?I|$K?J$`$H$$$&0UL#$K$J$j$^$9!#(B
@key{RET}$B$G$O$3$N2s$NH?I|$N;D$j$b0J8e$NH?I|$b$9$Y$F<h$j>C$7$^$9!#(B
@kbd{C-l}$B$O2hLL$r:FIA2h$7!":FEY$I$&$9$k$+$rLd$$9g$o$;$F$-$^$9!#(B

@c   @kbd{C-r} enters a recursive editing level, in which you can perform
@c editing which is not part of the macro.  When you exit the recursive
@c edit using @kbd{C-M-c}, you are asked again how to continue with the
@c keyboard macro.  If you type a @key{SPC} at this time, the rest of the
@c macro definition is executed.  It is up to you to leave point and the
@c text in a state such that the rest of the macro will do what you
@c want.@refill
@kbd{C-r}$B$G:F5"JT=8%l%Y%k$KF~$k$N$G!"$=$3$G%-!<%\!<%I%^%/%m$K$O$J$$(B
$BJT=8$r9T$($^$9!#(B
@kbd{C-M-c}$B$G:F5"JT=8$+$iH4$1$k$H!":FEY$I$&$9$k$+$rJ9$$$F$-$^$9!#(B
$B$3$3$G(B@key{SPC}$B$rBG$D$H!"%-!<%\!<%I%^%/%m$N;D$j$NItJ,$,<B9T$5$l$^$9!#(B
$B%-!<%\!<%I%^%/%m$N;D$j$NItJ,$,K>$_$I$*$j$NF0:n$r$9$k>uBV$K(B
$B%]%$%s%H$d%F%-%9%H$rJ]$C$F$*$/$N$O!"%f!<%6!<$N@UG$$G$9!#(B

@c   @kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument,
@c performs a completely different function.  It enters a recursive edit
@c reading input from the keyboard, both when you type it during the
@c definition of the macro, and when it is executed from the macro.  During
@c definition, the editing you do inside the recursive edit does not become
@c part of the macro.  During macro execution, the recursive edit gives you
@c a chance to do some particularized editing on each repetition.
@c @xref{Recursive Edit}.
@kbd{C-u C-x q}$B!"$D$^$j!"?t0z?t$r;XDj$7$?(B@kbd{C-x q}$B$O!"(B
$B$^$C$?$/0c$C$?F0:n$r$7$^$9!#(B
$B%-!<%\!<%I%^%/%m$NDj5ACf$G$b<B9TCf$G$b!"(B
$B%-!<%\!<%I$+$iF~NO$r<u$1IU$1$k:F5"JT=8$KF~$j$^$9!#(B
$BDj5ACf$N>l9g!":F5"JT=8$NCf$G9T$C$?A`:n$O%^%/%m$N0lIt$K$O$J$j$^$;$s!#(B
$B<B9TCf$N>l9g!":F5"JT=8$NCf$G3FH?I|$4$H$K8DJL$NJT=8$r9T$&5!2q$,F@$i$l$^$9!#(B
@xref{Recursive Edit}$B!#(B

@node Key Bindings
@c @section Customizing Key Bindings
@section $B%-!<%P%$%s%G%#%s%0$N%+%9%?%^%$%:(B
@c @cindex key bindings
@cindex $B%-!<%P%$%s%G%#%s%0(B

@c   This section describes @dfn{key bindings}, which map keys to commands,
@c and @dfn{keymaps}, which record key bindings.  It also explains how
@c to customize key bindings.
$BK\@a$G$O!"%3%^%s%I$r%-!<$KBP1~IU$1$k(B@dfn{$B%-!<%P%$%s%G%#%s%0(B}$B$H!"(B
$B%-!<%P%$%s%G%#%s%0$r5-O?$9$k(B@dfn{$B%-!<%^%C%W(B}$B$K$D$$$F@bL@$7$^$9!#(B
$B$^$?!"%-!<%P%$%s%G%#%s%0$r%+%9%?%^%$%:$9$kJ}K!$K$D$$$F$b@bL@$7$^$9!#(B

@c   Recall that a command is a Lisp function whose definition provides for
@c interactive use.  Like every Lisp function, a command has a function
@c name which usually consists of lower-case letters and hyphens.
$B%3%^%s%I$H$O!"BPOCMxMQ8~$1$KDj5A$5$l$?(BLisp$B4X?t$G(B
$B$"$k$3$H$r;W$$=P$7$F$/$@$5$$!#(B
$B%3%^%s%I$K$O!"B>$N(BLisp$B4X?t$HF1MM!"DL>o!"1Q>.J8;z$H%O%$%U%s$+$i@.$k(B
$B4X?tL>A0$,IU$$$F$$$^$9!#(B

@menu
* Keymaps::             Generalities.  The global keymap.
* Prefix Keymaps::      Keymaps for prefix keys.
* Local Keymaps::       Major and minor modes have their own keymaps.
* Minibuffer Maps::     The minibuffer uses its own local keymaps.
* Rebinding::           How to redefine one key's meaning conveniently.
* Init Rebinding::      Rebinding keys with your init file, @file{.emacs}.
* Function Keys::       Rebinding terminal function keys.
* Named ASCII Chars::   Distinguishing @key{TAB} from @kbd{C-i}, and so on.
* Non-ASCII Rebinding:: Rebinding non-ASCII characters such as Latin-1.
* Mouse Buttons::       Rebinding mouse buttons in Emacs.
* Disabling::           Disabling a command means confirmation is required
                          before it can be executed.  This is done to protect
                          beginners from surprises.
@end menu

@node Keymaps
@c @subsection Keymaps
@subsection $B%-!<%^%C%W(B
@c @cindex keymap
@cindex $B%-!<%^%C%W(B

@c   The bindings between key sequences and command functions are recorded
@c in data structures called @dfn{keymaps}.  Emacs has many of these, each
@c used on particular occasions.
$B%-!<Ns$H%3%^%s%I4X?t$H$NBP1~$O(B@dfn{$B%-!<%^%C%W(B}$B$H8F$P$l$k(B
$B%G!<%?9=B$$KJ];}$5$l$F$$$^$9!#(B
Emacs$B$K$O?tB?$/$N%-!<%^%C%W$,$"$j!"$=$l$>$l$,FCDj$N>lLL$G;H$o$l$^$9!#(B

@c   Recall that a @dfn{key sequence} (@dfn{key}, for short) is a sequence
@c of @dfn{input events} that have a meaning as a unit.  Input events
@c include characters, function keys and mouse buttons---all the inputs
@c that you can send to the computer with your terminal.  A key sequence
@c gets its meaning from its @dfn{binding}, which says what command it
@c runs.  The function of keymaps is to record these bindings.
@dfn{$B%-!<Ns(B}$B!J$^$?$OC1$K(B@dfn{$B%-!<(B}$B!K$H$O!"(B
$B$R$H$^$H$^$j$N0UL#$r;}$D(B@dfn{$BF~NO%$%Y%s%H(B}$B$NJB$S$r$$$$$^$9!#(B
$BF~NO%$%Y%s%H$O!"J8;z!"%U%!%s%/%7%g%s%-!<!"%^%&%9%\%?%s!"(B
$B$D$^$j!"C<Kv$+$i7W;;5!$KAw$k$3$H$,$G$-$k$9$Y$F$NF~NO$+$i@.$j$^$9!#(B
$B%-!<Ns$N0UL#IU$1$O!"$I$N%3%^%s%I$r<B9T$9$k$+$rI=$9(B
@dfn{$B%P%$%s%G%#%s%0(B}$B$K$h$C$F7h$^$j$^$9!#(B
$B%-!<%^%C%W$NLr3d$O!"$3$l$i$N%P%$%s%G%#%s%0$rJ];}$9$k$3$H$G$9!#(B

@c @cindex global keymap
@cindex $B%0%m!<%P%k%-!<%^%C%W(B
@c   The @dfn{global} keymap is the most important keymap because it is
@c always in effect.  The global keymap defines keys for Fundamental mode;
@c most of these definitions are common to most or all major modes.  Each
@c major or minor mode can have its own keymap which overrides the global
@c definitions of some keys.
@dfn{$B%0%m!<%P%k(B}$B%-!<%^%C%W$O$b$C$H$b=EMW$J%-!<%^%C%W$G$9$,!"(B
$B$=$l$O%0%m!<%P%k%-!<%^%C%W$,$D$M$KM-8z$@$+$i$G$9!#(B
$B%0%m!<%P%k%-!<%^%C%W$O4pK\!J(Bfundamental$B!K%b!<%I$N%-!<$rDj5A$7$^$9!#(B
$B$D$^$j!"$=$3$K4^$^$l$kDj5A$NBgItJ,$O!"$[$H$s$I$^$?$O$9$Y$F$N(B
$B%a%8%c!<%b!<%I$K6&DL$N$b$N$G$9!#(B
$B3F%a%8%c!<!?%^%$%J%b!<%I$O!"%0%m!<%P%k%-!<%^%C%W$NDj5A$N0lIt$r(B
$BCV$-49$($k$h$&$JFH<+$N%-!<%^%C%W$r;}$D$3$H$,$G$-$^$9!#(B

@c   For example, a self-inserting character such as @kbd{g} is
@c self-inserting because the global keymap binds it to the command
@c @code{self-insert-command}.  The standard Emacs editing characters such
@c as @kbd{C-a} also get their standard meanings from the global keymap.
@c Commands to rebind keys, such as @kbd{M-x global-set-key}, actually work
@c by storing the new binding in the proper place in the global map.
@c @xref{Rebinding}.
$B$?$H$($P!"(B@kbd{g}$B$N$h$&$J<+8JA^F~J8;z$rBG$D$H$=$NJ8;z$,%P%C%U%!$K(B
$BA^F~$5$l$k$N$O!"%0%m!<%P%k%-!<%^%C%W$G$3$l$i$N%-!<$,(B
@code{self-insert-command}$B$KBP1~IU$1$i$l$F$$$k$+$i$G$9!#(B
$B$^$?!"(B@kbd{C-a}$B$N$h$&$JI8=`$NJT=8%3%^%s%I$b!"(B
$B$=$N0UL#IU$1$O%0%m!<%P%k%-!<%^%C%W$K=q$+$l$F$$$^$9!#(B
@kbd{M-x global-set-key}$B$N$h$&$J%P%$%s%G%#%s%0$rJQ99$9$k%3%^%s%I72$O!"(B
$B%0%m!<%P%k%-!<%^%C%W$NE,@Z$J2U=j$K?7$7$$%P%$%s%G%#%s%0$r=q$-9~$_$^$9!#(B

@c    Meta characters work differently; Emacs translates each Meta
@c character into a pair of characters starting with @key{ESC}.  When you
@c type the character @kbd{M-a} in a key sequence, Emacs replaces it with
@c @kbd{@key{ESC} a}.  A meta key comes in as a single input event, but
@c becomes two events for purposes of key bindings.  The reason for this is
@c historical, and we might change it someday.
$B%a%?J8;z$O$d$d0c$C$?F0:n$K$J$j$^$9!#(B
Emacs$B$G$O!"%a%?J8;z$O(B@key{ESC}$B$G;O$^$kJ8;zNs$KJQ49$5$l$^$9!#(B
$B$G$9$+$i!"(B@kbd{M-a}$B$H$$$&F~NO$O$D$M$K(BEmacs$B$NCf$G$O(B
@kbd{@key{ESC} a}$B$KCV$-49$($i$l$F=hM}$5$l$^$9!#(B
$B$D$^$j!"%a%?J8;z$OC10l$NF~NO%$%Y%s%H$G$9$,!"(B
$B%-!<%P%$%s%G%#%s%0$N4QE@$G$O(B2$B$D$N%$%Y%s%H$H$7$F07$o$l$^$9!#(B
$B$3$&$J$C$F$$$kM}M3$ONr;KE*$J$b$N$G!">-Mh$OJQ$o$k2DG=@-$b$"$j$^$9!#(B

@c @cindex function key
@cindex $B%U%!%s%/%7%g%s%-!<(B
@c   Most modern keyboards have function keys as well as character keys.
@c Function keys send input events just as character keys do, and keymaps
@c can have bindings for them.
$B:G6a$N$[$H$s$I$N%-!<%\!<%I$K$O!"(B
$BJ8;z%-!<$NB>$K%U%!%s%/%7%g%s%-!<$,$"$j$^$9!#(B
$B%U%!%s%/%7%g%s%-!<$OJ8;z%-!<$HF1MM$KF~NO%$%Y%s%H$rAw=P$7!"(B
$B%-!<%^%C%W$O$=$l$KBP1~$9$k%P%$%s%G%#%s%0$rJ];}$9$k$3$H$,$G$-$^$9!#(B

@c   On many terminals, typing a function key actually sends the computer a
@c sequence of characters; the precise details of the sequence depends on
@c which function key and on the model of terminal you are using.  (Often
@c the sequence starts with @kbd{@key{ESC} [}.)  If Emacs understands your
@c terminal type properly, it recognizes the character sequences forming
@c function keys wherever they occur in a key sequence (not just at the
@c beginning).  Thus, for most purposes, you can pretend the function keys
@c reach Emacs directly and ignore their encoding as character sequences.
$BB?$/$NC<Kv$G$O!"%U%!%s%/%7%g%s%-!<$rBG$D$H%3%s%T%e!<%?$K$O(B
$B0lO"$NJ8;zNs$,Aw$i$l$^$9!#(B
$B6qBNE*$K$I$N%U%!%s%/%7%g%s%-!<$,(B
$B$I$s$JJ8;zNs$rAw$k$+$OC<Kv$K$h$C$F$^$A$^$A$G$9!#(B
$B!JB?$/$N>l9g!"J8;zNs$O(B@kbd{@key{ESC} [}$B$G;O$^$k!#!K(B
Emacs$B$,;HMQCf$NC<Kv<oJL$r@5$7$/G'<1$7$F$$$l$P!"(B
$B%-!<Ns!J$N@hF,$G$@$1$G$J$/!K$K8=$l$k%U%!%s%/%7%g%s%-!<$KBP1~$7$?(B
$BJ8;zNs$r@5$7$/H=JL$G$-$^$9!#(B
$B$G$9$+$i!"B?$/$N>l9g!"%U%!%s%/%7%g%s%-!<$NBG80$b(B
1$B$D$NF~NO%$%Y%s%H$H$7$FD>@\(BEmacs$B$KAw$i$l$F$$$k$H$_$J$7$F!"(B
$BJ8;zNs$H$7$F$NI=8=7A<0$OL5;k$7$F$+$^$$$^$;$s!#(B

@c @cindex mouse
@cindex $B%^%&%9(B
@c   Mouse buttons also produce input events.  These events come with other
@c data---the window and position where you pressed or released the button,
@c and a time stamp.  But only the choice of button matters for key
@c bindings; the other data matters only if a command looks at it.
@c (Commands designed for mouse invocation usually do look at the other
@c data.)
$B%^%&%9%\%?%s$bF~NO%$%Y%s%H$rH/@8$5$;$^$9!#(B
$B$3$l$i$N%$%Y%s%H$K$O!"DI2C%G!<%?!"$D$^$j!"(B
$B%\%?%s$r2!$7$?$jJ|$7$?$j$7$?$H$-$N%&%#%s%I%&$H$=$NCf$G$N0LCV!";~9o(B
$B$,IUB0$7$F$$$^$9!#(B
$B$?$@$7!"%-!<%P%$%s%G%#%s%0$K4X$7$F$O!"(B
$B$I$N%\%?%s$,;H$o$l$?$+$@$1$,LdBj$H$J$j$^$9!#(B
$B;D$j$N>pJs$O!"%3%^%s%I$,$3$l$i$N>pJs$r;2>H$9$k>l9g$@$10UL#$r;}$A$^$9!#(B
$B!JDL>o!"%^%&%9$+$i5/F0$G$-$k%3%^%s%I$O!"$3$l$i$N>pJs$r;2>H$9$k!#!K(B

@c   A keymap records definitions for single events.  Interpreting a key
@c sequence of multiple events involves a chain of keymaps.  The first
@c keymap gives a definition for the first event; this definition is
@c another keymap, which is used to look up the second event in the
@c sequence, and so on.
$B%-!<%^%C%W$O(B1$B$D$N%$%Y%s%H$KBP$9$kDj5A$N$_$rJ];}$7$^$9!#(B
$BJ#?t%-!<$NNs$+$i@.$kJ#?t$N%$%Y%s%H$N2r<a$K$O!"(B
$B%-!<%^%C%W$NO":?$,;H$o$l$^$9!#(B
$B:G=i$N%-!<%^%C%W$,:G=i$N%$%Y%s%H$NDj5A$rJ];}$7!"(B
$B$=$NDj5A$,$D$.$N%-!<%^%C%W$K$J$C$F$$$F!"(B
2$BHVL\$N%$%Y%s%H$NDj5A$rJ];}$7!"$H$$$&$h$&$K$J$C$F$$$^$9!#(B

@c   Key sequences can mix function keys and characters.  For example,
@c @kbd{C-x @key{SELECT}} is meaningful.  If you make @key{SELECT} a prefix
@c key, then @kbd{@key{SELECT} C-n} makes sense.  You can even mix mouse
@c events with keyboard events, but we recommend against it, because such
@c sequences are inconvenient to type in.
$B%-!<Ns$K$O%U%!%s%/%7%g%s%-!<$HJ8;z%-!<$H$,:.$6$C$F$$$F$b$+$^$$$^$;$s!#(B
$B$?$H$($P!"(B@kbd{C-x @key{SELECT}}$B$H$$$&$N$b5v$5$l$^$9!#(B
@key{SELECT}$B$r%W%l%U%#%C%/%9%-!<$H$7$FDj5A$7$F$*$1$P!"(B
@kbd{@key{SELECT} C-n}$B$H$$$&$N$b5v$5$l$^$9!#(B
$B%^%&%9%$%Y%s%H$H%-!<%\!<%I%$%Y%s%H$r:.$<$k$3$H$5$(2DG=$G$9$,!"(B
$B$=$&$9$k$HBG$A9~$`$N$,LLE]$G$9$+$i$*4+$a$7$^$;$s!#(B

@c   As a user, you can redefine any key; but it might be best to stick to
@c key sequences that consist of @kbd{C-c} followed by a letter.  These
@c keys are ``reserved for users,'' so they won't conflict with any
@c properly designed Emacs extension.  The function keys @key{F5} through
@c @key{F9} are also reserved for users.  If you redefine some other key,
@c your definition may be overridden by certain extensions or major modes
@c which redefine the same key.
$B%f!<%6!<$O$I$s$J%-!<Ns$G$b:FDj5A$7$FMxMQ$G$-$^$9$,!"(B
@kbd{C-c}$B$KB3$1$F(B1$BJ8;z$H$$$&%-!<Ns$@$1$r;H$&$N$,:GA1$G$9!#(B
$B$3$N%-!<Ns$O!X%f!<%6!<Dj5A$N$?$a$KM=Ls!Y$5$l$F$$$F!"(B
$B@5$7$/@_7W$5$l$?(BEmacs$B$N3F<o3HD%$H$O>WFM$7$J$$$h$&$K$J$C$F$$$k$+$i$G$9!#(B
@key{F5}$B$+$i(B@key{F9}$B$^$G$N%U%!%s%/%7%g%s%-!<$b(B
$B%f!<%6!<Dj5A$N$?$a$KM=Ls$7$F$"$j$^$9!#(B
$B$3$l0J30$N%-!<Ns$r:FDj5A$9$k$H!"(B
$BF1$8%-!<$r:FDj5A$9$k3HD%$d%a%8%c!<%b!<%I$K$h$C$F(B
$B$"$J$?$NDj5A$,>e=q$-$5$l$F$7$^$&2DG=@-$,$"$j$^$9!#(B

@node Prefix Keymaps
@c @subsection Prefix Keymaps
@subsection $B%W%l%U%#%C%/%9%-!<%^%C%W(B

@c   A prefix key such as @kbd{C-x} or @key{ESC} has its own keymap,
@c which holds the definition for the event that immediately follows
@c that prefix.
@kbd{C-x}$B$d(B@key{ESC}$B$N$h$&$J%W%l%U%#%C%/%9%-!<$O(B
$B$=$l$>$l@lMQ$N%-!<%^%C%W$r;}$C$F$$$F!"(B
$B$=$3$K$O$=$N%W%l%U%#%C%/%9%-!<$KB3$/%$%Y%s%H$NDj5A$,J];}$5$l$F$$$^$9!#(B

@c   The definition of a prefix key is usually the keymap to use for
@c looking up the following event.  The definition can also be a Lisp
@c symbol whose function definition is the following keymap; the effect is
@c the same, but it provides a command name for the prefix key that can be
@c used as a description of what the prefix key is for.  Thus, the binding
@c of @kbd{C-x} is the symbol @code{Ctl-X-Prefix}, whose function
@c definition is the keymap for @kbd{C-x} commands.  The definitions of
@c @kbd{C-c}, @kbd{C-x}, @kbd{C-h} and @key{ESC} as prefix keys appear in
@c the global map, so these prefix keys are always available.
$B%W%l%U%#%C%/%9%-!<$NDj5A$O!"DL>o!"$=$l$KB3$/%$%Y%s%H$NDj5A$r8!:w$9$k$?$a$N(B
$B%-!<%^%C%W$G$9!#(B
$B$"$k$$$O!"%W%l%U%#%C%/%9%-!<$NDj5A$,(BLisp$B%7%s%\%k$G$"$C$F!"(B
$B$=$N4X?t$NDj5A$,%-!<%^%C%W$H$$$&$N$b$"$j$^$9!#(B
$B$I$A$i$G$b8z2L$OF1$8$G$9$,!"(B
$B8e<T$G$O!"%W%l%U%#%C%/%9%-!<$K%3%^%s%IL>$rM?$($F$=$NMQES$r<($9$3$H$,$G$-$^$9!#(B
$B$3$N$?$a!"(B@kbd{C-x}$B$K%P%$%s%I$5$l$F$$$k$N$O(B
$B%7%s%\%k(B@code{Ctl-X-Prefix}$B$G$"$j!"(B
$B$=$N4X?tDj5A$O(B@kbd{C-x}$B%3%^%s%I72$KBP1~$9$k%-!<%^%C%W$G$9!#(B
@kbd{C-c}$B!"(B@kbd{C-x}$B!"(B@kbd{C-h}$B!"(B@key{ESC}$B$O(B
$B%0%m!<%P%k%^%C%W$G%W%l%U%#%C%/%9%-!<$H$7$FDj5A$5$l$F$$$^$9$+$i!"(B
$B$3$l$i$O$D$M$K%W%l%U%#%C%/%9%-!<$H$7$F;HMQ$G$-$^$9!#(B

@c   Aside from ordinary prefix keys, there is a fictitious ``prefix key''
@c which represents the menu bar; see @ref{Menu Bar,,,elisp, The Emacs Lisp
@c Reference Manual}, for special information about menu bar key bindings.
@c Mouse button events that invoke pop-up menus are also prefix keys; see
@c @ref{Menu Keymaps,,,elisp, The Emacs Lisp Reference Manual}, for more
@c details.
$BDL>o$N%W%l%U%#%C%/%9%-!<$K2C$($F!"(B
$B%a%K%e!<%P!<$rI=$9!X2>A[E*$J%W%l%U%#%C%/%9%-!<!Y$,$"$j$^$9!#(B
$B%a%K%e!<%P!<$N%-!<%P%$%s%G%#%s%0$K4X$9$kFCJL$JE@$K$D$$$F$O(B
@ref{Menu Bar,,,elisp, The Emacs Lisp Reference Manual}$B$r;2>H$7$F$/$@$5$$!#(B
$B%]%C%W%"%C%W%a%K%e!<$rI=<($5$;$k%^%&%9%\%?%s%$%Y%s%H$b$^$?!"(B
$B%W%l%U%#%C%/%9%-!<$G$9!#(B
$B$3$A$i$N>\:Y$K$D$$$F$O(B
@ref{Menu Keymaps,,,elisp, The Emacs Lisp Reference Manual}$B$r;2>H$7$F$/$@$5$$!#(B

@c   Some prefix keymaps are stored in variables with names:
$B7h$^$C$?JQ?t$K3JG<$5$l$F$$$k%W%l%U%#%C%/%9%-!<%^%C%W$b$"$j$^$9!#(B

@itemize @bullet
@item
@vindex ctl-x-map
@c @code{ctl-x-map} is the variable name for the map used for characters that
@c follow @kbd{C-x}.
@code{ctl-x-map}$B$O(B@kbd{C-x}$B$KB3$/%-!<$rC5$9$?$a$N%^%C%W$rG<$a$?JQ?tL>!#(B
@item
@vindex help-map
@c @code{help-map} is for characters that follow @kbd{C-h}.
@code{help-map}$B$O(B@kbd{C-h}$B$KB3$/%-!<$rC5$9$?$a$N%^%C%W$rG<$a$?JQ?tL>!#(B
@item
@vindex esc-map
@c @code{esc-map} is for characters that follow @key{ESC}.  Thus, all Meta
@c characters are actually defined by this map.
@code{esc-map}$B$O(B@key{ESC}$B$KB3$/%-!<$rC5$9$?$a$N%^%C%W$rG<$a$?JQ?tL>!#(B
$B$D$^$j!"$9$Y$F$N%a%?J8;z$O<B:]$K$O$3$N%^%C%W$GDj5A$5$l$F$$$k!#(B
@item
@vindex ctl-x-4-map
@c @code{ctl-x-4-map} is for characters that follow @kbd{C-x 4}.
@code{ctl-x-4-map}$B$O(B@kbd{C-x 4}$B$KB3$/%-!<$rC5$9$?$a$N%^%C%W$rG<$a$?JQ?tL>!#(B
@item
@vindex mode-specific-map
@c @code{mode-specific-map} is for characters that follow @kbd{C-c}.
@code{mode-specific-map}$B$O(B@kbd{C-c}$B$KB3$/%-!<$rC5$9$?$a$N%^%C%W$rG<$a$?JQ?tL>!#(B
@end itemize

@node Local Keymaps
@c @subsection Local Keymaps
@subsection $B%m!<%+%k%-!<%^%C%W(B

@c @cindex local keymap
@cindex $B%m!<%+%k%-!<%^%C%W(B
@c   So far we have explained the ins and outs of the global map.  Major
@c modes customize Emacs by providing their own key bindings in @dfn{local
@c keymaps}.  For example, C mode overrides @key{TAB} to make it indent the
@c current line for C code.  Portions of text in the buffer can specify
@c their own keymaps to substitute for the keymap of the buffer's major
@c mode.
$B$3$l$^$G$O%0%m!<%P%k%-!<%^%C%W$N=tB&LL$K$D$$$F@bL@$7$^$7$?!#(B
$B%a%8%c!<%b!<%I8GM-$N%-!<%P%$%s%G%#%s%0$r(B
@dfn{$B%m!<%+%k%-!<%^%C%W(B}$B$KDj5A$9$k$3$H$G!"(B
$B3F%a%8%c!<%b!<%I$O(BEmacs$B$NF0:n$rJQ99$7$^$9!#(B
$B$?$H$($P!"(BC$B%b!<%I$G$O!"(B
@key{TAB}$B$r(BC$B$N%3!<%I$N8=:_9T$r;z2<$2$9$k5!G=$K:9$7BX$($^$9!#(B
$B%P%C%U%!Fb$N0lIt$N%F%-%9%H$G!"(B
$B$=$N%P%C%U%!$N%a%8%c!<%b!<%I$N$+$o$j$H$J$k8GM-$N%-!<%^%C%W$r(B
$B;XDj$9$k$3$H$b$G$-$^$9!#(B

@c @cindex minor mode keymap
@cindex $B%^%$%J%b!<%I%-!<%^%C%W(B
@c   Minor modes can also have local keymaps.  Whenever a minor mode is
@c in effect, the definitions in its keymap override both the major
@c mode's local keymap and the global keymap.
$B%^%$%J%b!<%I$b%m!<%+%k%-!<%^%C%W$r;}$F$^$9!#(B
$B$=$N>l9g!"%^%$%J%b!<%I$,@8$-$F$$$k$H$-$K$O!"(B
$B$=$N%-!<%^%C%W$,%a%8%c!<%b!<%I$N%m!<%+%k%-!<%^%C%W(B
$B$d%0%m!<%P%k%-!<%^%C%W$KM%@h$7$^$9!#(B

@vindex c-mode-map
@vindex lisp-mode-map
@c   The local keymaps for Lisp mode and several other major modes always
@c exist even when not in use.  These are kept in variables named
@c @code{lisp-mode-map} and so on.  For major modes less often used, the
@c local keymap is normally constructed only when the mode is used for the
@c first time in a session.  This is to save space.  If you wish to change
@c one of these keymaps, you must use the major mode's @dfn{mode
@c hook}---see below.
Lisp$B%b!<%I$*$h$S$=$NB>$N$$$/$D$+$N%a%8%c!<%b!<%I$N(B
$B%m!<%+%k%-!<%^%C%W$O!"$=$N%b!<%I$r;H$C$F$$$J$$$H$-$G$b$D$M$KB8:_$7$^$9!#(B
$B$3$l$i$N%-!<%^%C%W$O!"(B@code{lisp-mode-map}$B$J$I$NJQ?t$K3JG<$5$l$F$$$^$9!#(B
$B$5$[$IIQHK$K;H$o$l$J$$%a%8%c!<%b!<%I$N>l9g$O!"(B
$B$=$N%b!<%I$,%;%C%7%g%s$NCf$G=i$a$F5/F0$5$l$?$H$-$K(B
$B%m!<%+%k%-!<%^%C%W$,:n$i$l$^$9!#(B
$B$3$l$O!"%a%b%j$r@aLs$9$k$?$a$G$9!#(B
$B$3$N$h$&$J%b!<%I$N%-!<%^%C%W$rJQ99$7$?$$>l9g$K$O!"(B
$BEv3:%a%8%c!<%b!<%I$N(B@dfn{$B%b!<%I%U%C%/(B}$B$r;H$&I,MW$,$"$j$^$9!J0J2<$r;2>H!K!#(B

@c   All minor mode keymaps are created in advance.  There is no way to
@c defer their creation until the first time the minor mode is enabled.
$B$9$Y$F$N%^%$%J%b!<%I$N%-!<%^%C%W$O!"$"$i$+$8$a:n$i$l$F$$$^$9!#(B
$B%^%$%J%b!<%I$N%-!<%^%C%W:n@.$r(B
$B$=$N%^%$%J%b!<%I$,:G=i$K5/F0$5$l$k$^$GCY1d$5$;$kJ}K!$O$"$j$^$;$s!#(B

@c   A local keymap can locally redefine a key as a prefix key by defining
@c it as a prefix keymap.  If the key is also defined globally as a prefix,
@c then its local and global definitions (both keymaps) effectively
@c combine: both of them are used to look up the event that follows the
@c prefix key.  Thus, if the mode's local keymap defines @kbd{C-c} as
@c another keymap, and that keymap defines @kbd{C-z} as a command, this
@c provides a local meaning for @kbd{C-c C-z}.  This does not affect other
@c sequences that start with @kbd{C-c}; if those sequences don't have their
@c own local bindings, their global bindings remain in effect.
$B%m!<%+%k%-!<%^%C%W$G$O!"$=$NCf$N$"$k%-!<$NDj5A$r%W%l%U%#%C%/%9%-!<%^%C%W$H(B
$B$9$k$3$H$G!"$=$N%-!<$r%m!<%+%k$J%W%l%U%#%C%/%9%-!<$H$7$F:FDj5A$G$-$^$9!#(B
$B$=$N%-!<$,%0%m!<%P%k$K$b%W%l%U%#%C%/%9%-!<$G$"$k$HDj5A$5$l$F$$$k$J$i!"(B
$B%m!<%+%k%-!<%^%C%W$H%0%m!<%P%k%-!<%^%C%W$NFbMF$O<B<AE*$KE}9g$5$l!"(B
$B%W%l%U%#%C%/%9%-!<$KB3$/%$%Y%s%H$ON>J}$N%-!<%^%C%W$G8!:w$5$l$^$9!#(B
$B$7$?$,$C$F!"$"$k%b!<%I$N%m!<%+%k%-!<%^%C%W$,(B@kbd{C-c}$B$r(B
$BJL$N%-!<%^%C%W$H$7$FDj5A$7!"(B
$B$=$N%-!<%^%C%W$G$O(B@kbd{C-z}$B$r%3%^%s%I$H$7$FDj5A$9$k$H!"(B
$B$3$l$i$K$h$C$F(B@kbd{C-c C-z}$B$N%m!<%+%k$J0UL#$,M?$($i$l$^$9!#(B
$B$7$+$7!"$3$l$O(B@kbd{C-c}$B$G;O$^$kB>$N%-!<Ns$K$O1F6A$7$^$;$s!#(B
$B$"$k%-!<Ns$,FH<+$N%m!<%+%k$J%P%$%s%G%#%s%0$r;}$?$J$1$l$P!"(B
$B%0%m!<%P%k$J%P%$%s%G%#%s%0$,0UL#$r;}$D$+$i$G$9!#(B

@c   Another way to think of this is that Emacs handles a multi-event key
@c sequence by looking in several keymaps, one by one, for a binding of the
@c whole key sequence.  First it checks the minor mode keymaps for minor
@c modes that are enabled, then it checks the major mode's keymap, and then
@c it checks the global keymap.  This is not precisely how key lookup
@c works, but it's good enough for understanding ordinary circumstances.
$B$$$$$+$($l$P!"(BEmacs$B$,J#?t%$%Y%s%H$+$i@.$k%-!<Ns$r07$&J}K!$O!"(B
$BJ#?t$N%-!<%^%C%W$+$i(B1$B$D$:$D!"%-!<NsA4BN$K0lCW$9$k%P%$%s%G%#%s%0$rC5$9$N$G$9!#(B
$B$^$:!"%^%$%J%b!<%I$,@8$-$F$$$l$P$=$N%-!<%^%C%W$r8!:w$7!"(B
$B$D$.$K%a%8%c!<%b!<%I$N%-!<%^%C%W$r8!:w$7!"(B
$B:G8e$K%0%m!<%P%k%-!<%^%C%W$r8!:w$7$^$9!#(B
$B$3$l$O87L)$K$O%-!<$N8!:wF0:n$H$O0c$$$^$9$,!"(B
$BDL>o$N>u67$G$I$&$J$k$+M}2r$9$k$K$O==J,$G$9!#(B

@c @cindex rebinding major mode keys
@cindex $B%a%8%c!<%b!<%I$N%-!<$N%P%$%G%#%s%0JQ99(B
@c   To change the local bindings of a major mode, you must change the
@c mode's local keymap.  Normally you must wait until the first time the
@c mode is used, because most major modes don't create their keymaps until
@c then.  If you want to specify something in your @file{~/.emacs} file to
@c change a major mode's bindings, you must use the mode's mode hook to
@c delay the change until the mode is first used.
$B%a%8%c!<%b!<%I$N%m!<%+%k%P%$%s%G%#%s%0$rJQ99$9$k$K$O!"(B
$B$=$N%b!<%I$N%m!<%+%k%-!<%^%C%W$rJQ99$9$kI,MW$,$"$j$^$9!#(B
$BDL>o!"$=$N$?$a$K$O$=$N%b!<%I$,:G=i$K;H$o$l$k$^$GBT$DI,MW$,$"$j$^$9!#(B
$B$H$$$&$N$O!"$[$I$s$I$N%a%8%c!<%b!<%I$O(B
$B;H$o$l$k$^$G%-!<%^%C%W$r:n@.$7$J$$$+$i$G$9!#(B
$B$G$9$+$i!"8D?M$N(B@file{~/.emacs}$B%U%!%$%k$G(B
$B%a%8%c!<%b!<%I$N%P%$%s%G%#%s%0$rJQ99$7$?$1$l$P!"(B
$B$=$N%b!<%I$N%b!<%I%U%C%/$r;H$C$F$=$N%b!<%I$,:G=i$K;H$o$l$k$^$G(B
$B!JJQ99$r!KCY$i$;$kI,MW$,$"$j$^$9!#(B

@c   For example, the command @code{texinfo-mode} to select Texinfo mode
@c runs the hook @code{texinfo-mode-hook}.  Here's how you can use the hook
@c to add local bindings (not very useful, we admit) for @kbd{C-c n} and
@c @kbd{C-c p} in Texinfo mode:
$B$?$H$($P!"(Btexinfo$B%b!<%I$rA*Br$9$k(B@code{texinfo-mode}$B%3%^%s%I$O(B
$B%U%C%/(B@code{texinfo-mode-hook}$B$r<B9T$7$^$9!#(B
$B$3$N%U%C%/$r;H$C$F(B@kbd{C-c n}$B$H(B@kbd{C-c p}$B$KBP$9$k(B
$B!JM-1W$G$O$J$$$G$9$,!K%m!<%+%k%P%$%s%G%#%s%0$r(B
texinfo$B%b!<%I$KDI2C$9$k$K$O!"$D$.$N$h$&$K$7$^$9!#(B

@example
(add-hook 'texinfo-mode-hook
          '(lambda ()
             (define-key texinfo-mode-map
                         "\C-cp"
                         'backward-paragraph)
             (define-key texinfo-mode-map
                         "\C-cn"
                         'forward-paragraph)
             ))
@end example

@c   @xref{Hooks}.
@xref{Hooks}$B!#(B

@node Minibuffer Maps
@c @subsection Minibuffer Keymaps
@subsection $B%_%K%P%C%U%!$N%-!<%^%C%W(B

@c @cindex minibuffer keymaps
@cindex $B%_%K%P%C%U%!%-!<%^%C%W(B
@vindex minibuffer-local-map
@vindex minibuffer-local-ns-map
@vindex minibuffer-local-completion-map
@vindex minibuffer-local-must-match-map
@c   The minibuffer has its own set of local keymaps; they contain various
@c completion and exit commands.
$B%_%K%P%C%U%!$b0l72$N@lMQ%m!<%+%k%-!<%^%C%W$r;}$C$F$$$^$9!#(B
$B$=$l$i$K$O3F<o$NJd40$dC&=P%3%^%s%I$,Dj5A$5$l$F$$$^$9!#(B

@c = $BJd40$N<oN`(B: $B6/$$!??5=E!?<e$$(B $B!)(B
@itemize @bullet
@item
@c @code{minibuffer-local-map} is used for ordinary input (no completion).
@code{minibuffer-local-map}$B$ODL>o$NF~NO$K;H$o$l$k!JJd40$J$7!K!#(B
@item
@c @code{minibuffer-local-ns-map} is similar, except that @key{SPC} exits
@c just like @key{RET}.  This is used mainly for Mocklisp compatibility.
@code{minibuffer-local-ns-map}$B$bF1MM!#(B
$B$?$@$7!"(B@key{SPC}$B$O!"(B@key{RET}$B$HF1MM$K!"C&=PF0:n$G$"$k!#(B
$B$3$l$O<g$K(BMocklisp$B$H$N8_49@-$N$?$a$K;H$o$l$k!#(B
@item
@c @code{minibuffer-local-completion-map} is for permissive completion.
@code{minibuffer-local-completion-map}$B$O<e$$Jd40$K;H$o$l$k!#(B
@item
@c @code{minibuffer-local-must-match-map} is for strict completion and
@c for cautious completion.
@code{minibuffer-local-must-match-map}$B$O6/$$Jd40$H?5=E$JJd40$K;H$o$l$k!#(B
@end itemize

@node Rebinding
@c @subsection Changing Key Bindings Interactively
@subsection $B%-!<%P%$%s%G%#%s%0$NBPOCE*$JJQ99(B
@c @cindex key rebinding, this session
@c @cindex rebinding keys, this session
@cindex $B%-!<%P%$%s%G%#%s%0$NJQ99!"(B $B%;%C%7%g%sFb(B

@c   The way to redefine an Emacs key is to change its entry in a keymap.
@c You can change the global keymap, in which case the change is effective in
@c all major modes (except those that have their own overriding local
@c definitions for the same key).  Or you can change the current buffer's
@c local map, which affects all buffers using the same major mode.
Emacs$B$N%-!<$r:FDj5A$9$k$K$O!"%-!<%^%C%W$NBP1~$9$k9`L\$r(B
$BJQ99$9$l$P$h$$$N$G$9!#(B
$B%0%m!<%P%k%-!<%^%C%W$rJQ99$9$k$H!"$=$NJQ99$O(B
$B!JF1$8%-!<$KBP$7$FFH<+$N%m!<%+%k$JDj5A$r$7$F$$$k%a%8%c!<%b!<%I$r=|$/!K(B
$B$9$Y$F$N%a%8%c!<%b!<%I$K1F6A$7$^$9!#(B
$B$"$k$$$O!"%+%l%s%H%P%C%U%!$N%m!<%+%k%^%C%W$rJQ99$9$k$H!"(B
$BF1$8%a%8%c!<%b!<%I$r;H$C$F$$$k$9$Y$F%P%C%U%!$K1F6A$,5Z$S$^$9!#(B

@findex global-set-key
@findex local-set-key
@findex global-unset-key
@findex local-unset-key
@table @kbd
@item M-x global-set-key @key{RET} @var{key} @var{cmd} @key{RET}
@c Define @var{key} globally to run @var{cmd}.
@var{cmd}$B$r<B9T$9$k$h$&$K(B@var{key}$B$r%0%m!<%P%k$KDj5A$9$k!#(B
@item M-x local-set-key @key{RET} @var{key} @var{cmd} @key{RET}
@c Define @var{key} locally (in the major mode now in effect) to run
@c @var{cmd}.
@var{cmd}$B$r<B9T$9$k$h$&$K(B@var{key}$B$r!J8=:_$N%a%8%c!<%b!<%I$G!K(B
$B%m!<%+%k$KDj5A$9$k!#(B
@item M-x global-unset-key @key{RET} @var{key}
@c Make @var{key} undefined in the global map.
@var{key}$B$r%0%m!<%P%k%^%C%W$GL$Dj5A$K$9$k!#(B
@item M-x local-unset-key @key{RET} @var{key}
@c Make @var{key} undefined locally (in the major mode now in effect).
@var{key}$B$r!J8=:_$N%a%8%c!<%b!<%I$G!K%m!<%+%k$KL$Dj5A$K$9$k!#(B
@end table

@c   For example, suppose you like to execute commands in a subshell within
@c an Emacs buffer, instead of suspending Emacs and executing commands in
@c your login shell.  Normally, @kbd{C-z} is bound to the function
@c @code{suspend-emacs} (when not using the X Window System), but you can
@c change @kbd{C-z} to invoke an interactive subshell within Emacs, by
@c binding it to @code{shell} as follows:
$B$?$H$($P!"(BEmacs$B$r5Y;_$7$F%m%0%$%s%7%'%k$G%3%^%s%I$r<B9T$9$k$+$o$j$K!"(B
Emacs$B%P%C%U%!Fb$N%5%V%7%'%k$G%3%^%s%I$r<B9T$7$?$$$H$7$^$9!#(B
$BDL>o!"!J(BX$B%&%#%s%I%&%7%9%F%`$r;H$C$F$$$J$$>l9g!K(B@kbd{C-z}$B$O(B
$B4X?t(B@code{suspend-emacs}$B$K%P%$%s%I$5$l$F$$$^$9$,!"(B
$B$D$.$N$h$&$K$3$N%-!<$r(B@code{shell}$B$K%P%$%s%I$9$l$P!"(B
$B$3$N%-!<$G(BEmacs$BFb$NBPOCE*%5%V%7%'%k$r5/F0$9$k$h$&$KJQ99$G$-$^$9!#(B

@example
M-x global-set-key @key{RET} C-z shell @key{RET}
@end example

@noindent
@c @code{global-set-key} reads the command name after the key.   After you
@c press the key, a message like this appears so that you can confirm that
@c you are binding the key you want:
@code{global-set-key}$B$O%-!<Ns$KB3$1$F%3%^%s%IL>$rFI$_<h$j$^$9!#(B
$B;H$$$?$$%-!<$rBG80$9$k$H!"$I$N%-!<$r%P%$%s%I$7$?$$$N$+$r(B
$B3NG'$9$k$D$.$N$h$&$J%a%C%;!<%8$,I=<($5$l$^$9!#(B

@example
Set key C-z to command: 
@end example

@c   You can redefine function keys and mouse events in the same way; just
@c type the function key or click the mouse when it's time to specify the
@c key to rebind.
$BF1$8<j=g$G!"%U%!%s%/%7%g%s%-!<$d%^%&%9%$%Y%s%H$r:FDj5A$G$-$^$9!#(B
$B%P%$%s%I$9$Y$-%-!<$r;XDj$9$k$H$-$K!"(B
$B%-!<$N$+$o$j$K%U%!%s%/%7%g%s%-!<$r2!$7$?$j%^%&%9%\%?%s$r%/%j%C%/$7$F$/$@$5$$!#(B

@c   You can rebind a key that contains more than one event in the same
@c way.  Emacs keeps reading the key to rebind until it is a complete key
@c (that is, not a prefix key).  Thus, if you type @kbd{C-f} for
@c @var{key}, that's the end; the minibuffer is entered immediately to
@c read @var{cmd}.  But if you type @kbd{C-x}, another character is read;
@c if that is @kbd{4}, another character is read, and so on.  For
@c example,
$BJ#?t%$%Y%s%H$+$i@.$k%-!<$bC10l%$%Y%s%H$N%-!<$HF1MM$K$7$F:FDj5A$G$-$^$9!#(B
Emacs$B$O:FDj5A$9$Y$-%-!<Ns$,40@.$9$k$^$G!J$D$^$j%W%l%U%#%C%/%9%-!<$G$O$J$$(B
$B%-!<$,=P$F$/$k$^$G!K%$%Y%s%H$rFI$_B3$1$^$9!#(B
$B$?$H$($P!"(B@var{key}$B$H$7$F(B@kbd{C-f}$B$rBG$F$P$=$l$G=*$j$G$9$+$i!"(B
$B%_%K%P%C%U%!$O$?$@$A$K(B@var{cmd}$B$rFI$`>uBV$K$J$j$^$9!#(B
$B0lJ}!"(B@kbd{C-x}$B$rBG$D$H$5$i$K$=$N@h$N%-!<$rFI$_$^$9!#(B
$B$=$3$G(B@kbd{4}$B$rBG$D$H!"$5$i$K$=$N@h$N%-!<$,FI$^$l$k!"$H$$$&$h$&$K$J$j$^$9!#(B
$B$?$H$($P!"(B

@example
M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET}
@end example

@noindent
@c redefines @kbd{C-x 4 $} to run the (fictitious) command
@c @code{spell-other-window}.
$B$G$O!"(B@kbd{C-x 4 $}$B$r!J<B:_$7$J$$!K%3%^%s%I(B@code{spell-other-window}$B$K(B
$B%P%$%s%I$7$^$9!#(B

@c   The two-character keys consisting of @kbd{C-c} followed by a letter
@c are reserved for user customizations.  Lisp programs are not supposed to
@c define these keys, so the bindings you make for them will be available
@c in all major modes and will never get in the way of anything.
@kbd{C-c}$B$KB3$1$F1Q;z$H$$$&(B2$BJ8;z$N%-!<Ns$O!"(B
$B%f!<%6!<$N%+%9%?%^%$%:MQ$KM=Ls$5$l$F$$$^$9!#(B
Lisp$B%W%m%0%i%`$O$3$l$i$N%-!<Ns$rDj5A$7$J$$$3$H$K$J$C$F$$$^$9$+$i!"(B
$B$3$l$i$N%-!<Ns$N%P%$%s%G%#%s%0$O$I$N%a%8%c!<%b!<%I$G$b;H$(!"(B
$B$$$+$J$k5!G=$H$b43>D$7$J$$$O$:$G$9!#(B

@c   You can remove the global definition of a key with
@c @code{global-unset-key}.  This makes the key @dfn{undefined}; if you
@c type it, Emacs will just beep.  Similarly, @code{local-unset-key} makes
@c a key undefined in the current major mode keymap, which makes the global
@c definition (or lack of one) come back into effect in that major mode.
@code{global-unset-key}$B$G%-!<$N%0%m!<%P%k$JDj5A$r<h$j=|$1$^$9!#(B
$B$=$N%-!<$O(B@dfn{$BL$Dj5A(B}$B$K$J$j$^$9!#(B
$BL$Dj5A$N%-!<$rBG$D$H!"(BEmacs$B$O%Y%k$rLD$i$7$^$9!#(B
$BF1MM$K!"(B@code{local-unset-key}$B$O8=:_$N%a%8%c!<%b!<%I$G%-!<$r(B
$BL$Dj5A$K$7$^$9$+$i!"%0%m!<%P%k$JDj5A!J$"$k$$$O%0%m!<%P%k$G$NL$Dj5A>uBV!K$,(B
$B8=:_$N%a%8%c!<%b!<%I$G$U$?$?$SM-8z$K$J$j$^$9!#(B

@c   If you have redefined (or undefined) a key and you subsequently wish
@c to retract the change, undefining the key will not do the job---you need
@c to redefine the key with its standard definition.  To find the name of
@c the standard definition of a key, go to a Fundamental mode buffer and
@c use @kbd{C-h c}.  The documentation of keys in this manual also lists
@c their command names.
$B%-!<$r:FDj5A!J$^$?$OL$Dj5A$K!K$7$F!"$"$H$G$b$H$KLa$7$?$$$H;W$C$?>l9g!"(B
$B%-!<$rL$Dj5A$K$7$F$b$b$H$K$OLa$j$^$;$s!#(B
$B%-!<$NI8=`Dj5A$r@_Dj$7D>$9I,MW$,$"$j$^$9!#(B
$B%-!<$NI8=`Dj5A$rD4$Y$k$K$O!"4pK\!J(Bfundamental$B!K%b!<%I$N%P%C%U%!$K(B
$B$$$C$F(B@kbd{C-h c}$B$r;H$$$^$9!#(B
$BK\=q$N%-!<$N@bL@$K$b%3%^%s%IL>$r7G:\$7$F$"$j$^$9!#(B

@c   If you want to prevent yourself from invoking a command by mistake, it
@c is better to disable the command than to undefine the key.  A disabled
@c command is less work to invoke when you really want to.
@c @xref{Disabling}.
$B$^$A$,$C$F!"$"$k%3%^%s%I$r<B9T$9$k$3$H$rKI$.$?$1$l$P!"(B
$B%-!<$rL$Dj5A$K$9$k$N$G$J$/!"%3%^%s%I$r;HMQ6X;_$K$9$k$N$,$h$$$G$7$g$&!#(B
$BI,MW$K$J$C$?$H$-$K;HMQ6X;_%3%^%s%I$r5/F0$9$k$N$OB$:n$b$"$j$^$;$s!#(B

@node Init Rebinding
@c @subsection Rebinding Keys in Your Init File
@subsection $B=i4|2=%U%!%$%k$G$N%-!<$NJQ99(B

@findex define-key
@findex substitute-key-definition
@c   If you have a set of key bindings that you like to use all the time,
@c you can specify them in your @file{.emacs} file by using their Lisp
@c syntax.
$B$$$D$G$b$"$k%-!<%P%$%s%G%#%s%0$r@_Dj$7$F$*$-$?$1$l$P!"(B
$B$=$N;XDj$r8D?M$N(B@file{.emacs}$B%U%!%$%k$K(BLisp$B$N%3!<%I$H$7$F=q$$$F$*$-$^$9!#(B

@c   The simplest method for doing this works for ASCII characters and
@c Meta-modified ASCII characters only.  This method uses a string to
@c represent the key sequence you want to rebind.  For example, here's how
@c to bind @kbd{C-z} to @code{shell}:
$B$3$l$r9T$&$b$C$H$b4JC1$JJ}K!$O!"(B
ASCII$BJ8;z$H%a%?=$>~IU$-$N(BASCII$BJ8;z$KBP$7$F$N$_;H$($^$9!#(B
$B$?$H$($P!"(B@kbd{C-z}$B$r(B@code{shell}$B$K%P%$%s%I$9$k$K$O$D$.$N$h$&$K$7$^$9!#(B

@example
(global-set-key "\C-z" 'shell)
@end example

@noindent
@c This example uses a string constant containing one character, @kbd{C-z}.
@c The single-quote before the command name, @code{shell}, marks it as a
@c constant symbol rather than a variable.  If you omit the quote, Emacs
@c would try to evaluate @code{shell} immediately as a variable.  This
@c probably causes an error; it certainly isn't what you want.
$B$3$NNc$G$O(B1$B$D$NJ8;z(B@kbd{C-z}$B$+$i@.$kJ8;zNsDj?t$r;XDj$7$F$$$^$9!#(B
$B%3%^%s%IL>(B@code{shell}$B$N$^$($N%/%)!<%H!V(B'$B!W$O!"(B
@code{shell}$B$rJQ?t$G$O$J$/Dj?t%7%s%\%k$H$7$F07$&0u$G$9!#(B
$B%/%)!<%H$,$J$$$H!"(BEmacs$B$O(B@code{shell}$B$rJQ?t$H$7$F(B
$B$=$NCM$r$?$@$A$KI>2A$7$h$&$H$7$^$9!#(B
$B$9$k$H!"K>$s$G$$$k$3$H$G$O$J$/!"%(%i!<$K$J$j$^$9!#(B

@c   Here is another example that binds a key sequence two characters long:
$B$D$.$O!"(B2$BJ8;z$N%-!<Ns$r%P%$%s%I$9$kNc$G$9!#(B

@example
(global-set-key "\C-xl" 'make-symbolic-link)
@end example

@c   When the key sequence includes function keys or mouse button events,
@c or non-ASCII characters such as @code{C-=} or @code{H-a}, you must use
@c the more general method of rebinding, which uses a vector to specify the
@c key sequence.
$B%-!<Ns$K%U%!%s%/%7%g%s%-!<$d%^%&%9%\%?%s%$%Y%s%H$,4^$^$l$F$$$?$j!"(B
@code{C-=}$B$d(B@code{H-a}$B$J$I$NHs(BASCII$BJ8;z$,4^$^$l$F$$$k$J$i!"(B
$BJ8;zNs$h$j$b$C$H0lHLE*$J;XDjJ}K!$G$"$k%Y%/%?$r;H$C$?;XDj$r;H$&I,MW$,$"$j$^$9!#(B

@c   The way to write a vector in Emacs Lisp is with square brackets around
@c the vector elements.  Use spaces to separate the elements.  If an
@c element is a symbol, simply write the symbol's name---no other
@c delimiters or punctuation are needed.  If a vector element is a
@c character, write it as a Lisp character constant: @samp{?} followed by
@c the character as it would appear in a string.
Emacs Lisp$B$G$N%Y%/%?$N=q$-J}$O!"$=$NMWAG$rCf3g8L!J(B@samp{[@dots{}]}$B!K$G(B
$B0O$_$^$9!#(B
$BMWAG$O6uGr$G6h@Z$j$^$9!#(B
$BMWAG$,%7%s%\%k$G$"$l$P!"C1$K$=$NL>A0$@$1$r=q$1$P$h$/!"(B
$B6h@Z$j5-9f$J$I$OITMW$G$9!#(B
$BMWAG$,J8;z$G$"$l$P!"(BLisp$B$NJ8;zDj?t$H$7$F!"(B
$B$D$^$j(B@samp{?}$B$KB3$1$F$=$NJ8;z$,J8;zNsCf$K8=$l$k$N$HF1$8=q$-J}$G!"(B
$B=q$$$F$/$@$5$$!#(B

@c   Here are examples of using vectors to rebind @kbd{C-=} (a control
@c character outside of ASCII), @kbd{H-a} (a Hyper character; ASCII doesn't
@c have Hyper at all), @key{F7} (a function key), and @kbd{C-Mouse-1} (a
@c keyboard-modified mouse button):
$B%Y%/%?$r;H$C$F(B@kbd{C-=}$B!J(BASCII$B$NHO0O$K$J$$%3%s%H%m!<%kJ8;z!K!"(B
@kbd{H-a}$B!J%O%$%Q!<J8;z!#(BASCII$B$K$O%O%$%Q!<J8;z$O4^$^$l$J$$!K!"(B
@key{F7}$B!J%U%!%s%/%7%g%s%-!<!K!"(B
@kbd{C-Mouse-1}$B!J%-!<%\!<%I=$>~IU$-$N%^%&%9%\%?%s!K$r(B
$B%P%$%s%I$9$kNc$r<($7$^$9!#(B

@example
(global-set-key [?\C-=] 'make-symbolic-link)
(global-set-key [?\H-a] 'make-symbolic-link)
(global-set-key [f7] 'make-symbolic-link)
(global-set-key [C-mouse-1] 'make-symbolic-link)
@end example

@c   You can use a vector for the simple cases too.  Here's how to rewrite
@c the first two examples, above, to use vectors:
$BC1=c$J!JJ8;zNs$G$9$`!K>l9g$K%Y%/%?$r;H$C$F$b$+$^$$$^$;$s!#(B
$B@h$N(B2$B$D$NNc$r%Y%/%?$r;H$&$h$&$K=q$-D>$9$H$D$.$N$h$&$K$J$j$^$9!#(B

@example
(global-set-key [?\C-z] 'shell)

(global-set-key [?\C-x ?l] 'make-symbolic-link)
@end example

@node Function Keys
@c @subsection Rebinding Function Keys
@subsection $B%U%!%s%/%7%g%s%-!<$N:FDj5A(B

@c   Key sequences can contain function keys as well as ordinary
@c characters.  Just as Lisp characters (actually integers) represent
@c keyboard characters, Lisp symbols represent function keys.  If the
@c function key has a word as its label, then that word is also the name of
@c the corresponding Lisp symbol.  Here are the conventional Lisp names for
@c common function keys:
$B%-!<Ns$K$ODL>o$NJ8;z0J30$K$b%U%!%s%/%7%g%s%-!<$r4^$a$k$3$H$,$G$-$^$9!#(B
$B%-!<%\!<%I$NJ8;z$,(BLisp$B$NJ8;z!J<B$O@0?t$G$9!K$GI=$5$l$k$N$KBP$7!"(B
$B%U%!%s%/%7%g%s%-!<$O(BLisp$B%7%s%\%k$GI=$5$l$^$9!#(B
$B%U%!%s%/%7%g%s%-!<$KC18l$N%i%Y%k$,IU$$$F$$$k$J$i!"(B
$B$=$NC18l$,BP1~$9$k(BLisp$B%7%s%\%k$NL>A0$K$J$j$^$9!#(B
$B$?$H$($PIaDL$K8+$i$l$k%U%!%s%/%7%g%s%-!<$H(BLisp$B%7%s%\%k$NBP1~$O$D$.$N$H$*$j$G$9!#(B

@table @asis
@item @code{left}, @code{up}, @code{right}, @code{down}
@c Cursor arrow keys.
$B%+!<%=%kLp0u%-!<!#(B

@item @code{begin}, @code{end}, @code{home}, @code{next}, @code{prior}
@c Other cursor repositioning keys.
$B$=$NB>$N%+!<%=%k0\F0%-!<!#(B

@item @code{select}, @code{print}, @code{execute}, @code{backtab}
@itemx @code{insert}, @code{undo}, @code{redo}, @code{clearline}
@itemx @code{insertline}, @code{deleteline}, @code{insertchar}, @code{deletechar}
@c Miscellaneous function keys.
$B$=$NB>$N%U%!%s%/%7%g%s%-!<!#(B

@item @code{f1}, @code{f2}, @dots{} @code{f35}
@c Numbered function keys (across the top of the keyboard).
$B!J%-!<%\!<%I$N>eC<$KJB$s$G$$$k!KHV9f$NIU$$$?%U%!%s%/%7%g%s%-!<!#(B

@item @code{kp-add}, @code{kp-subtract}, @code{kp-multiply}, @code{kp-divide}
@itemx @code{kp-backtab}, @code{kp-space}, @code{kp-tab}, @code{kp-enter}
@itemx @code{kp-separator}, @code{kp-decimal}, @code{kp-equal}
@c Keypad keys (to the right of the regular keyboard), with names or punctuation.
$B!JIaDL$N%-!<%\!<%I$N1&B&$K$^$H$^$C$F$$$k!K%-!<%Q%C%I$N%-!<$G!"(B
$BL>A0$d6gFIE@$,0u;z$5$l$F$$$k$b$N!#(B

@item @code{kp-0}, @code{kp-1}, @dots{} @code{kp-9}
@c Keypad keys with digits.
$B%-!<%Q%C%I$N?t;z%-!<(B

@item @code{kp-f1}, @code{kp-f2}, @code{kp-f3}, @code{kp-f4}
@c Keypad PF keys.
$B%-!<%Q%C%I$N(BPF$B%-!<!#(B
@end table

@c   These names are conventional, but some systems (especially when using
@c X windows) may use different names.  To make certain what symbol is used
@c for a given function key on your terminal, type @kbd{C-h c} followed by
@c that key.
$B$3$l$i$NL>A0$O=,47E*$J$b$N$G$9$,!"%7%9%F%`$K$h$C$F$O(B
$B!J$H$j$o$1(BX$B%&%#%s%I%&%7%9%F%`$r;H$C$F$$$k>l9g$O!K!"(B
$BJL$NL>A0$K$J$C$F$$$k>l9g$,$"$j$^$9!#(B
$B$"$k%U%!%s%/%7%g%s%-!<$K$I$N%7%s%\%k$,BP1~$7$F$$$k$+D4$Y$k$K$O!"(B
@kbd{C-h c}$B$KB3$$$F$=$N%-!<$rBG80$7$F$/$@$5$$!#(B

@c   A key sequence which contains function key symbols (or anything but
@c ASCII characters) must be a vector rather than a string.  The vector
@c syntax uses spaces between the elements, and square brackets around the
@c whole vector.  Thus, to bind function key @samp{f1} to the command
@c @code{rmail}, write the following:
$B%U%!%s%/%7%g%s%-!<$N%7%s%\%k$r4^$`%-!<Ns!J$"$k$$$O!"(B
ASCII$B0J30$NJ8;z$r4^$`$b$N!K$OJ8;zNs$G$O$J$/%Y%/%?$G;XDj$7$F$/$@$5$$!#(B
$B%Y%/%?$N9=J8$G$OMWAG$HMWAG$N$"$$$@$O6uGr$G6h@Z$j!"(B
$BA4BN$rCf3g8L(B@samp{@samp{[@dots{}]}}$B$G0O$_$^$9!#(B
$B$?$H$($P!"%U%!%s%/%7%g%s%-!<(B@samp{f1}$B$r%3%^%s%I(B@code{rmail}$B$K%P%$%s%I$9$k$K$O!"(B
$B$D$.$N$h$&$K$7$^$9!#(B

@example
(global-set-key [f1] 'rmail)
@end example

@noindent
@c To bind the right-arrow key to the command @code{forward-char}, you can
@c use this expression:
$B1&Lp0u%-!<$r%3%^%s%I(B@code{fowared-char}$B$K%P%$%s%I$9$k$K$O!"(B
$B$D$.$N$h$&$K$7$^$9!#(B

@example
(global-set-key [right] 'forward-char)
@end example

@noindent
@c This uses the Lisp syntax for a vector containing the symbol
@c @code{right}.  (This binding is present in Emacs by default.)
$B$3$l$O!"%7%s%\%k(B@code{right}$B$rMWAG$H$9$k%Y%/%?$N(BLisp$B9=J8$G$9!#(B
$B!J$3$N%P%$%s%G%#%s%0$O(BEmacs$B$N%G%U%)%k%H@_Dj$KF~$C$F$$$k!#!K(B

@c   @xref{Init Rebinding}, for more information about using vectors for
@c rebinding.
$B%Y%/%?$rMQ$$$?%-!<$N:FDj5A$D$$$F$h$j>\$7$/$O!"(B@xref{Init Rebinding}$B!#(B

@c   You can mix function keys and characters in a key sequence.  This
@c example binds @kbd{C-x @key{NEXT}} to the command @code{forward-page}.
$B%-!<Ns$NCf$G%U%!%s%/%7%g%s%-!<$HJ8;z$r:.$<$k$3$H$,$G$-$^$9!#(B
$B0J2<$NNc$O!"(B
@kbd{C-x @key{NEXT}}$B$r%3%^%s%I(B@code{forward-page}$B$K%P%$%s%I$7$F$$$^$9!#(B

@example
(global-set-key [?\C-x next] 'forward-page)
@end example

@noindent
@c where @code{?\C-x} is the Lisp character constant for the character
@c @kbd{C-x}.  The vector element @code{next} is a symbol and therefore
@c does not take a question mark.
$B$3$3$G!"(B@code{?\C-x}$B$O(BLisp$B$NJ8;zDj?t$G!"J8;z(B@kbd{C-x}$B$rI=$7$^$9!#(B
$B%Y%/%?$N$b$&(B1$B$D$NMWAG$G$"$k(B@code{next}$B$O!"%7%s%\%k$G$9$+$i(B@samp{?}$B$OITMW$G$9!#(B

@c   You can use the modifier keys @key{CTRL}, @key{META}, @key{HYPER},
@c @key{SUPER}, @key{ALT} and @key{SHIFT} with function keys.  To represent
@c these modifiers, add the strings @samp{C-}, @samp{M-}, @samp{H-},
@c @samp{s-}, @samp{A-} and @samp{S-} at the front of the symbol name.
@c Thus, here is how to make @kbd{Hyper-Meta-@key{RIGHT}} move forward a
@c word:
$B%U%!%s%/%7%g%s%-!<$KBP$7$F!"=$>~%-!<(B@key{CTRL}$B!"(B@key{META}$B!"(B@key{HYPER}$B!"(B
@key{SUPER}$B!"(B@key{ALT}$B!"(B@key{SHIFT}$B$r;XDj$G$-$^$9!#(B
$B$3$l$i$N=$>~%-!<$r;XDj$9$k$K$O!"%7%s%\%kL>$N$^$($K(B@samp{C-}$B!"(B
@samp{M-}$B!"(B@samp{H-}$B!"(B@samp{s-}$B!"(B@samp{A-}$B!"(B@samp{S-}$B$rIU$1$F$/$@$5$$!#(B
$B$?$H$($P!"(B@kbd{Hyper-Meta-@key{RIGHT}}$B$G(B
1$B8l@h$X0\F0$9$k$K$O$D$.$N$h$&$K;XDj$7$^$9!#(B

@example
(global-set-key [H-M-right] 'forward-word)
@end example

@node Named ASCII Chars
@c @subsection Named ASCII Control Characters
@subsection $BL>A0$NIU$$$?(BASCII$B%3%s%H%m!<%kJ8;z(B

@c   @key{TAB}, @key{RET}, @key{BS}, @key{LFD}, @key{ESC} and @key{DEL}
@c started out as names for certain ASCII control characters, used so often
@c that they have special keys of their own.  Later, users found it
@c convenient to distinguish in Emacs between these keys and the ``same''
@c control characters typed with the @key{CTRL} key.
@key{TAB}$B!"(B@key{RET}$B!"(B@key{BS}$B!"(B@key{LFD}$B!"(B@key{ESC}$B!"(B@key{DEL}$B$O(B
$B$b$H$b$H(BASCII$B$NFCDj$N%3%s%H%m!<%kJ8;z$KBP1~$7$F$$$?$N$G$9$,!"(B
$B$h$/;H$o$l$k$?$aJL$K$=$l@lMQ$N%-!<$r;}$D$h$&$K$J$j$^$7$?!#(B
$B$N$A$K?M!9$O(BEmacs$B$G$3$l$i$N%-!<$H$=$l$i$H!XF1$8!YJ8;z$r(B
@key{CTRL}$B%-!<$HAH$_9g$o$;$FBG80$7$?>l9g$H$r6hJL$G$-$k$H(B
$BJXMx$@$H5$$,$D$-$^$7$?!#(B

@c   Emacs distinguishes these two kinds of input, when used with the X
@c Window System.  It treats the ``special'' keys as function keys named
@c @code{tab}, @code{return}, @code{backspace}, @code{linefeed},
@c @code{escape}, and @code{delete}.  These function keys translate
@c automatically into the corresponding ASCII characters @emph{if} they
@c have no bindings of their own.  As a result, neither users nor Lisp
@c programs need to pay attention to the distinction unless they care to.
Emacs$B$G$O(BX$B%&%#%s%I%&%7%9%F%`$r;H$C$F$$$k>l9g!"(B
$B$3$l$i(B2$B<oN`$NF~NO$r6hJL$7$^$9!#(B
$B$D$^$j!"%-!<%\!<%I>e$NFC<l%-!<$NJ}$O(B@code{tab}$B!"(B@code{return}$B!"(B
@code{backspace}$B!"(B@code{linefeed}$B!"(B@code{escape}$B!"(B
@code{delete}$B$H$$$&L>A0$N%U%!%s%/%7%g%s%-!<$H$7$F07$&$N$G$9!#(B
$B$3$l$i$N%U%!%s%/%7%g%s%-!<$O!"(B@emph{$B$b$7(B}$B$=$l8GM-$N%P%$%s%G%#%s%0$,(B
$B;XDj$5$l$F$$$J$1$l$P!"<+F0E*$KBP1~$9$k(BASCII$BJ8;z$KJQ49$5$l$^$9!#(B
$B$=$N7k2L!"FC$K$3$N(B2$B<oN`$r6hJL$7$?$$$H;W$o$J$$8B$j$O!"(B
$B%f!<%6!<$b(BLisp$B%W%m%0%i%`$b$3$l$i$N6hJ,$K$D$$$F5$$K$9$kI,MW$O$"$j$^$;$s!#(B

@c   If you do not want to distinguish between (for example) @key{TAB} and
@c @kbd{C-i}, make just one binding, for the ASCII character @key{TAB}
@c (octal code 011).  If you do want to distinguish, make one binding for
@c this ASCII character, and another for the ``function key'' @code{tab}.
$B!J$?$H$($P!K(B@key{TAB}$B$H(B@kbd{C-i}$B$r6hJL$7$?$/$J$$$J$i!"(B
ASCII$BJ8;z(B@key{TAB}$B!J(B8$B?J%3!<%I(B011$B!K$KBP1~$9$k%P%$%s%G%#%s%0(B1$B$D$@$1$r(B
$B;XDj$7$F$/$@$5$$!#(B
$B6hJL$7$?$$$N$J$i!"$3$N(BASCII$BJ8;z$KBP$9$k%P%$%s%G%#%s%0$K2C$($F!"(B
$B!X%U%!%s%/%7%g%s%-!<!Y(B@code{tab}$B$KBP$9$k%P%$%s%G%#%s%0$b;XDj$7$^$9!#(B

@c   With an ordinary ASCII terminal, there is no way to distinguish
@c between @key{TAB} and @kbd{C-i} (and likewise for other such pairs),
@c because the terminal sends the same character in both cases.
$BDL>o$N(BASCII$BC<Kv$G$O!"(B@key{TAB}$B$H(B@kbd{C-i}
$B!J$*$h$S>e5-$NBP1~$9$kAH$N$=$l$>$l!K$r6hJL$9$kJ}K!$O$"$j$^$;$s!#(B
$B$H$$$&$N$O!"C<Kv$O$I$A$i$,2!$5$l$F$bF1$8J8;z$rAw=P$9$k$+$i$G$9!#(B

@node Non-ASCII Rebinding
@c @subsection Non-ASCII Characters on the Keyboard
@subsection $B%-!<%\!<%I>e$NHs(BASCII$BJ8;z(B

@c If your keyboard has keys that send non-ASCII characters, such as
@c accented letters, rebinding these keys is a bit tricky.  There are
@c two solutions you can use.  One is to specify a keyboard coding system,
@c using @code{set-keyboard-coding-system} (@pxref{Specify Coding}).
@c Then you can bind these keys in the usual way, but writing
$B%"%/%;%s%HIU$-J8;z$J$I$NHs(BASCII$BJ8;z$rAw=P$9$k%-!<$,$"$k%-!<%\!<%I$G$O!"(B
$B$=$l$i$N%-!<$N:FDj5A$K$O!">/!9%H%j%C%/$,I,MW$G$9!#(B
2$B$D$N2r7hJ}K!$,$"$j$^$9!#(B
1$B$D$a$O!"(B@code{set-keyboard-coding-system}$B!J(B@pxref{Specify Coding}$B!K$r(B
$B;H$C$F!"%-!<%\!<%I$N%3!<%G%#%s%0%7%9%F%`$r;XDj$9$k$3$H$G$9!#(B
$B$=$&$9$l$P!"$D$.$N$h$&$K=q$$$F!"(B
$BDL>o$NJ}K!$G$=$l$i$N%-!<$r:FDj5A$G$-$^$9!#(B

@example
(global-set-key [?@var{char}] 'some-function)
@end example

@noindent
@c and typing the key you want to bind to insert @var{char}.
$B$?$@$7!"(B@var{char}$B$rA^F~$9$k$K$O!"Dj5A$7$?$$%-!<$rBG$A$^$9!#(B

@c If you don't specify the keyboard coding system, that approach won't
@c work.  Instead, you need to find out the actual code that the terminal
@c sends.  The easiest way to do this in Emacs is to create an empty buffer
@c with @kbd{C-x b temp @key{RET}}, make it unibyte with @kbd{M-x
@c toggle-enable-multibyte-characters @key{RET}}, then type the key to
@c insert the character into this buffer.
$B%-!<%\!<%I$N%3!<%G%#%s%0%7%9%F%`$r;XDj$7$J$$$H!"(B
$B>e$N$h$&$K$O$G$-$^$;$s!#(B
$B$=$N$+$o$j$K!"C<Kv$,<B:]$KAw=P$9$k%3!<%I$rD4$Y$kI,MW$,$"$j$^$9!#(B
Emacs$B$G$3$l$r4JC1$K9T$&$K$O!"(B
@kbd{C-x b temp @key{RET}}$B$G6u%P%C%U%!$r:n@.$7!"(B
@kbd{M-x toggle-enable-multibyte-characters @key{RET}}$B$G%f%K%P%$%H$K(B
$B$7$F$+$i!"$3$N%P%C%U%!$KJ8;z$rA^F~$9$k%-!<$rBG$A$^$9!#(B

@c Move point before the character, then type @kbd{C-b C-x =}.  This
@c displays a message in the minibuffer, showing the character code in
@c three ways, octal, decimal and hexadecimal, all within a set of
@c parentheses.  Use the second of the three numbers, the decimal one,
@c inside the vector to bind:
$BJ8;z$N$^$($K%]%$%s%H$r0\F0$7$F!"(B@kbd{C-b C-x =}$B$HBG$A$^$9!#(B
8$B?J?t!"(B10$B?J?t!"(B16$B?J?t$N(B3$BDL$j$GI=$7$?J8;z%3!<%I$r3g8L$G3g$C$?(B
$B%a%C%;!<%8$,%_%K%P%C%U%!$KI=<($5$l$^$9!#(B
$BDj5A$9$k$K$O!"(B3$B$D$N?t;z$N(B2$BHVL\!"$D$^$j!"(B10$B?J?t$r(B
$B%Y%/%?$NCf$K=q$-$^$9!#(B

@example
(global-set-key [@var{decimal-code}] 'some-function)
@end example

@node Mouse Buttons
@c @subsection Rebinding Mouse Buttons
@subsection $B%^%&%9%\%?%s$N:FDj5A(B
@c @cindex mouse button events
@c @cindex rebinding mouse buttons
@c @cindex click events
@c @cindex drag events
@c @cindex down events
@c @cindex button down events
@cindex $B%^%&%9%\%?%s%$%Y%s%H(B
@cindex $B%^%&%9%\%?%s$N:FDj5A(B
@cindex $B%/%j%C%/%$%Y%s%H(B
@cindex $B%I%i%C%0%$%Y%s%H(B
@cindex $B2!$72<$2%$%Y%s%H(B
@cindex $B%\%?%s2!$72<$2%$%Y%s%H(B

@c   Emacs uses Lisp symbols to designate mouse buttons, too.  The ordinary
@c mouse events in Emacs are @dfn{click} events; these happen when you
@c press a button and release it without moving the mouse.  You can also
@c get @dfn{drag} events, when you move the mouse while holding the button
@c down.  Drag events happen when you finally let go of the button.
Emacs$B$G$O%^%&%9%\%?%s$rI=$9$N$K$b(BLisp$B%7%s%\%k$r;H$$$^$9!#(B
Emacs$B$N$b$C$H$b0lHLE*$J%^%&%9%$%Y%s%H$O(B@dfn{$B%/%j%C%/(B}$B!J(Bclick$B!K%$%Y%s%H$G$9!#(B
$B$3$l$O%^%&%9%\%?%s$r2!$7$F!"%^%&%9$r0\F0$;$:$K%\%?%s$rJ|$7$?$H$-$KH/@8$7$^$9!#(B
$B%\%?%s$r2!$7$?>uBV$G%^%&%9$r0\F0$9$k$H(B
@dfn{$B%I%i%C%0(B}$B!J(Bdrag$B!K%$%Y%s%H$K$J$j$^$9!#(B
$B$=$7$F:G8e$K%^%&%9%\%?%s$rJ|$7$?$H$-$K$b!"(B
$B$d$O$j(B@dfn{$B%I%i%C%0(B}$B%$%Y%s%H$,H/@8$7$^$9!#(B

@c   The symbols for basic click events are @code{mouse-1} for the leftmost
@c button, @code{mouse-2} for the next, and so on.  Here is how you can
@c redefine the second mouse button to split the current window:
$B4pK\E*$J%/%j%C%/%$%Y%s%H$KBP1~$9$k%7%s%\%k$O!"(B
$B:8%\%?%s$KBP$7$F$O(B@code{mouse-1}$B!"(B
$B:8$+$i(B2$BHVL\$N%\%?%s$KBP$7$F$O(B@code{mouse-2}$B!"$J$I$H$J$C$F$$$^$9!#(B
2$BHVL\$N%\%?%s$r%/%j%C%/$7$?$H$-%+%l%s%H%&%#%s%I%&$rJ,3d$9$k$K$O!"(B
$B$D$.$N$h$&$K@_Dj$7$^$9!#(B

@example
(global-set-key [mouse-2] 'split-window-vertically)
@end example

@c   The symbols for drag events are similar, but have the prefix
@c @samp{drag-} before the word @samp{mouse}.  For example, dragging the
@c first button generates a @code{drag-mouse-1} event.
$B%I%i%C%0%$%Y%s%H$K$D$$$F$bF1MM$G$9$,!"(B
$B%$%Y%s%HL>$N(B@samp{mouse}$B$N$^$($K(B@samp{drag-}$B$,IU$-$^$9!#(B
$B$?$H$($P!"Bh(B1$B%\%?%s$r2!$7$?$^$^%I%i%C%0$9$k$H(B
@code{drag-mouse-1}$B%$%Y%s%H$,H/@8$7$^$9!#(B

@c   You can also define bindings for events that occur when a mouse button
@c is pressed down.  These events start with @samp{down-} instead of
@c @samp{drag-}.  Such events are generated only if they have key bindings.
@c When you get a button-down event, a corresponding click or drag event
@c will always follow.
$B%^%&%9%\%?%s$,2!$5$l$?$H$-$KH/@8$9$k%$%Y%s%H$KBP$7$F(B
$B%P%$%s%G%#%s%0$r;XDj$9$k$3$H$b$G$-$^$9!#(B
$B$3$l$i$N%$%Y%s%H$O(B@samp{drag-}$B$N$+$o$j$K(B@samp{down-}$B$G;O$^$j$^$9!#(B
$B$3$l$i$N%$%Y%s%H$O%-!<%P%$%s%G%#%s%0$,Dj5A$5$l$F$$$k$H$-$@$1@8@.$5$l$^$9!#(B
@samp{down-}$B%$%Y%s%H$N$"$H$K$O!"I,$:!"(B
$BBP1~$9$k%/%j%C%/!?%I%i%0%C%$%Y%s%H$,H/@8$7$^$9!#(B

@c @cindex double clicks
@c @cindex triple clicks
@cindex $B%@%V%k%/%j%C%/(B
@cindex $B%H%j%W%k%/%j%C%/(B
@c   If you wish, you can distinguish single, double, and triple clicks.  A
@c double click means clicking a mouse button twice in approximately the
@c same place.  The first click generates an ordinary click event.  The
@c second click, if it comes soon enough, generates a double-click event
@c instead.  The event type for a double-click event starts with
@c @samp{double-}: for example, @code{double-mouse-3}.
$BI,MW$J$i$P!"%7%s%0%k%/%j%C%/!?%@%V%k%/%j%C%/!?%H%j%W%k%/%j%C%/$r(B
$B6hJL$9$k$3$H$b$G$-$^$9!#(B
$B%@%V%k%/%j%C%/$H$O!"$[$\F1$80LCV$G%^%&%9%\%?%s$r(B2$B2s%/%j%C%/$9$k$3$H$G$9!#(B
$B:G=i$N%/%j%C%/$GDL>o$N%/%j%C%/%$%Y%s%H$,H/@8$7$^$9!#(B
$B:G=i$N%/%j%C%/$+$i==J,C;$$;~4VFb$K(B2$B2sL\$N%/%j%C%/$,5/$3$k$H!"(B
$B%/%j%C%/%$%Y%s%H$G$O$J$/%@%V%k%/%j%C%/%$%Y%s%H$,H/@8$7$^$9!#(B
$B%@%V%k%/%j%C%/%$%Y%s%H$O!"(B@samp{double-}$B$G;O$^$j$^$9!#(B
$B$?$H$($P!"(B@code{double-mouse-3}$B$G$9!#(B

@c   This means that you can give a special meaning to the second click at
@c the same place, but it must act on the assumption that the ordinary
@c single click definition has run when the first click was received.
$B$D$^$j!"F1$8>l=j$G(B2$B2s%/%j%C%/$,$"$C$?$H$-!"(B
2$B2sL\$N%/%j%C%/$KFCJL$J0UL#$rM?$($k$3$H$O$G$-$^$9$,!"(B
$B$?$@$7:G=i$N%/%j%C%/$GH/@8$9$kDL>o$N%7%s%0%k%/%j%C%/$K(B
$BBP$7$FDj5A$5$l$?F0:n$b<B9T$5$l$k$3$H$rA0Ds$H$7$J$1$l$P$J$j$^$;$s!#(B

@c   This constrains what you can do with double clicks, but user interface
@c designers say that this constraint ought to be followed in any case.  A
@c double click should do something similar to the single click, only
@c ``more so.''  The command for the double-click event should perform the
@c extra work for the double click.
$B$3$N$h$&$J@)8B$N$?$a!"%@%V%k%/%j%C%/$G9T$($k$3$H$,@)Ls$5$l$^$9$,!"(B
$B%f!<%6!<%$%s%?!<%U%'%$%9%G%6%$%J$O!"$h$$%f!<%6!<%$%s%?!<%U%'%$%9$,(B
$B$D$M$K$=$N$h$&$J@)Ls$K=>$&$Y$-$@$H$N9M$($r=R$Y$F$$$^$9!#(B
$B$D$^$j!"%@%V%k%/%j%C%/$O%7%s%0%k%/%j%C%/$HN`;w$7$?F0:n$r$9$Y$-$G$"$j!"(B
$B!X$=$l$h$j$$$/$i$+B?$/!Y$NF0:n$r$9$k$N$,$h$$!"$H$$$&$3$H$G$9!#(B
$B$=$7$F!"%@%V%k%/%j%C%/%$%Y%s%H$KBP1~$9$k%3%^%s%I$,$=$N(B
$B!V$$$/$i$+B?$/!W$N$V$s$NF0:n$r9T$&$Y$-$@$H$$$&$3$H$G$9!#(B

@c   If a double-click event has no binding, it changes to the
@c corresponding single-click event.  Thus, if you don't define a
@c particular double click specially, it executes the single-click command
@c twice.
$B%@%V%k%/%j%C%/%$%Y%s%H$KBP$7$F%P%$%s%G%#%s%0$,Dj5A$5$l$F$$$J$1$l$P!"(B
$B%@%V%k%/%j%C%/$O(B2$B$D$N%7%s%0%k%/%j%C%/$H$7$F07$o$l$^$9!#(B
$B$=$N7k2L!"%7%s%0%k%/%j%C%/$KBP1~$9$k%3%^%s%I$,(B2$B2s<B9T$5$l$k$3$H$K$J$j$^$9!#(B

@c   Emacs also supports triple-click events whose names start with
@c @samp{triple-}.  Emacs does not distinguish quadruple clicks as event
@c types; clicks beyond the third generate additional triple-click events.
@c However, the full number of clicks is recorded in the event list, so you
@c can distinguish if you really want to.  We don't recommend distinct
@c meanings for more than three clicks, but sometimes it is useful for
@c subsequent clicks to cycle through the same set of three meanings, so
@c that four clicks are equivalent to one click, five are equivalent to
@c two, and six are equivalent to three.
Emacs$B$G$O$5$i$K%H%j%W%k%/%j%C%/%$%Y%s%H$b;H$($^$9(B
$B!J$=$N>l9g!"L>A0$O(B@samp{triple-}$B$G;O$^$k!K!#(B
$B$7$+$7(B4$B=E%/%j%C%/$r%$%Y%s%H%?%$%W$H$7$F6hJL$7$^$;$s!#(B
$B$G$9$+$i!"(B3$B2sL\0J9_$NO"B3$7$?%/%j%C%/$O!"(B
$B$9$Y$F%H%j%W%k%/%j%C%/%$%Y%s%H$H$7$FJs9p$5$l$^$9!#(B
$B$?$@$7!"O"B3$7$?%/%j%C%/$N2s?t$O%$%Y%s%H%j%9%H$K5-O?$5$l$F$$$^$9$+$i!"(B
$BK\Ev$K(B4$B=E0J>e$N%/%j%C%/$r6hJL$7$?$1$l$P$=$&$9$k$3$H$b$G$-$^$9!#(B
4$B=E0J>e$N%/%j%C%/$KFCJL$J0UL#$rM?$($k$N$O$*4+$a$G$-$^$;$s$,!"(B
4$B2s$@$H(B1$B2s$HF1$8!"(B5$B2s$@$H(B2$B2s$HF1$8$H$$$&$h$&$K(B3$B$D$NA*Br;h$N$"$$$@$G(B
$B=d2s$G$-$k$h$&$K$9$k$N$O>l9g$K$h$C$F$OM-8z$+$b$7$l$^$;$s!#(B

@c   Emacs also records multiple presses in drag and button-down events.
@c For example, when you press a button twice, then move the mouse while
@c holding the button, Emacs gets a @samp{double-drag-} event.  And at the
@c moment when you press it down for the second time, Emacs gets a
@c @samp{double-down-} event (which is ignored, like all button-down
@c events, if it has no binding).
Emacs$B$O$^$?!"%I%i%C%0$d%\%?%s%$%Y%s%H$G$bJ#?t2s$N2!$72<$2$r5-O?$7$^$9!#(B
$B$?$H$($P!"%\%?%s$r(B2$B2s2!$7$F$+$i$=$N$^$^%^%&%9$r0\F0$7$?>l9g!"(B
Emacs$B$O(B@samp{double-drag-}$B$G;O$^$k%$%Y%s%H$r@8@.$7$^$9!#(B
$B%I%i%C%0$G$J$/%\%?%s$r2!$72<$2$?$@$1$N>l9g$OF1MM$K!"(B
@samp{double-down-}$B$G;O$^$k%$%Y%s%H$r@8@.$7$^$9(B
$B!J$?$@$7!"B>$N%\%?%s%$%Y%s%H$HF1MM$K!"$=$N%$%Y%s%H$KBP$9$k(B
$B%P%$%s%G%#%s%0$,$J$1$l$PL5;k$5$l$k!K!#(B

@vindex double-click-time
@c   The variable @code{double-click-time} specifies how long may elapse
@c between clicks that are recognized as a pair.  Its value is measured
@c in milliseconds.  If the value is @code{nil}, double clicks are not
@c detected at all.  If the value is @code{t}, then there is no time
@c limit.
$BJQ?t(B@code{double-click-time}$B$O!"$I$l$/$i$$$N;~4V4V3VFb$G$"$l$P(B
2$B$D$NNY@\$9$k%/%j%C%/$r%@%V%k%/%j%C%/$H$_$J$9$+$r;XDj$7$^$9!#(B
$BC10L$O%_%jIC$G$9!#(B
$BCM$,(B@code{nil}$B$G$"$l$P!"%@%V%k%/%j%C%/$r8!=P$7$^$;$s!#(B
$BCM$,(B@code{t}$B$G$"$l$P!";~4V4V3V$N>e8B$O$J$$$b$N$H$7$F07$$$^$9!#(B

@c   The symbols for mouse events also indicate the status of the modifier
@c keys, with the usual prefixes @samp{C-}, @samp{M-}, @samp{H-},
@c @samp{s-}, @samp{A-} and @samp{S-}.  These always precede @samp{double-}
@c or @samp{triple-}, which always precede @samp{drag-} or @samp{down-}.
$B%^%&%9%$%Y%s%H$KBP1~$9$k%7%s%\%k$K$O$5$i$K!"(B
@samp{C-}$B!"(B@samp{M-}$B!"(B@samp{H-}$B!"(B@samp{s-}$B!"(B@samp{A-}$B!"(B
@samp{S-}$B$N3F%W%l%U%#%C%/%9$G!"=$>~%-!<$N>pJs$bAH$_9~$a$^$9!#(B
$B=gHV$O!"%W%l%U%#%C%/%9$KB3$$$F(B@samp{double-}$B$d(B@samp{triple-}$B$,$"$j!"(B
$B$=$N$"$H$,(B@samp{drag-}$B$d(B@samp{down-}$B$H$$$&$3$H$K$J$j$^$9!#(B

@c   A frame includes areas that don't show text from the buffer, such as
@c the mode line and the scroll bar.  You can tell whether a mouse button
@c comes from a special area of the screen by means of dummy ``prefix
@c keys.''  For example, if you click the mouse in the mode line, you get
@c the prefix key @code{mode-line} before the ordinary mouse-button symbol.
@c Thus, here is how to define the command for clicking the first button in
@c a mode line to run @code{scroll-up}:
$B%U%l!<%`$K$O!"%b!<%I9T$d%9%/%m!<%k%P!<$J$I$N(B
$B%P%C%U%!Cf$N%F%-%9%H$rI=<($9$k0J30$NItJ,$b$"$j$^$9!#(B
$B%^%&%9%$%Y%s%H$,$3$l$i$NFCJL$JItJ,$GH/@8$7$?$b$N$+$I$&$+$rD4$Y$k$?$a$K!"(B
$B%@%_!<$N!V%W%l%U%#%C%/%9%-!<!W$,$"$j$^$9!#(B
$B$?$H$($P!"%^%&%9$,%b!<%I9T$G%/%j%C%/$5$l$?>l9g!"(B
$B$^$:(B@code{mode-line}$B$H$$$&%W%l%U%#%C%/%9%-!<$,Aw$i$l!"(B
$BB3$$$FDL>o$N%^%&%9%\%?%s$KBP1~$7$?%$%Y%s%H$,Aw$i$l$^$9!#(B
$B$G$9$+$i!"%b!<%I9T$GBh(B1$B%\%?%s$,%/%j%C%/$5$l$?$H$-$K(B
@code{scroll-up}$B$r<B9T$9$k$K$O$D$.$N$h$&$K$7$^$9!#(B

@example
(global-set-key [mode-line mouse-1] 'scroll-up)
@end example

@c   Here is the complete list of these dummy prefix keys and their
@c meanings:
$B%@%_!<$N%W%l%U%#%C%/%9%-!<$H$=$N0UL#$O$D$.$N$H$*$j$G$9!#(B

@table @code
@item mode-line
@c The mouse was in the mode line of a window.
$B%^%&%9$,%&%#%s%I%&$N%b!<%I9T$K$"$k!#(B
@item vertical-line
@c The mouse was in the vertical line separating side-by-side windows.  (If
@c you use scroll bars, they appear in place of these vertical lines.)
$B%^%&%9$,2#$KNY@\$9$k%&%#%s%I%&4V$N6-3&@~>e$K$"$k!#(B
$B!J%9%/%m!<%k%P!<$rI=<($5$;$k$H!"(B
$B6-3&@~$N$+$o$j$K%9%/%m!<%k%P!<$,8=$l$k!#!K(B
@item vertical-scroll-bar
@c The mouse was in a vertical scroll bar.  (This is the only kind of
@c scroll bar Emacs currently supports.)
$B%^%&%9$,=D%9%/%m!<%k%P!<>e$K$"$k!#(B
$B!J(BEmacs$B$G;H$($k%9%/%m!<%k%P!<$O!"8=:_$N$H$3$m=D%9%/%m!<%k%P!<$N$_!#!K(B
@ignore
@item horizontal-scroll-bar
The mouse was in a horizontal scroll bar.  Horizontal scroll bars do
horizontal scrolling, and people don't use them often.
@end ignore
@end table

@c   You can put more than one mouse button in a key sequence, but it isn't
@c usual to do so.
1$B$D$N%-!<Ns$NCf$K(B2$B$D0J>e$N%^%&%9%\%?%s%$%Y%s%H$r4^$a$k$3$H$b$G$-$^$9$,!"(B
$BIaDL$O$"$^$j$7$J$$$G$7$g$&!#(B

@node Disabling
@c @subsection Disabling Commands
@subsection $B;HMQ6X;_%3%^%s%I(B
@c @cindex disabled command
@cindex $B;HMQ6X;_%3%^%s%I(B

@c   Disabling a command marks the command as requiring confirmation before it
@c can be executed.  The purpose of disabling a command is to prevent
@c beginning users from executing it by accident and being confused.
$B%3%^%s%I$r;HMQ6X;_$K$9$k$H!"%3%^%s%I$N<B9T$K$O%f!<%6!<$N3NG'$,I,MW$K$J$j$^$9!#(B
$B%3%^%s%I$r;HMQ6X;_$K$9$kL\E*$O!"(B
$B=i?4<T$,$=$N%3%^%s%I$r$^$A$,$C$F<B9T$7$F$7$^$$!":.Mp$9$k$N$rKI$0$?$a$G$9!#(B

@c   An attempt to invoke a disabled command interactively in Emacs
@c displays a window containing the command's name, its documentation, and
@c some instructions on what to do immediately; then Emacs asks for input
@c saying whether to execute the command as requested, enable it and
@c execute it, or cancel.  If you decide to enable the command, you are
@c asked whether to do this permanently or just for the current session.
@c Enabling permanently works by automatically editing your @file{.emacs}
@c file.
Emacs$B>e$G;HMQ6X;_%3%^%s%I$rBPOCE*$K<B9T$7$h$&$H$9$k$H!"(B
$B%3%^%s%IL>!"@bL@J8!"$H$j$"$($:$I$&$9$Y$-$+$N;X<($r(B
$BI=<($7$?%&%#%s%I%&$,8=$l$^$9!#(B
$B$D$.$K(BEmacs$B$O%3%^%s%I$r<B9T$9$k$+!";HMQ6X;_$r2r=|$7$F$+$i<B9T$9$k$+!"(B
$B<B9T$r<h$j>C$9$+$rLd$$9g$o$;$F$-$^$9!#(B
$B%3%^%s%I$N;HMQ6X;_$r2r=|$9$k$3$H$rA*$V$H!"(B
Emacs$B$5$i$K!"0J8e915WE*$K$=$&$9$k$N$+!"(B
$B$^$?$O8=:_$N%;%C%7%g%sFb$@$1$=$&$9$k$N$+$bLd$$9g$o$;$F$-$^$9!#(B
$B915WE*$K;H$($k$h$&$K$9$k$H!"(B
$B<+F0E*$K8D?M$N(B@file{.emacs}$B%U%!%$%k$rJT=8$7$^$9!#(B

@c   The direct mechanism for disabling a command is to put a
@c non-@code{nil} @code{disabled} property on the Lisp symbol for the
@c command.  Here is the Lisp program to do this:
$B%3%^%s%I$r;HMQ6X;_$K$9$k5!9=$O!"(B
$B%3%^%s%I$KBP1~$9$k(BLisp$B%7%s%\%k$NB0@-(B@code{disabled}$B$K(B
@code{nil}$B0J30$NCM$r@_Dj$9$k$3$H$G$9!#(B
$B$3$l$r9T$&(BLisp$B%W%m%0%i%`$O$D$.$N$h$&$K$J$j$^$9!#(B

@example
(put 'delete-region 'disabled t)
@end example

@c   If the value of the @code{disabled} property is a string, that string
@c is included in the message printed when the command is used:
$BB0@-(B@code{disabled}$B$NCM$,J8;zNs$G$"$l$P!"(B
$B%3%^%s%I$r;HMQ$7$h$&$H$7$?$H$-$KI=<($5$l$k(B
$B%a%C%;!<%8$K$=$NJ8;zNs$b4^$^$l$k$h$&$K$J$j$^$9!#(B

@example
(put 'delete-region 'disabled
     "It's better to use `kill-region' instead.\n")
@end example

@findex disable-command
@findex enable-command
@c   You can make a command disabled either by editing the @file{.emacs}
@c file directly or with the command @kbd{M-x disable-command}, which edits
@c the @file{.emacs} file for you.  Likewise, @kbd{M-x enable-command}
@c edits @file{.emacs} to enable a command permanently.  @xref{Init File}.
$B%3%^%s%I$r;HMQ6X;_$K$9$k$K$O!"(B@file{.emacs}$B%U%!%$%k$rD>@\JT=8$9$k$+!"(B
$B$+$o$C$F$3$N%U%!%$%k$rJT=8$9$k%3%^%s%I(B@kbd{M-x disable-command}$B$r;H$$$^$9!#(B
$BF1MM$K!"%3%^%s%I(B@kbd{M-x enable-command}$B$O!"(B
@file{.emacs}$B%U%!%$%k$rJT=8$7$F%3%^%s%I$r915WE*$K;H$($k>uBV$K$7$^$9!#(B
@xref{Init File}$B!#(B

@c   Whether a command is disabled is independent of what key is used to
@c invoke it; disabling also applies if the command is invoked using
@c @kbd{M-x}.  Disabling a command has no effect on calling it as a
@c function from Lisp programs.
$B%3%^%s%I$,;HMQ6X;_$G$"$k$+$I$&$+$O!"(B
$B$=$N%3%^%s%I$r5/F0$9$k%-!<Ns$K$OL54X78$G$9!#(B
$B$7$?$,$C$F!"(B@kbd{M-x}$B$G$=$N%3%^%s%I$r5/F0$7$F$b(B
Emacs$B$O$=$N2DH]$rLd$$9g$o$;$F$-$^$9!#(B
Lisp$B%W%m%0%i%`$+$i%3%^%s%I$r4X?t$H$7$F8F$S=P$9>l9g$K$O(B
$B;HMQ6X;_$K$7$F$b2?$N8z2L$b$"$j$^$;$s!#(B

@node Keyboard Translations
@c @section Keyboard Translations
@section $B%-!<%\!<%IJQ49(B

@c   Some keyboards do not make it convenient to send all the special
@c characters that Emacs uses.  The most common problem case is the
@c @key{DEL} character.  Some keyboards provide no convenient way to type
@c this very important character---usually because they were designed to
@c expect the character @kbd{C-h} to be used for deletion.  On these
@c keyboards, if you press the key normally used for deletion, Emacs handles
@c the @kbd{C-h} as a prefix character and offers you a list of help
@c options, which is not what you want.
$B%-!<%\!<%I$N5!<o$K$h$C$F$O!"(BEmacs$B$,;HMQ$9$k$9$Y$F$NFC<lJ8;z$r(B
$BAw$C$F$/$l$J$$$b$N$,$"$j$^$9!#(B
$B$b$C$H$b$h$/$"$kLdBj$O!"(B@key{DEL}$BJ8;z$K4X$9$k$b$N$G$9!#(B
$B$$$/$D$+$N%-!<%\!<%I$G$O!"(B
$B$3$N$-$o$a$F=EMW$JJ8;z$r4JC1$KBG$A9~$`<jCJ$,$"$j$^$;$s!#(B
$B$=$l$O!":o=|$K$O(B@kbd{C-h}$B$r;H$&$3$H$rA0Ds$H$7$F$$$k$+$i$G$9!#(B
$B$=$N$h$&$J%-!<%\!<%I$G:o=|$N$?$a$N%-!<$rBG$D$H!"(B
Emacs$B$O$=$l$r%W%l%U%#%C%/%9J8;z(B@kbd{C-h}$B$H$7$F2r<a$7!"(B
$B$I$N%X%k%W5!G=$r;H$&$+Ld$$9g$o$;$F$-$F$7$^$$$^$9!#(B
$B$=$l$O%f!<%6!<$,$7$?$+$C$?$3$H$G$O$"$j$^$;$s!#(B

@c @cindex keyboard translations
@cindex $B%-!<%\!<%IJQ49(B
@findex keyboard-translate
@c   You can work around this problem within Emacs by setting up keyboard
@c translations to turn @kbd{C-h} into @key{DEL} and @key{DEL} into
@c @kbd{C-h}, as follows:
Emacs$BFb$G$3$NLdBj$r2sHr$9$k$K$O!"(B@kbd{C-h}$B$r(B@key{DEL}$B$K!"(B
@key{DEL}$B$r(B@kbd{C-h}$B$KJQ49$9$k%-!<%\!<%IJQ49$r(B
$B0J2<$N$h$&$K(B
$B@_Dj$9$k$3$H$G2sHr$G$-$^$9!#(B

@example
@c ;; @r{Translate @kbd{C-h} to @key{DEL}.}
;; @r{@kbd{C-h}$B$r(B@key{DEL}$B$KJQ49$9$k!#(B}
(keyboard-translate ?\C-h ?\C-?)

@need 3000
@c ;; @r{Translate @key{DEL} to @kbd{C-h}.}
;; @r{@key{DEL}$B$r(B@kbd{C-h}$B$KJQ49$9$k!#(B}
(keyboard-translate ?\C-? ?\C-h)
@end example

@c   Keyboard translations are not the same as key bindings in keymaps
@c (@pxref{Keymaps}).  Emacs contains numerous keymaps that apply in
@c different situations, but there is only one set of keyboard
@c translations, and it applies to every character that Emacs reads from
@c the terminal.  Keyboard translations take place at the lowest level of
@c input processing; the keys that are looked up in keymaps contain the
@c characters that result from keyboard translation.
$B%-!<%\!<%IJQ49$O%-!<%^%C%W$K$h$k%-!<%P%$%s%G%#%s%0!J(B@pxref{Keymaps}$B!K$H(B
$BF1$8$G$O$"$j$^$;$s!#(B
Emacs$B$K$O>u67$4$H$K;H$$J,$1$i$l$kB??t$N%-!<%^%C%W$,$"$k$N$KBP$7!"(B
$B%-!<%\!<%IJQ49$O0l<0$@$1$7$+$J$/!"(B
Emacs$B$,C<Kv$+$iFI$`$9$Y$F$NJ8;z$KBP$7$F$=$NJQ49$,E,MQ$5$l$^$9!#(B
$B%-!<%\!<%IJQ49$OF~NO=hM}$N$$$A$P$s2<0L$N%l%Y%k$G9T$o$l!"(B
$B%-!<%^%C%W>e$N8!:w$O%-!<%\!<%IJQ49$r;\$7$?7k2L$KBP$7$F9T$o$l$^$9!#(B

@c   Under X, the keyboard key named @key{DELETE} is a function key and is
@c distinct from the ASCII character named @key{DEL}.  @xref{Named ASCII
@c Chars}.  Keyboard translations affect only ASCII character input, not
@c function keys; thus, the above example used under X does not affect the
@c @key{DELETE} key.  However, the translation above isn't necessary under
@c X, because Emacs can also distinguish between the @key{BACKSPACE} key
@c and @kbd{C-h}; and it normally treats @key{BACKSPACE} as @key{DEL}.
X$B%&%#%s%I%&%7%9%F%`$G$O(B@key{DELETE}$B$H$$$&%-!<$O%U%!%s%/%7%g%s%-!<$G$"$j!"(B
ASCII$BJ8;z(B@key{DEL}$B$H$OJL$b$N$G$9!#(B
@xref{Named ASCII Chars}$B!#(B
$B%-!<%\!<%IJQ49$O(BASCII$BJ8;zF~NO$@$1$KE,MQ$5$l!"(B
$B%U%!%s%/%7%g%s%-!<$H$OL54X78$G$9$+$i!"(B
X$B%&%#%s%I%&%7%9%F%`$G$O>e$NNc$O(B@key{DELETE}$B%-!<$KBP$7$F8z2L$r$b$?$i$7$^$;$s!#(B
$B$7$+$7!"(BX$B%&%#%s%I%&%7%9%F%`$G$O>e$N$h$&$J%-!<%\!<%IJQ49$=$N$b$N$,ITMW$G$9!#(B
$B$H$$$&$N$O!"(BEmacs$B$O(BX$B%&%#%s%I%&%7%9%F%`$G$O(B
@key{BACKSPACE}$B%-!<$H(B@kbd{C-h}$B$b6hJL$G$-!"(B
$BDL>o!"(B@key{BAKSPACE}$B$r(B@key{DEL}$B$H$7$F07$&$+$i$G$9!#(B

@c   For full information about how to use keyboard translations, see
@c @ref{Translating Input,,,elisp, The Emacs Lisp Reference Manual}.
$B%-!<%\!<%IJQ49$N;H$$J}$K4X$9$k>\$7$$>pJs$O!"(B
@ref{Translating Input,,,elisp, The Emacs Lisp Reference Manual}$B$r(B
$B;2>H$7$F$/$@$5$$!#(B

@node Syntax
@c @section The Syntax Table
@section $B9=J8%F!<%V%k(B
@c @cindex syntax table
@cindex $B9=J8%F!<%V%k(B

@c   All the Emacs commands which parse words or balance parentheses are
@c controlled by the @dfn{syntax table}.  The syntax table says which
@c characters are opening delimiters, which are parts of words, which are
@c string quotes, and so on.  Each major mode has its own syntax table
@c (though sometimes related major modes use the same one) which it
@c installs in each buffer that uses that major mode.  The syntax table
@c installed in the current buffer is the one that all commands use, so we
@c call it ``the'' syntax table.  A syntax table is a Lisp object, a
@c char-table, whose elements are numbers.
$BC18l$dBP1~$7$?3g8L$NBP$rG'<1$9$k(BEmacs$B%3%^%s%I$O$9$Y$F!"(B
@dfn{$B9=J8%F!<%V%k(B}$B!J(Bsyntax table$B!K$K$h$C$F@)8f$5$l$^$9!#(B
$B9=J8%F!<%V%k$O!"$I$NJ8;z$,3+$-3g8L$G!"$I$NJ8;z$,C18l$NCf?H$G!"(B
$B$I$NJ8;z$,%7%s%0%k%/%)!<%H$+$H$$$C$?$3$H$r5-=R$7$F$$$^$9!#(B
$B3F%a%8%c!<%b!<%I$K$O$=$l$>$l@lMQ$N9=J8%F!<%V%k$,$"$j(B
$B!J$?$@$7!"8_$$$K4X78$N$"$k%a%8%c!<%b!<%I$,(B
1$B$D$N9=J8%F!<%V%k$r6&MQ$9$k$3$H$O$"$k!K!"(B
$B3F%P%C%U%!$4$H$K$=$N$H$-$N%a%8%c!<%b!<%I$N9=J8%F!<%V%k$,;H$o$l$^$9!#(B
$B%+%l%s%H%P%C%U%!$K@_Dj$5$l$F$$$k9=J8%F!<%V%k$O$9$Y$F$N%3%^%s%I$,;H$&$N$G!"(B
$B0J2<$G$O$3$l$r!X8=:_$N!Y9=J8%F!<%V%k$H8F$S$^$9!#(B
$B9=J8%F!<%V%k$OJ8;z%F!<%V%k!J(Bchar-table$B!K7?$N(BLisp$B%*%V%8%'%/%H$G$"$j!"(B
$B$=$NMWAG$O?tCM$G$9!#(B

@kindex C-h s
@findex describe-syntax
@c   To display a description of the contents of the current syntax table,
@c type @kbd{C-h s} (@code{describe-syntax}).  The description of each
@c character includes both the string you would have to give to
@c @code{modify-syntax-entry} to set up that character's current syntax,
@c and some English to explain that string if necessary.
$B8=:_$N9=J8%F!<%V%k$NFbMF$K4X$9$k5-=R$rI=<($9$k$K$O!"(B
@kbd{C-h s}$B!J(B@code{descirbe-syntax}$B!K$r;H$$$^$9!#(B
$B5-=R$NI=<($K$O3FJ8;z$4$H$K!"(B
$B$=$NJ8;z$N8=:_$N9=J8$r@_Dj$9$k$?$a$K(B@code{modify-syntax-entry}$B$K(B
$BEO$9$Y$-J8;zNs!"$*$h$S!"$=$NJ8;zNs$N1Q8l$G$N@bL@$,4^$^$l$^$9!#(B

@c   For full information on the syntax table, see @ref{Syntax Tables,,
@c Syntax Tables, elisp, The Emacs Lisp Reference Manual}.
$B9=J8%F!<%V%k$K4X$9$k>\$7$$>pJs$K$D$$$F$O!"(B
@ref{Syntax Tables,, Syntax Tables, elisp, The Emacs Lisp Reference Manual}$B$r(B
$B;2>H$7$F$/$@$5$$!#(B

@node Init File
@c @section The Init File, @file{~/.emacs}
@section $B=i4|2=%U%!%$%k(B@file{~/.emacs}
@c @cindex init file
@c @cindex Emacs initialization file
@c @cindex key rebinding, permanent
@c @cindex rebinding keys, permanently
@c @cindex startup (init file)
@cindex $B=i4|2=%U%!%$%k(B
@cindex Emacs$B=i4|2=%U%!%$%k(B
@cindex $B%-!<%P%$%s%G%#%s%0$N915WE*$JJQ99(B
@cindex $B<B9T3+;O!J=i4|2=%U%!%$%k!K(B

@c   When Emacs is started, it normally loads a Lisp program from the file
@c @file{.emacs} or @file{.emacs.el} in your home directory.  We call this
@c file your @dfn{init file} because it specifies how to initialize Emacs
@c for you.  You can use the command line switch @samp{-q} to prevent
@c loading your init file, and @samp{-u} (or @samp{--user}) to specify a
@c different user's init file (@pxref{Entering Emacs}).
Emacs$B$,<B9T$r3+;O$9$k$H$-!"DL>o$O%f!<%6!<$N%[!<%`%G%#%l%/%H%j$K$"$k(B
$B%U%!%$%k(B@file{.emacs}$B$d(B@file{.emacs.el}$B$+$i(BLisp$B%W%m%0%i%`$r%m!<%I$7$^$9!#(B
$B$3$N%U%!%$%k$,(BEmacs$B$N=i4|2=$N;EJ}$r;XDj$9$k$N$G!"(B
$B$3$N%U%!%$%k$N$3$H$r(B@dfn{$B=i4|2=%U%!%$%k(B}$B!J(Binit file$B!K$H8F$S$^$9!#(B
$B%3%^%s%I9T%*%W%7%g%s(B@samp{-q}$B$G!"(B
Emacs$B$K=i4|2=%U%!%$%k$rFI$^$J$$$3$H$r;X<($7$?$j!"(B
@samp{-u}$B!J$"$k$$$O(B@samp{--user}$B!K$G!"(B
$BJL$N%f!<%6!<$N=i4|2=%U%!%$%k$r;XDj$G$-$^$9(B
$B!J(B@pxref{Entering Emacs}$B!K!#(B

@c   There can also be a @dfn{default init file}, which is the library
@c named @file{default.el}, found via the standard search path for
@c libraries.  The Emacs distribution contains no such library; your site
@c may create one for local customizations.  If this library exists, it is
@c loaded whenever you start Emacs (except when you specify @samp{-q}).
@c But your init file, if any, is loaded first; if it sets
@c @code{inhibit-default-init} non-@code{nil}, then @file{default} is not
@c loaded.
@dfn{$B%G%U%)%k%H$N=i4|2=%U%!%$%k(B}$B$b$"$j$^$9!#(B
$B$3$l$O(B@file{default.el}$B$H$$$&L>A0$N%i%$%V%i%j%U%!%$%k$G!"(B
Emacs$B$O%i%$%V%i%jC5:w%Q%9$r$H$*$7$F$=$N>l=j$rC5$7$^$9!#(B
Emacs$B$NG[I[$K$O(B@file{default.el}$B$O4^$^$l$F$$$^$;$s!#(B
$B%m!<%+%k$J%+%9%?%^%$%:$N$?$a$K%5%$%H$G(B@file{default.el}$B$r(B
$BMQ0U$9$k$3$H$b$"$j$^$9!#(B
$B$3$N%U%!%$%k$,$"$l$P!J(B@samp{-q}$B$r;XDj$7$?$H$-$r=|$$$F!K(B
Emacs$B$r3+;O$9$k$H$-$D$M$K%m!<%I$5$l$^$9!#(B
$B$7$+$7!"$"$k$J$i$P8D?M$N=i4|2=%U%!%$%k$,:G=i$K%m!<%I$5$l$^$9!#(B
$B$=$NCf$G(B@code{inhibit-default-init}$B$K(B@code{nil}$B0J30$NCM$r@_Dj$9$k$H!"(B
@file{default.el}$B$O%m!<%I$5$l$^$;$s!#(B

@c   Your site may also have a @dfn{site startup file}; this is named
@c @file{site-start.el}, if it exists.  Emacs loads this library before it
@c loads your init file.  To inhibit loading of this library, use the
@c option @samp{-no-site-file}.
$B3F%5%$%H$K$O(B@dfn{$B%5%$%H%9%?!<%H%"%C%W%U%!%$%k(B}$B$,$"$k$+$b$7$l$^$;$s!#(B
$B$"$k$J$i$P!"$3$N%U%!%$%k$NL>A0$O(B@file{site-start.el}$B$G$9!#(B
Emacs$B$O%f!<%6!<$N=i4|2=%U%!%$%k$rFI$`$^$($K$3$N%U%!%$%k$b%m!<%I$7$^$9!#(B
$B$3$N%U%!%$%k$N%m!<%I$rM^;_$9$k$K$O!"(B
$B%*%W%7%g%s(B@samp{-no-site-file}$B$r;XDj$7$^$9!#(B

@c   If you have a large amount of code in your @file{.emacs} file, you
@c should rename it to @file{~/.emacs.el}, and byte-compile it.  @xref{Byte
@c Compilation,, Byte Compilation, elisp, the Emacs Lisp Reference Manual},
@c for more information about compiling Emacs Lisp programs.
@file{.emacs}$B$KBgNL$N%3!<%I$,$"$k>l9g$K$O!"(B
@file{~/.emacs.el}$B$H2~L>$7$F%P%$%H%3%s%Q%$%k$7$F$*$/$Y$-$G$9!#(B
Emacs Lisp$B%W%m%0%i%`$N%3%s%Q%$%k$K$D$$$F$h$j>\$7$/$O!"(B
@xref{Byte Compilation,, Byte Compilation, elisp, The Emacs Lisp Reference Manual}$B!#(B

@c   If you are going to write actual Emacs Lisp programs that go beyond
@c minor customization, you should read the @cite{Emacs Lisp Reference Manual}.
$BC1$J$k%+%9%?%^%$%:$rD6$($k$h$&$J<B:]$N(BEmacs$B%W%m%0%i%`$r=q$/$N$G$"$l$P!"(B
@cite{The Emacs Lisp Reference Manual}$B$rFI$`$Y$-$G$9!#(B
@ifinfo
@c @xref{Top, Emacs Lisp, Emacs Lisp, elisp, the Emacs Lisp Reference
@c Manual}.
@xref{Top, Emacs Lisp, Emacs Lisp, elisp, The Emacs Lisp Reference Manual}$B!#(B
@end ifinfo

@menu
* Init Syntax::	        Syntax of constants in Emacs Lisp.
* Init Examples::       How to do some things with an init file.
* Terminal Init::       Each terminal type can have an init file.
* Find Init::	        How Emacs finds the init file.
@end menu

@node Init Syntax
@c @subsection Init File Syntax
@subsection $B=i4|2=%U%!%$%k$N9=J8(B

@c   The @file{.emacs} file contains one or more Lisp function call
@c expressions.  Each of these consists of a function name followed by
@c arguments, all surrounded by parentheses.  For example, @code{(setq
@c fill-column 60)} calls the function @code{setq} to set the variable
@c @code{fill-column} (@pxref{Filling}) to 60.
$B%U%!%$%k(B@file{.emacs}$B$K$O(BLisp$B$N4X?t8F$S=P$7<0$r=q$-$^$9!#(B
$B4X?t8F$S=P$7$O!"4X?tL>$KB3$1$F0z?t%j%9%H$rJB$Y!"A4BN$r3g8L$G0O$_$^$9!#(B
$B$?$H$($P!"(B@code{(setq fill-column 60)}$B$O!"(B
$B4X?t(B@code{setq}$B$K$h$C$F!"JQ?t(B@code{fill-column}$B!J(B@pxref{Filling}$B!K$K(B
60$B$r@_Dj$7$^$9!#(B

@c   The second argument to @code{setq} is an expression for the new value of
@c the variable.  This can be a constant, a variable, or a function call
@c expression.  In @file{.emacs}, constants are used most of the time.  They can be:
@code{setq}$B$N(B2$BHVL\$N0z?t$OJQ?t$N?7$7$$CM$rI=$9<0$G$9!#(B
$B$3$l$O!"Dj?t$G$b!"JQ?t$G$b!"4X?t8F$S=P$7<0$G$b$+$^$$$^$;$s!#(B
@file{.emacs}$B%U%!%$%k$G$ODj?t$r;H$&$3$H$,$b$C$H$bB?$$$G$7$g$&!#(B
$BDj?t$K$O$D$.$N$b$N$,$"$j$^$9!#(B

@table @asis
@c @item Numbers:
@item $B?tCM!'(B
@c Numbers are written in decimal, with an optional initial minus sign.
$B?tCM$O(B10$B?JI=5-$7!"@hF,$K%^%$%J%9Id9f$,$"$C$F$b$h$$!#(B

@c @item Strings:
@c @cindex Lisp string syntax
@c @cindex string syntax
@item $BJ8;zNs!'(B
@cindex Lisp$B$NJ8;zNs$N9=J8(B
@cindex $BJ8;zNs$N9=J8(B
@c Lisp string syntax is the same as C string syntax with a few extra
@c features.  Use a double-quote character to begin and end a string constant.
Lisp$B$NJ8;zNs$N9=J8$O(BC$B$NJ8;zNs$N9=J8$H$[$\F1$8$@$,!"B?>/0c$&$H$3$m$b$"$k!#(B
$BJ8;zNsDj?t$N;O$^$j$H=*$j$K$O%@%V%k%/%)!<%H$r;H$&!#(B

@c In a string, you can include newlines and special characters literally.
@c But often it is cleaner to use backslash sequences for them: @samp{\n}
@c for newline, @samp{\b} for backspace, @samp{\r} for carriage return,
@c @samp{\t} for tab, @samp{\f} for formfeed (control-L), @samp{\e} for
@c escape, @samp{\\} for a backslash, @samp{\"} for a double-quote, or
@c @samp{\@var{ooo}} for the character whose octal code is @var{ooo}.
@c Backslash and double-quote are the only characters for which backslash
@c sequences are mandatory.
$BJ8;zNs$NCf$K$O!"2~9T$dFC<lJ8;z$r$=$N$^$^F~$l$k$3$H$,$G$-$k!#(B
$B$7$+$7!"%P%C%/%9%i%C%7%e$G;O$^$k7A<0!"$D$^$j!"(B
$B2~9T$O(B@samp{\n}$B!"%P%C%/%9%Z!<%9$O(B@samp{\b}$B!"(B
$BI|5"$O(B@samp{\r}$B!"%?%V$O(B@samp{\t}$B!"%Z!<%8Aw$j$O(B@samp{\f}$B!J%3%s%H%m!<%k(BL$B!K!"(B
$B%(%9%1!<%W$O(B@samp{\e}$B!"%P%C%/%9%i%C%7%e$O(B@samp{\\}$B!"(B
$B%@%V%k%/%)!<%H$O(B@samp{\"}$B!"(B8$B?J%3!<%I(B@var{ooo}$B$NJ8;z$O(B@samp{\@var{ooo}}$B$G(B
$BI=$9$3$H$,$G$-!"$=$N$[$&$,FI$_$d$9$$!#(B
$B%P%C%/%9%i%C%7%e$H%@%V%k%/%)!<%H$N(B2$B$D$@$1$O!"(B
$BJ8;zNs$K4^$a$k$N$KI,$:$3$N$h$&$J7A$G=q$-I=$9I,MW$,$"$k!#(B

@c @samp{\C-} can be used as a prefix for a control character, as in
@c @samp{\C-s} for ASCII control-S, and @samp{\M-} can be used as a prefix for
@c a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for
@c @kbd{Control-Meta-A}.@refill
@samp{\C-}$B$O%3%s%H%m!<%kJ8;z$rI=$9%W%l%U%#%C%/%9$H$7$F;HMQ$G$-$k!#(B
$B$?$H$($P!"(B@samp{\C-s}$B$G(BASCII$B$N%3%s%H%m!<%k(BS$B$rI=$9!#(B
$BF1MM$K!"(B@samp{\M-}$B$O%a%?J8;z$rI=$9%W%l%U%#%C%/%9$H$7$F;HMQ$G$-$k!#(B
$B$?$H$($P!"(B@samp{\M-a}$B$G(B@kbd{Meta-A}$B!"(B
@samp{\M-\C-a}$B$G(B@kbd{Control-Meta-A}$B$rI=$9!#(B

@c @item Characters:
@item $BJ8;z!'(B
@c Lisp character constant syntax consists of a @samp{?} followed by
@c either a character or an escape sequence starting with @samp{\}.
@c Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}.  Note that
@c strings and characters are not interchangeable in Lisp; some contexts
@c require one and some contexts require the other.
Lisp$B$NJ8;zDj?t$O!"(B@samp{?}$B$KB3$1$FJ8;z$^$?$O(B@samp{\}$B$G;O$^$k(B
$B%(%9%1!<%W%7!<%1%s%9$r=q$$$?$b$N!#(B
$B$?$H$($P!"(B@code{?x}$B!"(B@code{?\n}$B!"(B@code{?\)}$B$J$I$OJ8;zDj?t!#(B
Lisp$B$G$OJ8;z$HJ8;zNs$OJL$b$N$J$N$GCm0U$9$k$3$H!#(B
$B$"$k>lLL$G$OJ8;zNs$,I,MW$G$"$j!"JL$N>lLL$G$OJ8;z$,I,MW$G$"$k!#(B

@c @item True:
@item $B??!'(B
@c @code{t} stands for `true'.
@code{t}$B$O!V??!W$rI=$9!#(B

@c @item False:
@item $B56!'(B
@c @code{nil} stands for `false'.
@code{nil}$B$O!V56!W$rI=$9!#(B

@c @item Other Lisp objects:
@item $B$=$NB>$N(BLisp$B%*%V%8%'%/%H!'(B
@c Write a single-quote (') followed by the Lisp object you want.
$B%7%s%0%k%/%)!<%H$KB3$1$F$=$N(BLisp$B%*%V%8%'%/%H$r=q$/!#(B
@end table

@node Init Examples
@c @subsection Init File Examples
@subsection $B=i4|2=%U%!%$%k$NNc(B

@c   Here are some examples of doing certain commonly desired things with
@c Lisp expressions:
$B0J2<$K$O$h$/;H$o$l$k(BLisp$B$N<0$NNc$r$"$2$F$*$-$^$9!#(B

@itemize @bullet
@item
@c Make @key{TAB} in C mode just insert a tab if point is in the middle of a
@c line.
C$B%b!<%I$K$*$$$F!"9T$NESCf$G(B@key{TAB}$B$,2!$5$l$?$H$-$K$O(B
$B%?%VJ8;z$rA^F~$9$k$h$&$K@_Dj$9$k!#(B

@example
(setq c-tab-always-indent nil)
@end example

@c Here we have a variable whose value is normally @code{t} for `true'
@c and the alternative is @code{nil} for `false'.
$BJQ?t$NCM$r!V??!W$K$9$k$K$O(B@code{t}$B$r@_Dj$7!"(B
$B5U$K!V56!W$K$9$k$K$O(B@code{nil}$B$r@_Dj$9$k!#(B

@item
@c Make searches case sensitive by default (in all buffers that do not
@c override this).
$BC5:w$r%G%U%)%k%H$GBgJ8;z>.J8;z$r6hJL$9$k$h$&$K@_Dj$9$k(B
$B!J$?$@$7!"0c$&@_Dj$KJQ99$7$F$$$k%P%C%U%!$O=|$/!K!#(B

@example
(setq-default case-fold-search nil)
@end example

@c This sets the default value, which is effective in all buffers that do
@c not have local values for the variable.  Setting @code{case-fold-search}
@c with @code{setq} affects only the current buffer's local value, which
@c is not what you probably want to do in an init file.
$B$3$3$G$O(B@code{setq-default}$B$GJQ?t$N%G%U%)%k%HCM$r@_Dj$7!"(B
$B$=$NJQ?t$KBP$7$F%m!<%+%k$JCM$r@_Dj$7$F$$$J$$$9$Y$F$N%P%C%U%!$GM-8z$G$"$k!#(B
@code{setq}$B$G(B@code{case-fold-search}$B$KCM$r@_Dj$9$k$H!"(B
$B%+%l%s%H%P%C%U%!$N%m!<%+%k$JCM$@$1$K1F6A$7!"(B
$B=i4|2=%U%!%$%k$G5-=R$7$?$$$3$H$H$O0[$J$k$@$m$&!#(B

@item
@vindex user-mail-address
@c Specify your own email address, if Emacs can't figure it out correctly.
Emacs$B$,<+F0E*$K%a%$%k%"%I%l%9$r3d$j=P$;$J$$>l9g$KHw$(!"(B
$B$3$NJQ?t$K<+J,$N%a%$%k%"%I%l%9$r;XDj$9$k!#(B

@example
(setq user-mail-address "coon@@yoyodyne.com")
@end example

@c Various Emacs packages that need your own email address use the value of
@c @code{user-mail-address}.
$B%a%$%k%"%I%l%9$rI,MW$H$9$kB?$/$N(BEmacs$B%Q%C%1!<%8$O!"(B
@code{user-mail-address}$B$NCM$r;H$&!#(B

@item
@c Make Text mode the default mode for new buffers.
$B?7$?$K:n$C$?%P%C%U%!$N%G%U%)%k%H$N%b!<%I$r%F%-%9%H%b!<%I$K$9$k!#(B

@example
(setq default-major-mode 'text-mode)
@end example

@c Note that @code{text-mode} is used because it is the command for
@c entering Text mode.  The single-quote before it makes the symbol a
@c constant; otherwise, @code{text-mode} would be treated as a variable
@c name.
@code{text-mode}$B$r;XDj$7$F$$$k$N$O!"(B
$B$3$l$,%F%-%9%H%b!<%I$KF~$k$?$a$N%3%^%s%I$@$+$i!#(B
$B%3%^%s%IL>$N$^$($N%7%s%0%k%/%)!<%H$O!"%7%s%\%k$rDj?t$H$7$F07$&$?$a!#(B
$B$5$b$J$$$H(B@code{text-mode}$B$H$$$&JQ?t$r;2>H$9$k$3$H$K$J$C$F$7$^$&!#(B

@need 1500
@item
@c Set up defaults for the Latin-1 character set
@c which supports most of the languages of Western Europe.
$B@>%h!<%m%C%Q$N$[$H$s$I$N8@8l$r07$($k(BLatin-1$BJ8;z=89g$r%G%U%)%k%H$H$9$k(B
@footnote{$B!ZLuCm![F|K\8l4D6-$r@_Dj$9$k$K$O!"(B
@example
(set-language-environment "Japanese")
@end example
$B$H$9$k!#(B}$B!#(B

@example
(set-language-environment "Latin-1")
@end example

@need 1500
@item
@c Turn on Auto Fill mode automatically in Text mode and related modes.
$B%F%-%9%H%b!<%I$d$=$l$K4XO"$9$k%b!<%I$G$O!"<+F05M$a9~$_%b!<%I$r%*%s$K$9$k!#(B

@example
(add-hook 'text-mode-hook
  '(lambda () (auto-fill-mode 1)))
@end example

@c This shows how to add a hook function to a normal hook variable
@c (@pxref{Hooks}).  The function we supply is a list starting with
@c @code{lambda}, with a single-quote in front of it to make it a list
@c constant rather than an expression.
$B$3$l$O%N!<%^%k%U%C%/JQ?t!J(B@pxref{Hooks}$B!K$K%U%C%/4X?t$rDI2C$9$kNc!#(B
$B$3$3$G$O4X?t$H$7$F(B@code{lambda}$B$G;O$^$k%j%9%H$r;XDj$7!"(B
$B%7%s%0%k%/%)!<%H$rA0CV$7$F<0$G$O$J$/Dj?t$H$7$F07$o$;$k!#(B

@c It's beyond the scope of this manual to explain Lisp functions, but for
@c this example it is enough to know that the effect is to execute
@c @code{(auto-fill-mode 1)} when Text mode is entered.  You can replace
@c that with any other expression that you like, or with several
@c expressions in a row.
Lisp$B$N4X?t$K$D$$$F@bL@$9$k$N$OK\=q$NHO0O30$@$,!"(B
$B$3$NNc$rM}2r$9$k$K$O!"%F%-%9%H%b!<%I$KF~$k$H$-$K(B
@code{(auto-fill-mode 1)}$B$,<B9T$5$l$k$N$@$H9M$($F$*$1$P==J,!#(B
$B$3$N<0$rJL$N<0$KJQ$($?$j!"<0$rJ#?tJB$Y$F$b$+$^$o$J$$!#(B

@c Emacs comes with a function named @code{turn-on-auto-fill} whose
@c definition is @code{(lambda () (auto-fill-mode 1))}.  Thus, a simpler
@c way to write the above example is as follows:
Emacs$B$K$O(B@code{turn-on-auto-fill}$B$H$$$&4X?t$,MQ0U$5$l$F$*$j!"(B
$B$=$NDj5A$O(B@code{(lambda () (auto-fill-mode 1))}$B$K$J$C$F$$$k!#(B
$B$7$?$,$C$F!">e$NNc$r$b$C$H4JC1$K=q$/$H$D$.$N$h$&$K$J$k!#(B

@example
(add-hook 'text-mode-hook 'turn-on-auto-fill)
@end example

@item
@c Load the installed Lisp library named @file{foo} (actually a file
@c @file{foo.elc} or @file{foo.el} in a standard Emacs directory).
$B$"$i$+$8$aMQ0U$7$F$"$k(BLisp$B%i%$%V%i%j(B@file{foo}
$B!J<B:]$K$OI8=`(BEmacs$B%G%#%l%/%H%j$KCV$+$l$?%U%!%$%k(B@file{foo.elc}
$B$^$?$O(B@file{foo.el}$B!K$r%m!<%I$9$k!#(B

@example
(load "foo")
@end example

@c When the argument to @code{load} is a relative file name, not starting
@c with @samp{/} or @samp{~}, @code{load} searches the directories in
@c @code{load-path} (@pxref{Lisp Libraries}).
@code{load}$B$KEO$90z?t$,AjBP%U%!%$%kL>!"$D$^$j!"(B
@samp{/}$B$d(B@samp{~}$B$G;O$^$i$J$$>l9g$K$O!"(B
@code{load}$B$O(B@code{load-path}$B!J(B@pxref{Lisp Libraries}$B!K$N(B
$B%G%#%l%/%H%j72$r=g$KC5:w$9$k!#(B

@item
@c Load the compiled Lisp file @file{foo.elc} from your home directory.
$B<+J,$N%[!<%`%G%#%l%/%H%j$K$"$k%3%s%Q%$%k:Q$_$N(BLisp$B%U%!%$%k(B@file{foo.elc}$B$r(B
$B%m!<%I$9$k!#(B

@example
(load "~/foo.elc")
@end example

@c Here an absolute file name is used, so no searching is done.
$B$3$3$G$O@dBP%U%!%$%kL>$,;H$o$l$F$$$k$N$G!"C5:w$O9T$o$J$$!#(B

@item
@c Rebind the key @kbd{C-x l} to run the function @code{make-symbolic-link}.
$B%-!<(B@kbd{C-x l}$B$G4X?t(B@code{make-symbolic-link}$B$,<B9T$5$l$k$h$&$K(B
$B%P%$%s%G%#%s%0$r@_Dj$9$k!#(B

@example
(global-set-key "\C-xl" 'make-symbolic-link)
@end example

@c or
$B$^$?$O(B

@example
(define-key global-map "\C-xl" 'make-symbolic-link)
@end example

@c Note once again the single-quote used to refer to the symbol
@c @code{make-symbolic-link} instead of its value as a variable.
$B$3$3$G$b%7%s%\%k(B@code{make-symbolic-link}$B$rJQ?t$H$7$F$NCM$G$O$J$/(B
$BDj?t$H$9$k$?$a$K%7%s%0%k%/%)!<%H$,;H$o$l$F$$$k$3$H$KCm0U!#(B

@item
@c Do the same thing for Lisp mode only.
$B>e$HF1$8$@$,!"(BLisp$B%b!<%I$NCf$@$1$G$N%P%$%s%G%#%s%0$r@_Dj$9$k!#(B

@example
(define-key lisp-mode-map "\C-xl" 'make-symbolic-link)
@end example

@item
@c Redefine all keys which now run @code{next-line} in Fundamental mode
@c so that they run @code{forward-line} instead.
$B4pK\!J(Bfundamental$B!K%b!<%I$G(B@code{next-line}$B$r(B
$B<B9T$9$k$h$&$K$J$C$F$$$k$9$Y$F$N%-!<$r!"(B
$B$+$o$j$K(B@code{forward-line}$B$r<B9T$9$k$h$&$KD>$9!#(B

@example
(substitute-key-definition 'next-line 'forward-line
                           global-map)
@end example

@item
@c Make @kbd{C-x C-v} undefined.
@kbd{C-x C-v}$B$rL$Dj5A$K$9$k!#(B

@example
(global-unset-key "\C-x\C-v")
@end example

@c One reason to undefine a key is so that you can make it a prefix.
@c Simply defining @kbd{C-x C-v @var{anything}} will make @kbd{C-x C-v} a
@c prefix, but @kbd{C-x C-v} must first be freed of its usual non-prefix
@c definition.
$B%-!<$rL$Dj5A$K$9$kI,MW$N$"$k>l9g$N(B1$B$D$H$7$F!"(B
$B$=$N%-!<$r%W%l%U%#%C%/%9$K$7$?$$>l9g$,$"$k!#(B
$B$?$H$($P!"(B@kbd{C-x C-v @var{anything}}$B$rDj5A$9$k$H!"(B
@kbd{C-x C-v}$B$O<+F0E*%W%l%U%#%C%/%9$K$J$k$,!"(B
$B$7$+$7$=$N$^$($K(B@kbd{C-x C-v}$B$NDL>o$N!J%W%l%U%#%C%/%9$G$O$J$$!KDj5A$r(B
$BL$Dj5A$KLa$7$F$*$/I,MW$,$"$k!#(B

@item
@c Make @samp{$} have the syntax of punctuation in Text mode.
@c Note the use of a character constant for @samp{$}.
@samp{$}$B$r%F%-%9%H!J(Btext$B!K%b!<%I$G$N6h@Z$jJ8;z$K$9$k!#(B
@samp{$}$B$rJ8;zDj?t$H$7$F;XDj$7$F$$$k$3$H$KCm0U!#(B

@example
(modify-syntax-entry ?\$ "." text-mode-syntax-table)
@end example

@item
@c Enable the use of the command @code{narrow-to-region} without confirmation.
$B%3%^%s%I(B@code{narrow-to-region}$B$r3NG'$J$7$K;H$($k$h$&$K$9$k!#(B

@example
(put 'narrow-to-region 'disabled nil)
@end example
@end itemize

@node Terminal Init
@c @subsection Terminal-specific Initialization
@subsection $BC<Kv$K8GM-$N=i4|2=(B

@c   Each terminal type can have a Lisp library to be loaded into Emacs when
@c it is run on that type of terminal.  For a terminal type named
@c @var{termtype}, the library is called @file{term/@var{termtype}} and it is
@c found by searching the directories @code{load-path} as usual and trying the
@c suffixes @samp{.elc} and @samp{.el}.  Normally it appears in the
@c subdirectory @file{term} of the directory where most Emacs libraries are
@c kept.@refill
$B3FC<Kv<oJL$4$H$K!"(BEmacs$B$,$=$NC<Kv$GF0$/$H$-$K%m!<%I$9$k%i%$%V%i%j$r(B
$B;XDj$G$-$^$9!#(B
$B$D$^$j!"(B@var{termtype}$B$H$$$&L>A0$NC<Kv$G(BEmacs$B$r5/F0$9$k$H$-$K$O!"(B
@file{term/@var{termtype}}$B$H$$$&%i%$%V%i%j$,%m!<%I$5$l$^$9!#(B
$B%i%$%V%i%j$NC5:w$ODL>o$I$*$j(B
@code{load-path}$B$N3F%G%#%l%/%H%j$KBP$7$F9T$o$l!"(B
$B%U%!%$%k$N3HD%;R$O(B@samp{.elc}$B$+(B@samp{.el}$B$G$9!#(B
$BDL>o!"$3$l$i$N%i%$%V%i%j$O$[$H$s$I$N(B
Emacs$B%i%$%V%i%j$r<}$a$?%G%#%l%/%H%j$N2<$N(B@file{term}$B$H$$$&(B
$B%5%V%G%#%l%/%H%j$KCV$+$l$^$9!#(B

@c   The usual purpose of the terminal-specific library is to map the
@c escape sequences used by the terminal's function keys onto more
@c meaningful names, using @code{function-key-map}.  See the file
@c @file{term/lk201.el} for an example of how this is done.  Many function
@c keys are mapped automatically according to the information in the
@c Termcap data base; the terminal-specific library needs to map only the
@c function keys that Termcap does not specify.
$BC<Kv8GM-$N%i%$%V%i%j$NIaDL$NMQES$O!"C<Kv$N%U%!%s%/%7%g%s%-!<$K$h$C$F(B
$BAw=P$5$l$k%(%9%1!<%W%7!<%1%s%9$r(B@code{function-key-map}$B$r;H$C$F0UL#$N(B
$B$"$kL>A0$KBP1~IU$1$k$3$H$G$9!#(B
$B$3$N$h$&$J@_Dj$r9T$&%U%!%$%k$NNc$H$7$F!"$?$H$($P(B
$B%U%!%$%k(B@file{term/kl201.el}$B$r8+$F$_$F$/$@$5$$!#(B
$BB?$/$N%U%!%s%/%7%g%s%-!<$O(Btermcap$B%G!<%?%Y!<%9$N>pJs$K(B
$B4p$E$$$F<+F0E*$KBP1~IU$1$,$J$5$l$^$9!#(B
$BC<Kv8GM-%i%$%V%i%j$G$O!"(Btermcap$B$G;XDj$5$l$F$$$J$$%U%!%s%/%7%g%s%-!<(B
$B$@$1$rBP1~IU$1$l$P$h$$$N$G$9!#(B

@c   When the terminal type contains a hyphen, only the part of the name
@c before the first hyphen is significant in choosing the library name.
@c Thus, terminal types @samp{aaa-48} and @samp{aaa-30-rv} both use
@c the library @file{term/aaa}.  The code in the library can use
@c @code{(getenv "TERM")} to find the full terminal type name.@refill
$BC<Kv<oJL$K%O%$%U%s$,4^$^$l$F$$$k>l9g$O!"(B
$B%i%$%V%i%jL>$NA*Br$K$O:G=i$N%O%$%U%s$h$j$^$($NItJ,$@$1$,;H$o$l$^$9!#(B
$B$D$^$j!"C<Kv<oJL(B@samp{aaa-48}$B$H(B@samp{aaa-30-rv}$B$G$O!"(B
$B$I$A$i$b(B@file{term/aaa}$B$r%m!<%I$7$^$9!#(B
$B%i%$%V%i%jCf$N%3!<%I$G$O(B@code{(getenv "TERM")}$B$r(B
$B;H$C$FI,MW$J$i40A4$JC<Kv<oJLL>$r<hF@$G$-$^$9!#(B

@vindex term-file-prefix
@c   The library's name is constructed by concatenating the value of the
@c variable @code{term-file-prefix} and the terminal type.  Your @file{.emacs}
@c file can prevent the loading of the terminal-specific library by setting
@c @code{term-file-prefix} to @code{nil}.
$BC<Kv%i%$%V%i%j$NL>A0$O!"JQ?t(B@code{term-file-prefix}$B$HC<Kv<oJL$H$r(B
$BO"7k$7$F:n$i$l$^$9!#(B
$B%U%!%$%k(B@file{.emacs}$BCf$G(B@code{term-file-prefix}$B$r(B
@code{nil}$B$K@_Dj$9$k$HC<Kv%i%$%V%i%j$N%m!<%I$rM^;_$G$-$^$9!#(B

@vindex term-setup-hook
@c   Emacs runs the hook @code{term-setup-hook} at the end of
@c initialization, after both your @file{.emacs} file and any
@c terminal-specific library have been read in.  Add hook functions to this
@c hook if you wish to override part of any of the terminal-specific
@c libraries and to define initializations for terminals that do not have a
@c library.  @xref{Hooks}.
Emacs$B$O(B@file{.emacs}$B$HC<Kv%i%$%V%i%j$rFI$s$@$"$H!"(B
$B=i4|2=$N:G8e$K%U%C%/(B@code{term-setup-hook}$B$r<B9T$7$^$9!#(B
$BC<Kv%i%$%V%i%j$K$h$k;XDj$r0lItJQ99$7$?$j!"(B
$BC<Kv%i%$%V%i%j$,$J$$C<Kv$N=i4|@_Dj$r9T$$$?$1$l$P!"(B
$B$3$N%U%C%/$K%U%C%/4X?t$rDI2C$7$F$/$@$5$$!#(B
@xref{Hooks}$B!#(B

@node Find Init
@c @subsection How Emacs Finds Your Init File
@subsection $B8D?M$N=i4|2=%U%!%$%k$NC5$7J}(B

@c   Normally Emacs uses the environment variable @code{HOME} to find
@c @file{.emacs}; that's what @samp{~} means in a file name.  But if you
@c have done @code{su}, Emacs tries to find your own @file{.emacs}, not
@c that of the user you are currently pretending to be.  The idea is
@c that you should get your own editor customizations even if you are
@c running as the super user.
$BDL>o!"(BEmacs$B$O4D6-JQ?t(B@code{HOME}$B$K4p$E$$$F(B@file{.emacs}$B$rC5$7!"(B
$B%U%!%$%kL>$N(B@samp{~}$B$N0UL#$rDj$a$^$9!#(B
$B$7$+$7!"(B@code{su}$B$r<B9T$7$?$"$H$G$O!"(BEmacs$B$O!J(Bsu$B<B9TA0$N!K(B
$B$b$H$N%f!<%6!<$N(B@file{.emacs}$B$rFI$b$&$H$7!"(B
su$B$7$?@h$N%f!<%6!<$N$G$O$"$j$^$;$s!#(B
$B$3$l$O!"$?$H$(%9!<%Q!<%f!<%6!<$K$J$C$F$$$k$H$7$F$b!"(B
$BK\Mh$N%f!<%6!<FH<+$N%(%G%#%?$N%+%9%?%^%$%:$r;H$&$Y$-$@$H9M$($k$+$i$G$9!#(B

@c   More precisely, Emacs first determines which user's init file to use.
@c It gets the user name from the environment variables @code{LOGNAME} and
@c @code{USER}; if neither of those exists, it uses effective user-ID.
@c If that user name matches the real user-ID, then Emacs uses @code{HOME};
@c otherwise, it looks up the home directory corresponding to that user
@c name in the system's data base of users.
@c @c  LocalWords:  backtab
$B$h$j@53N$K$O!"(BEmacs$B$O$^$:$I$N%f!<%6!<$N=i4|2=%U%!%$%k$r;H$&$+$r7h$a$^$9!#(B
$B$=$l$K$O$^$:4D6-JQ?t(B@code{LOGNAME}$B$*$h$S(B@code{USER}$B$+$i%f!<%6!<L>$r<hF@$7$^$9!#(B
$B$3$l$i$N4D6-JQ?t$,$_$D$+$i$J$1$l$P!"(BEmacs$B$O<B8z%f!<%6!<(BID$B$r;2>H$7$^$9!#(B
$B%f!<%6!<L>$H<B%f!<%6!<(BID$B$,0lCW$9$l$P!"(BEmacs$B$O(B@code{HOME}$B$rMxMQ$7$^$9!#(B
$B0lCW$7$J$$>l9g$O!"%7%9%F%`$N%f!<%6!<%G!<%?%Y!<%9$+$i(B
$B$=$N%f!<%6!<L>$KBP1~$9$k%[!<%`%G%#%l%/%H%j$rC5$7$F;HMQ$7$^$9!#(B