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
|
@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/12
@c = 20.5$B2~D{(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1999/12/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.
@iftex
@c @chapter Miscellaneous Commands
@chapter $B$=$NB>$N%3%^%s%I(B
@c This chapter contains several brief topics that do not fit anywhere
@c else: reading netnews, running shell commands and shell subprocesses,
@c using a single shared Emacs for utilities that expect to run an editor
@c as a subprocess, printing hardcopy, sorting text, narrowing display to
@c part of the buffer, editing double-column files and binary files, saving
@c an Emacs session for later resumption, emulating other editors, and
@c various diversions and amusements.
$BK\>O$G$OB>$N>O$KF~$l$k$N$,E,Ev$G$J$+$C$?$$$/$D$+$NOCBj$r<h$j>e$2$^$9!#(B
$B6qBNE*$K$O!"%M%C%H%K%e!<%9$rFI$`!"(B
$B%7%'%k%3%^%s%I$d%7%'%k%5%V%W%m%;%9$rF0$+$9!"(B
$B%(%G%#%?$r%5%V%W%m%;%9$H$7$F5/F0$9$k%W%m%0%i%`4V$G(B1$B$D$N(B
Emacs$B%W%m%;%9$r6&F1MxMQ$9$k!"0u:~$9$k!"%F%-%9%H$r%=!<%H$9$k!"(B
$B%P%C%U%!$N0lIt$@$1$rI=<($9$k$h$&$K@)8B$9$k!"(B
2$BCJAH$_%U%!%$%k$d%P%$%J%j%U%!%$%k$rJT=8$9$k!"(B
Emacs$B%;%C%7%g%s$N>uBV$rJ]B8$7$F$"$H$G$=$N>uBV$KI|5"$9$k!"(B
$BB>$N%(%G%#%?$N%(%_%e%l!<%7%g%s!"$$$m$$$m$J$*M7$S$G$9!#(B
@end iftex
@node Gnus, Shell, Calendar/Diary, Top
@c @section Gnus
@c @cindex Gnus
@c @cindex reading netnews
@section gnus
@cindex gnus
@cindex $B%M%C%H%K%e!<%9$rFI$`(B
@c Gnus is an Emacs package primarily designed for reading and posting
@c Usenet news. It can also be used to read and respond to messages from a
@c number of other sources---mail, remote directories, digests, and so on.
gnus$B$O<g$K%M%C%H%K%e!<%9$rFI$s$@$jEj9F$9$k$?$a$N(BEmacs$B%Q%C%1!<%8$G$9!#(B
$BEE;R%a%$%k!"%j%b!<%H%G%#%l%/%H%j!"%@%$%8%'%9%H$J$I$N(B
$B%M%C%H%K%e!<%90J30$N%a%C%;!<%8$rFI$s$@$j$=$l$i$K1~Ez$9$k$N$K$b;H$($^$9!#(B
@c Here we introduce Gnus and describe several basic features.
$B0J2<$G$O(Bgnus$B$K$D$$$F>R2p$7!"$$$/$D$+$N4pK\E*$J5!G=$K$D$$$F@bL@$7$^$9!#(B
@ifinfo
@c For full details, see @ref{Top, Gnus,, gnus, The Gnus Manual}.
$B>\$7$/$O!"(B@ref{Top, Gnus,, gnus, The Gnus Manual}$B$r;2>H$7$F$/$@$5$$!#(B
@end ifinfo
@iftex
@c For full details on Gnus, type @kbd{M-x info} and then select the Gnus
@c manual.
gnus$B$K$D$$$F>\$7$/CN$k$K$O!"(B
@kbd{M-x info}$B$HBG$C$F$+$i(Bgnus$B$N%^%K%e%"%k$rA*$s$G$/$@$5$$!#(B
@end iftex
@findex gnus
@c To start Gnus, type @kbd{M-x gnus @key{RET}}.
gnus$B$r5/F0$9$k$K$O!"(B@kbd{M-x gnus @key{RET}}$B$HBG$A$^$9!#(B
@menu
* Buffers of Gnus:: The group, summary, and article buffers.
* Gnus Startup:: What you should know about starting Gnus.
* Summary of Gnus:: A short description of the basic Gnus commands.
@end menu
@node Buffers of Gnus
@c @subsection Gnus Buffers
@subsection gnus$B$N%P%C%U%!(B
@c As opposed to most normal Emacs packages, Gnus uses a number of
@c different buffers to display information and to receive commands. The
@c three buffers users spend most of their time in are the @dfn{group
@c buffer}, the @dfn{summary buffer} and the @dfn{article buffer}.
$B$U$D$&$N(BEmacs$B$N%Q%C%1!<%8$H0c$C$F!"(B
gnus$B$OB??t$N0[$J$k%P%C%U%!$r;H$C$F>pJs$rDs<($7$?$j(B
$B%f!<%6!<$N%3%^%s%I$r<u$1<h$j$^$9!#(B
$B%f!<%6!<$,$b$C$H$bB?$/$N;~4V$r;H$&$3$H$K$J$k%P%C%U%!$O!"(B
@dfn{$B%0%k!<%W%P%C%U%!(B}$B!"(B@dfn{$B%5%^%j%P%C%U%!(B}$B!"(B
@dfn{$B5-;v%P%C%U%!(B}$B$N(B3$B$D$G$9!#(B
@c The @dfn{group buffer} contains a list of groups. This is the first
@c buffer Gnus displays when it starts up. It normally displays only the
@c groups to which you subscribe and that contain unread articles. Use
@c this buffer to select a specific group.
@dfn{$B%0%k!<%W%P%C%U%!(B}$B$O%K%e!<%9%0%k!<%W$N0lMw$G$9!#(B
gnus$B$,5/F0$9$k$H!"$^$:$3$N%P%C%U%!$,I=<($5$l$^$9!#(B
$BDL>o$O%f!<%6!<$,9XFI$7$F$$$F!"$+$D!"(B
$BL$FI5-;v$,B8:_$9$k%0%k!<%W$@$1$,I=<($5$l$^$9!#(B
$B$3$N%P%C%U%!$G%0%k!<%W$rA*Br$7$^$9!#(B
@c The @dfn{summary buffer} lists one line for each article in a single
@c group. By default, the author, the subject and the line number are
@c displayed for each article, but this is customizable, like most aspects
@c of Gnus display. The summary buffer is created when you select a group
@c in the group buffer, and is killed when you exit the group. Use this
@c buffer to select an article.
@dfn{$B%5%^%j%P%C%U%!(B}$B$OA*Br$7$?%0%k!<%WFb$N(B1$B$D$N5-;v$K$D$-(B
1$B9T$N>pJs$rI=<($7$^$9!#(B
$B%G%U%)%k%H$G$O!"3F5-;v$NEj9F<T!"BjL\!"9T?t$,I=<($5$l$^$9$,!"(B
gnus$B$N$[$H$s$I$NI=<(FbMF$HF1MM$K$3$NI=<(FbMF$O%+%9%?%^%$%:$G$-$^$9!#(B
$B%0%k!<%W%P%C%U%!$G%0%k!<%W$rA*Br$9$k$H%5%^%j%P%C%U%!$,:n$i$l!"(B
$B%0%k!<%W$+$i=P$k$H:o=|$5$l$^$9!#(B
$B%5%^%j%P%C%U%!$r;H$C$F5-;v$rA*Br$7$^$9!#(B
@c The @dfn{article buffer} displays the article. In normal Gnus usage,
@c you don't select this buffer---all useful article-oriented commands work
@c in the summary buffer. But you can select the article buffer, and
@c execute all Gnus commands from that buffer, if you want to.
@dfn{$B5-;v%P%C%U%!(B}$B$O5-;v$rI=<($7$^$9!#(B
gnus$B$NIaDL$N;H$$J}$G$O!"$3$N%P%C%U%!$rA*Br$9$k$3$H$O$"$j$^$;$s!#(B
$B5-;v$rA`:nBP>]$H$9$k%3%^%s%I72$O%5%^%j%P%C%U%!$GF0:n$7$^$9!#(B
$B$7$+$7!"K>$`$J$i!"5-;v%P%C%U%!$K@Z$jBX$($F!"(B
$B$=$3$G(Bgnus$B$N%3%^%s%I$r<B9T$9$k$3$H$b2DG=$G$9!#(B
@node Gnus Startup
@c @subsection When Gnus Starts Up
@subsection gnus$B$N5/F0;~$NF0:n(B
@c At startup, Gnus reads your @file{.newsrc} news initialization file
@c and attempts to communicate with the local news server, which is a
@c repository of news articles. The news server need not be the same
@c computer you are logged in on.
gnus$B$,5/F0$9$k$H!"8D?M$N%K%e!<%9=i4|2=%U%!%$%k(B@file{.newsrc}$B$rFI$_9~$_!"(B
$B%K%e!<%95-;v$rC_$($F$$$k%m!<%+%k$N%K%e!<%9%5!<%P!<$HDL?.$7$h$&$H$7$^$9!#(B
$B%K%e!<%9%5!<%P!<$O!"(B
$B%f!<%6!<$,%m%0%$%s$7$F$$$k%^%7%s$HF1$8$G$"$kI,MW$O$"$j$^$;$s!#(B
@c If you start Gnus and connect to the server, but do not see any
@c newsgroups listed in the group buffer, type @kbd{L} or @kbd{A k} to get
@c a listing of all the groups. Then type @kbd{u} to toggle
@c subscription to groups.
gnus$B$r5/F0$7$F%K%e!<%9%5!<%P!<$HDL?.$7$?$"$H$G$b(B
$B%0%k!<%W%P%C%U%!$K%0%k!<%W$,(B1$B$D$bI=<($5$l$J$$$H$-$O!"(B
@kbd{L}$B$d(B@kbd{A k}$B$HBG$C$F$9$Y$F$N%0%k!<%W$rI=<($5$;$^$9!#(B
$B$D$.$K3F%0%k!<%W$N9T$G(B@kbd{u}$B$HBG$C$F(B
$B8D!9$N%0%k!<%W$N9XFI!?Hs9XFI$r@Z$jBX$($^$9!#(B
@c The first time you start Gnus, Gnus subscribes you to a few selected
@c groups. All other groups start out as @dfn{killed groups} for you; you
@c can list them with @kbd{A k}. All new groups that subsequently come to
@c exist at the news server become @dfn{zombie groups} for you; type @kbd{A
@c z} to list them. You can subscribe to a group shown in these lists
@c using the @kbd{u} command.
$B=i$a$F(Bgnus$B$r5/F0$7$?$H$-$O!"$4$/>/?t$NA*$P$l$?%0%k!<%W$N$_$,(B
$B9XFI>uBV$K$"$j$^$9!#(B
$BB>$N%0%k!<%W$O(B@dfn{$BHs9XFI%0%k!<%W(B}$B!J(Bkilled groups$B!K$K$J$C$F$$$F!"(B
@kbd{A k}$B$r;H$&$HI=<($5$l$^$9!#(B
$B:G=i$N5/F00J8e$K%K%e!<%9%5!<%P!<>e$KDI2C$5$l$?%0%k!<%W$O$9$Y$F!"(B
@dfn{$B%>%s%S%0%k!<%W(B}$B!J(Bzombie groups$B!K$K$J$C$F$$$F!"(B
@kbd{A z}$B$r;H$&$HI=<($5$l$^$9!#(B
@kbd{u}$B$r;H$($P$3$l$i$N%0%k!<%W$r9XFI>uBV$K$G$-$^$9!#(B
@c When you quit Gnus with @kbd{q}, it automatically records in your
@c @file{.newsrc} and @file{.newsrc.eld} initialization files the
@c subscribed or unsubscribed status of all groups. You should normally
@c not edit these files manually, but you may if you know how.
@kbd{q}$B$G(Bgnus$B$r=*N;$9$k$H!"=i4|2=%U%!%$%k(B@file{.newsrc}$B$H(B
@file{.newsrc.eld}$B$K$9$Y$F$N%0%k!<%W$N9XFI!?Hs9XFI$r<+F0E*$K5-O?$7$^$9!#(B
$BDL>o$O$3$l$i$N%U%!%$%k$r<j$GJT=8$9$Y$-$G$O$"$j$^$;$s$,!"(B
$B$d$j$+$?$,$o$+$C$F$$$k$J$i$+$^$$$^$;$s!#(B
@node Summary of Gnus
@c @subsection Summary of Gnus Commands
@subsection gnus$B%3%^%s%I$N$^$H$a(B
@c Reading news is a two step process:
$B%K%e!<%9$rFI$`$K$O$D$.$N(B2$B$D$NCJ3,$rF'$_$^$9!#(B
@enumerate
@item
@c Choose a group in the group buffer.
$B%0%k!<%W%P%C%U%!$G%0%k!<%W$rA*Br$9$k!#(B
@item
@c Select articles from the summary buffer. Each article selected is
@c displayed in the article buffer in a large window, below the summary
@c buffer in its small window.
$B%5%^%j%P%C%U%!$G5-;v$rA*Br$9$k!#(B
$B5-;v$rA*Br$9$k$H!"%5%^%j%P%C%U%!$N>.$5$J%&%#%s%I%&$N2<$N(B
$BBg$-$a$N%&%#%s%I%&$NCf$N5-;v%P%C%U%!$KA*Br$7$?5-;v$,I=<($5$l$k!#(B
@end enumerate
@c Each Gnus buffer has its own special commands; however, the meanings
@c of any given key in the various Gnus buffers are usually analogous, even
@c if not identical. Here are commands for the group and summary buffers:
gnus$B$N3F%P%C%U%!$K$O$=$l$>$lFH<+$N%3%^%s%I$,$"$j$^$9!#(B
$B$7$+$7!"(Bgnus$B$N$5$^$6$^$J%P%C%U%!$N$I$s$J%-!<$N0UL#$b!"(B
$BEy2A$G$O$J$$$K$;$h!"$@$$$?$$F1$8$G$9!#(B
$B0J2<$O!"%0%k!<%W%P%C%U%!$H%5%^%j%P%C%U%!$N%3%^%s%I$G$9!#(B
@table @kbd
@c @kindex q @r{(Gnus Group mode)}
@kindex q @r{$B!J(Bgnus$B%0%k!<%W%b!<%I!K(B}
@findex gnus-group-exit
@item q
@c In the group buffer, update your @file{.newsrc} initialization file
@c and quit Gnus.
$B%0%k!<%W%P%C%U%!$G$O!"=i4|2=%U%!%$%k(B@file{.newsrc}$B$r99?7$7$F(Bgnus$B$r=*N;$9$k!#(B
@c In the summary buffer, exit the current group and return to the
@c group buffer. Thus, typing @kbd{q} twice quits Gnus.
$B%5%^%j%P%C%U%!$G$O!"(B
$B%+%l%s%H%0%k!<%W$+$iH4$1=P$F%0%k!<%W%P%C%U%!$KLa$k!#(B
$B$7$?$,$C$F!"(B@kbd{q}$B$r(B2$B2sBG$D$H(Bgnus$B$r=*$k!#(B
@c @kindex L @r{(Gnus Group mode)}
@kindex L @r{$B!J(Bgnus$B%0%k!<%W%b!<%I!K(B}
@findex gnus-group-list-all-groups
@item L
@c In the group buffer, list all the groups available on your news
@c server (except those you have killed). This may be a long list!
$B%0%k!<%W%P%C%U%!$G$O!"(B
$B%K%e!<%9%5!<%P!<$K$"$k!JHs9XFI$K$7$?$b$N0J30$N!K(B
$B$9$Y$F$N%0%k!<%W$rI=<($9$k!#(B
$B$9$4$/D9$$%j%9%H$K$J$k$+$b$7$l$J$$$N$GCm0U!*(B
@c @kindex l @r{(Gnus Group mode)}
@kindex l @r{$B!J(Bgnus$B%0%k!<%W%b!<%I!K(B}
@findex gnus-group-list-groups
@item l
@c In the group buffer, list only the groups to which you subscribe and
@c which contain unread articles.
$B%0%k!<%W%P%C%U%!$G$O!"9XFICf$GL$FI5-;v$,$"$k%0%k!<%W$N$_$rI=<($9$k!#(B
@c @kindex u @r{(Gnus Group mode)}
@kindex u @r{$B!J(Bgnus$B%0%k!<%W%b!<%I!K(B}
@findex gnus-group-unsubscribe-current-group
@c @cindex subscribe groups
@c @cindex unsubscribe groups
@cindex $B%0%k!<%W$N9XFI(B
@cindex $B%0%k!<%W$NHs9XFI2=(B
@item u
@c In the group buffer, unsubscribe from (or subscribe to) the group listed
@c in the line that point is on. When you quit Gnus by typing @kbd{q},
@c Gnus lists in your @file{.newsrc} file which groups you have subscribed
@c to. The next time you start Gnus, you won't see this group,
@c because Gnus normally displays only subscribed-to groups.
$B%0%k!<%W%P%C%U%!$G$O!"%]%$%s%H$N$"$k9T$N%0%k!<%W$N9XFI!?Hs9XFI$r@Z$jBX$($k!#(B
@kbd{q}$B$G(Bgnus$B$r=*$k$H!"(Bgnus$B$O$3$N>uBV$r(B@file{.newsrc}$B%U%!%$%k$K5-O?$9$k!#(B
gnus$B$O!"DL>o!"9XFI%0%k!<%W$N$_$rI=<($9$k$?$a!"(B
$B$D$.$K(Bgnus$B$r5/F0$7$?$H$-$K$OHs9XFI$K$7$?%0%k!<%W$OI=<($5$l$J$$!#(B
@c @kindex C-k @r{(Gnus)}
@kindex C-k @r{$B!J(Bgnus$B!K(B}
@findex gnus-group-kill-group
@item C-k
@c In the group buffer, ``kill'' the current line's group---don't
@c even list it in @file{.newsrc} from now on. This affects future
@c Gnus sessions as well as the present session.
$B%0%k!<%W%P%C%U%!$G$O!"%]%$%s%H$N$"$k9T$N%0%k!<%W$r!VKu>C!W$9$k!#(B
$B$9$J$o$A!"$=$N%0%k!<%W$O0J8e(B@file{.newsrc}$B$K$b8=$l$J$/$J$k!#(B
$B$3$N%3%^%s%I$N8z2L$O!"8=:_$N(Bgnus$B%;%C%7%g%s$@$1$G$J$/(B
$B>-Mh$N(Bgnus$B%;%C%7%g%s$K$b1F6A$9$k!#(B
@c When you quit Gnus by typing @kbd{q}, Gnus writes information
@c in the file @file{.newsrc} describing all newsgroups except those you
@c have ``killed.''
@kbd{q}$B$G(Bgnus$B$r=*N;$9$k$H!"(B
gnus$B$O%U%!%$%k(B@file{.newsrc}$B$K(B
$BKu>C$7$?%0%k!<%W$r=|$/$9$Y$F$N%0%k!<%W$N>pJs$r=q$-=P$9!#(B
@c @kindex SPC @r{(Gnus)}
@kindex SPC @r{$B!J(Bgnus$B!K(B}
@findex gnus-group-read-group
@item @key{SPC}
@c In the group buffer, select the group on the line under the cursor
@c and display the first unread article in that group.
$B%0%k!<%W%P%C%U%!$G$O!"%]%$%s%H$N$"$k9T$KBP1~$9$k%0%k!<%W$rA*Br$7!"(B
$B$=$N%0%k!<%W$N:G=i$NL$FI5-;v$rI=<($9$k!#(B
@need 1000
@c In the summary buffer,
$B%5%^%j%P%C%U%!$G$O!"$D$.$N$h$&$K$J$k!#(B
@itemize @bullet
@item
@c Select the article on the line under the cursor if none is selected.
$BA*Br$5$l$F$$$k5-;v$,$J$1$l$P!"(B
$B%]%$%s%H$N$"$k9T$N5-;v$rA*Br$9$k!#(B
@item
@c Scroll the text of the selected article (if there is one).
$B!JA*Br$5$l$F$$$k5-;v$,$"$l$P!K$=$N5-;v$N%F%-%9%H$r(B1$B2hLLJ,?J$a$k!#(B
@item
@c Select the next unread article if at the end of the current article.
$BA*Br$5$l$F$$$k5-;v$NKvHx$K$$$k>l9g$O!"$D$.$NL$FI5-;v$rA*Br$9$k!#(B
@end itemize
@c Thus, you can move through all the articles by repeatedly typing @key{SPC}.
$B$9$J$o$A!"7+$jJV$7(B@key{SPC}$B$rBG$H!"$9$Y$F$N5-;v$r=g$K8+$F$$$/$3$H$,$G$-$k!#(B
@c @kindex DEL @r{(Gnus)}
@kindex DEL @r{$B!J(Bgnus$B!K(B}
@item @key{DEL}
@c In the group buffer, move point to the previous group containing
@c unread articles.
$B%0%k!<%W%P%C%U%!$G$O!"%]%$%s%H$rL$FI5-;v$,$"$k(B1$B$D$^$($N%0%k!<%W$K0\F0$9$k!#(B
@findex gnus-summary-prev-page
@c In the summary buffer, scroll the text of the article backwards.
$B%5%^%j%P%C%U%!$G$O!"5-;v$N%F%-%9%H$r(B1$B2hLLJ,La$9!#(B
@c @kindex n @r{(Gnus)}
@kindex n @r{$B!J(Bgnus$B!K(B}
@findex gnus-group-next-unread-group
@findex gnus-summary-next-unread-article
@item n
@c Move point to the next unread group, or select the next unread article.
$B%]%$%s%H$r$D$.$NL$FI%0%k!<%W$K?J$a$k$+!"(B
$B$^$?$O!"$D$.$NL$FI5-;v$rA*Br$9$k!#(B
@c @kindex p @r{(Gnus)}
@kindex p @r{$B!J(Bgnus$B!K(B}
@findex gnus-group-prev-unread-group
@findex gnus-summary-prev-unread-article
@item p
@c Move point to the previous unread group, or select the previous
@c unread article.
$B%]%$%s%H$r$^$($NL$FI%0%k!<%W$XLa$9$+!"(B
$B$^$?$O!"$^$($NL$FI5-;v$rA*Br$9$k!#(B
@c @kindex C-n @r{(Gnus Group mode)}
@kindex C-n @r{$B!J(Bgnus$B%0%k!<%W%b!<%I!K(B}
@findex gnus-group-next-group
@c @kindex C-p @r{(Gnus Group mode)}
@kindex C-p @r{$B!J(Bgnus$B%0%k!<%W%b!<%I!K(B}
@findex gnus-group-prev-group
@c @kindex C-n @r{(Gnus Summary mode)}
@kindex C-n @r{$B!J(Bgnus$B%5%^%j%b!<%I!K(B}
@findex gnus-summary-next-subject
@c @kindex C-p @r{(Gnus Summary mode)}
@kindex C-p @r{$B!J(Bgnus$B%5%^%j%b!<%I!K(B}
@findex gnus-summary-prev-subject
@item C-n
@itemx C-p
@c Move point to the next or previous item, even if it is marked as read.
@c This does not select the article or group on that line.
$B4{FI$G$"$C$F$b%]%$%s%H$r(B1$B$D$"$H!?$^$($N9`L\$K0\F0$9$k!#(B
$B%]%$%s%H$,$"$k9T$N5-;v$d%0%k!<%W$rA*Br$9$k$3$H$O$7$J$$!#(B
@c @kindex s @r{(Gnus Summary mode)}
@kindex s @r{$B!J(Bgnus$B%5%^%j%b!<%I!K(B}
@findex gnus-summary-isearch-article
@item s
@c In the summary buffer, do an incremental search of the current text in
@c the article buffer, just as if you switched to the article buffer and
@c typed @kbd{C-s}.
$B%5%^%j%P%C%U%!$G$O!"5-;v%P%C%U%!$K@Z$jBX$($F(B@kbd{C-s}$B$rBG$C$?$+$N$h$&$K!"(B
$B5-;v%P%C%U%!$N%F%-%9%H$KBP$7$F%$%s%/%j%a%s%?%k%5!<%A$r9T$&!#(B
@c @kindex M-s @r{(Gnus Summary mode)}
@kindex M-s @r{$B!J(Bgnus$B%5%^%j%b!<%I!K(B}
@findex gnus-summary-search-article-forward
@item M-s @var{regexp} @key{RET}
@c In the summary buffer, search forward for articles containing a match
@c for @var{regexp}.
$B%5%^%j%P%C%U%!$G$O!"(B
@var{regexp}$B$K0lCW$9$k5-;v$,$_$D$+$k$^$GA08~$-$KC5:w$9$k!#(B
@end table
@ignore
@node Where to Look
@subsection Where to Look Further
@c Too many references to the name of the manual if done with xref in TeX!
Gnus is powerful and customizable. Here are references to a few
@ifinfo
additional topics:
@end ifinfo
@iftex
additional topics in @cite{The Gnus Manual}:
@itemize @bullet
@item
Follow discussions on specific topics.@*
See section ``Threading.''
@item
Read digests. See section ``Document Groups.''
@item
Refer to and jump to the parent of the current article.@*
See section ``Finding the Parent.''
@item
Refer to articles by using Message-IDs included in the messages.@*
See section ``Article Keymap.''
@item
Save articles. See section ``Saving Articles.''
@item
Have Gnus score articles according to various criteria, like author
name, subject, or string in the body of the articles.@*
See section ``Scoring.''
@item
Send an article to a newsgroup.@*
See section ``Composing Messages.''
@end itemize
@end iftex
@ifinfo
@itemize @bullet
@item
Follow discussions on specific topics.@*
@xref{Threading, , Reading Based on Conversation Threads,
gnus, The Gnus Manual}.
@item
Read digests. @xref{Document Groups, , , gnus, The Gnus Manual}.
@item
Refer to and jump to the parent of the current article.@*
@xref{Finding the Parent, , , gnus, The Gnus Manual}.
@item
Refer to articles by using Message-IDs included in the messages.@*
@xref{Article Keymap, , , gnus, The Gnus Manual}.
@item
Save articles. @xref{Saving Articles, , , gnus, The Gnus Manual}.
@item
Have Gnus score articles according to various criteria, like author
name, subject, or string in the body of the articles.@*
@xref{Scoring, , , gnus, The Gnus Manual}.
@item
Send an article to a newsgroup.@*
@xref{Composing Messages, , , gnus, The Gnus Manual}.
@end itemize
@end ifinfo
@end ignore
@node Shell, Emacs Server, Gnus, Top
@c @section Running Shell Commands from Emacs
@c @cindex subshell
@c @cindex shell commands
@section Emacs$B$+$i%7%'%k%3%^%s%I$r<B9T$9$k(B
@cindex $B%5%V%7%'%k(B
@cindex $B%7%'%k%3%^%s%I(B
@c Emacs has commands for passing single command lines to inferior shell
@c processes; it can also run a shell interactively with input and output to
@c an Emacs buffer named @samp{*shell*}.
Emacs$B$K$O!"(B
1$B$D$N%3%^%s%I9T$r2<0L$N%7%'%k%W%m%;%9$KEO$7$F<B9T$5$;$k5!G=$,$"$j$^$9!#(B
$B$^$?!"F~=PNO$r(B@samp{*shell*}$B$H$$$&L>A0$N(BEmacs$B%P%C%U%!$K@\B3$7$F(B
$BBPOCE*$K%7%'%k$r<B9T$9$k5!G=$b$"$j$^$9!#(B
@table @kbd
@item M-! @var{cmd} @key{RET}
@c Run the shell command line @var{cmd} and display the output
@c (@code{shell-command}).
$B%7%'%k%3%^%s%I(B@var{cmd}$B$r<B9T$7!"$=$N7k2L$rI=<($9$k(B
$B!J(B@code{shell-command}$B!K!#(B
@item M-| @var{cmd} @key{RET}
@c Run the shell command line @var{cmd} with region contents as input;
@c optionally replace the region with the output
@c (@code{shell-command-on-region}).
$B%j!<%8%g%s$NFbMF$rF~NO$H$7$F%7%'%k%3%^%s%I(B@var{cmd}$B$r<B9T$9$k!#(B
$B>l9g$K$h$C$F$O!"%j!<%8%g%s$r%7%'%k%3%^%s%I$N=PNO$GCV$-49$($k!#(B
$B!J(B@code{shell-command-on-region}$B!K!#(B
@item M-x shell
@c Run a subshell with input and output through an Emacs buffer.
@c You can then give commands interactively.
$BF~=PNO$r(BEmacs$B%P%C%U%!$K@\B3$7$F%5%V%7%'%k$r<B9T$9$k!#(B
$B$9$k$H!"BPOCE*$K%3%^%s%I$rF~NO$G$-$k!#(B
@end table
@menu
* Single Shell:: How to run one shell command and return.
* Interactive Shell:: Permanent shell taking input via Emacs.
* Shell Mode:: Special Emacs commands used with permanent shell.
* History: Shell History. Repeating previous commands in a shell buffer.
* Options: Shell Options. Options for customizing Shell mode.
* Remote Host:: Connecting to another computer.
@end menu
@node Single Shell
@c @subsection Single Shell Commands
@subsection $BC10l$N%7%'%k%3%^%s%I(B
@kindex M-!
@findex shell-command
@c @kbd{M-!} (@code{shell-command}) reads a line of text using the
@c minibuffer and executes it as a shell command in a subshell made just
@c for that command. Standard input for the command comes from the null
@c device. If the shell command produces any output, the output goes into
@c an Emacs buffer named @samp{*Shell Command Output*}, which is displayed
@c in another window but not selected. A numeric argument, as in @kbd{M-1
@c M-!}, directs this command to insert any output into the current buffer.
@c In that case, point is left before the output and the mark is set after
@c the output.
@kbd{M-!}$B!J(B@code{shell-command}$B!K$O!"?7$?$K:n$C$?%5%V%7%'%k$K$F!"(B
$B%_%K%P%C%U%!$GFI$_<h$C$?(B1$B9T$N%F%-%9%H$r%7%'%k%3%^%s%I$H$7$F<B9T$7$^$9!#(B
$B%7%'%k%3%^%s%I$NI8=`F~NO$O(Bnull$BAuCV!J$D$^$j6u!K$G$9!#(B
$B%7%'%k%3%^%s%I$N=PNO$,$"$l$P!"(B@samp{*Shell Command Output*}$B$H$$$&L>A0$N(B
Emacs$B%P%C%U%!$KF~$l$FJL$N%&%#%s%I%&$KI=<($7$^$9$,!"(B
$B!J%+%l%s%H%P%C%U%!$K$O!KA*Br$7$^$;$s!#(B
@kbd{M-1 M-!}$B$N$h$&$K?t0z?t$r;XDj$9$k$H!"(B
$B%7%'%k%3%^%s%I$N=PNO$r%+%l%s%H%P%C%U%!$KA^F~$7$^$9!#(B
$B$=$N>l9g!"%]%$%s%H$O!JA^F~$5$l$?!K=PNO$N@hF,$KCV$+$l!"(B
$B%^!<%/$O=PNO$NKvHx$KCV$+$l$^$9!#(B
@c If the shell command line ends in @samp{&}, it runs asynchronously.
@c For a synchronous shell command, @code{shell-command} returns the
@c command's exit status (0 means success), when it is called from a Lisp
@c program.
$B%7%'%k%3%^%s%I$NKvHx$,(B@samp{&}$B$K$J$C$F$$$k$H!"(B
$B%7%'%k%3%^%s%I$OHsF14|$K<B9T$5$l$^$9!#(B
$BF14|<B9T$N%7%'%k%3%^%s%I$G$O!"(BLisp$B%W%m%0%i%`$+$i8F$P$l$?$H$-$K$O!"(B
@code{shell-command}$B$O%3%^%s%I$N=*N;>uBV!J(B0$B$O@.8y$r0UL#$9$k!K$rJV$7$^$9!#(B
@kindex M-|
@findex shell-command-on-region
@c @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!} but
@c passes the contents of the region as the standard input to the shell
@c command, instead of no input. If a numeric argument is used, meaning
@c insert the output in the current buffer, then the old region is deleted
@c first and the output replaces it as the contents of the region. It
@c returns the command's exit status when it is called from a Lisp program.
@kbd{M-|}$B!J(B@code{shell-command-on-region}$B!K$O(B@kbd{M-!}$B$HF1MM$G$9$,!"(B
$B%7%'%k%3%^%s%I$NI8=`F~NO$O6u$G$O$J$/%j!<%8%g%s$NFbMF$,0z$-EO$5$l$^$9!#(B
$B?t0z?t$r;XDj$9$k$H!"$=$l$^$G$N%j!<%8%g%s$O:o=|$5$l(B
$B%7%'%k%3%^%s%I$N=PNO$GCV$-49$o$j?7$?$J%j!<%8%g%s$K$J$j$^$9!#(B
$B$3$N%3%^%s%I$O!"(BLisp$B%W%m%0%i%`$+$i8F$P$l$?$H$-$K$O!"(B
$B%3%^%s%I$N=*N;>uBV$rJV$7$^$9!#(B
@vindex shell-file-name
@c @cindex environment
@cindex $B4D6-(B
@c Both @kbd{M-!} and @kbd{M-|} use @code{shell-file-name} to specify the
@c shell to use. This variable is initialized based on your @code{SHELL}
@c environment variable when Emacs is started. If the file name does not
@c specify a directory, the directories in the list @code{exec-path} are
@c searched; this list is initialized based on the environment variable
@c @code{PATH} when Emacs is started. Your @file{.emacs} file can override
@c either or both of these default initializations.@refill
@kbd{M-!}$B$b(B@kbd{M-|}$B$b!";HMQ$9$k%7%'%k$O(B@code{shell-file-name}$B$G;XDj$7$^$9!#(B
$B$3$NJQ?t$O!"(BEmacs$B5/F0;~$N4D6-JQ?t(B@code{SHELL}$B$r$b$H$K=i4|@_Dj$5$l$^$9!#(B
$B%U%!%$%kL>$K%G%#%l%/%H%j$,;XDj$5$l$F$$$J$1$l$P!"(B
@code{exec-path}$B$K;XDj$5$l$F$$$k%G%#%l%/%H%j72$rC5:w$7$^$9!#(B
@code{exec-path}$B$NCM$O!"(BEmacs$B5/F0;~$N4D6-JQ?t(B@code{PATH}$B$r(B
$B$b$H$K=i4|@_Dj$5$l$^$9!#(B
$B8D?M$N%U%!%$%k(B@file{.emacs}$B$G(B
$B$3$l$i$NJQ?t$N=i4|CM$r<+M3$KJQ99$7$F$+$^$$$^$;$s!#(B
@c Both @kbd{M-!} and @kbd{M-|} wait for the shell command to complete.
@c To stop waiting, type @kbd{C-g} to quit; that terminates the shell
@c command with the signal @code{SIGINT}---the same signal that @kbd{C-c}
@c normally generates in the shell. Emacs waits until the command actually
@c terminates. If the shell command doesn't stop (because it ignores the
@c @code{SIGINT} signal), type @kbd{C-g} again; this sends the command a
@c @code{SIGKILL} signal which is impossible to ignore.
@kbd{M-!}$B$b(B@kbd{M-|}$B$b%7%'%k%3%^%s%I$N<B9T40N;$rBT$A9g$o$;$^$9!#(B
$BBT$D$N$r$d$a$?$$>l9g$O!"(B@kbd{C-g}$B$GCfCG$G$-$^$9!#(B
$B$3$N>l9g!"%7%'%k%3%^%s%I$O%7%0%J%k(B@code{SIGINT}$B$G=*N;$5$;$i$l$^$9!#(B
$B$3$N%7%0%J%k$O!"%7%'%k$r;HMQCf$K(B@kbd{C-c}$B$,IaDL$KAw$k%7%0%J%k$HF1$8$G$9!#(B
Emacs$B$O%7%'%k%3%^%s%I$,<B:]$K=*N;$9$k$^$GBT$A$^$9!#(B
$B%7%'%k%3%^%s%I$,!J%7%0%J%k(B@code{SIGINT}$B$rL5;k$7$F!KDd;_$7$J$$>l9g$O!"(B
$B:FEY(B@kbd{C-g}$B$rBG$A$^$9!#(B
$B$9$k$H!"L5;k$G$-$J$$%7%0%J%k(B@code{SIGKILL}$B$r%7%'%k%3%^%s%I$KAw$j$^$9!#(B
@c To specify a coding system for @kbd{M-!} or @kbd{M-|}, use the command
@c @kbd{C-x @key{RET} c} immediately beforehand. @xref{Specify Coding}.
@kbd{M-!}$B$d(B@kbd{M-|}$B$G;HMQ$9$k%3!<%G%#%s%0%7%9%F%`$r;XDj$9$k$K$O!"(B
$B$3$l$i$N%3%^%s%I$ND>A0$K%3%^%s%I(B@kbd{C-x @key{RET} c}$B$r;H$$$^$9!#(B
@xref{Specify Coding}$B!#(B
@vindex shell-command-default-error-buffer
@c Error output from the command is normally intermixed with the regular
@c output. If you set the variable
@c @code{shell-command-default-error-buffer} to a string, which is a buffer
@c name, error output is inserted before point in the buffer of that name.
$B%3%^%s%I$+$i$N%(%i!<=PNO$O!"DL>o!"IaDL$N=PNO$H:.$6$j9g$C$F$7$^$$$^$9!#(B
$BJQ?t(B@code{shell-command-default-error-buffer}$B$K(B
$B%P%C%U%!L>$NJ8;zNs$r@_Dj$9$k$H!"(B
$B$=$NL>A0$N%P%C%U%!$N%]%$%s%H0LCV$N$^$($K%(%i!<=PNO$,A^F~$5$l$^$9!#(B
@node Interactive Shell
@c @subsection Interactive Inferior Shell
@subsection $BBPOCE*$J2<0L$N%7%'%k(B
@findex shell
@c To run a subshell interactively, putting its typescript in an Emacs
@c buffer, use @kbd{M-x shell}. This creates (or reuses) a buffer named
@c @samp{*shell*} and runs a subshell with input coming from and output going
@c to that buffer. That is to say, any ``terminal output'' from the subshell
@c goes into the buffer, advancing point, and any ``terminal input'' for
@c the subshell comes from text in the buffer. To give input to the subshell,
@c go to the end of the buffer and type the input, terminated by @key{RET}.
$B%5%V%7%'%k$rBPOCE*$K<B9T$7!"$=$NBPOC5-O?$r(BEmacs$B%P%C%U%!$K;D$9$K$O!"(B
@kbd{M-x shell}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"(B@samp{*shell*}$B$H$$$&L>A0$N%P%C%U%!$r:n@.!J$^$?$O:F;HMQ!K$7!"(B
$B$3$N%P%C%U%!$KF~=PNO$9$k%5%V%7%'%k$r<B9T$7$^$9!#(B
$B$D$^$j!"%5%V%7%'%k$N!XC<Kv=PNO!Y$O%P%C%U%!$KA^F~$5$l%]%$%s%H$r?J$a!"(B
$B%5%V%7%'%k$N!XC<KvF~NO!Y$O%P%C%U%!$+$i<h$i$l$^$9!#(B
$B%5%V%7%'%k$KF~NO$rM?$($k$K$O!"%P%C%U%!$NKvHx$X0\F0$7$F(B
$BF~NO$rBG$A9~$_:G8e$K(B@key{RET}$B$rBG$A$^$9!#(B
@c Emacs does not wait for the subshell to do anything. You can switch
@c windows or buffers and edit them while the shell is waiting, or while it is
@c running a command. Output from the subshell waits until Emacs has time to
@c process it; this happens whenever Emacs is waiting for keyboard input or
@c for time to elapse.
Emacs$B$O%5%V%7%'%k$,2?$+$9$k$N$rBT$D$3$H$O$7$^$;$s!#(B
$B%7%'%k$,BT$C$F$$$h$&$,%7%'%k%3%^%s%I$r<B9T$7$F$$$h$&$,!"(B
$B%&%#%s%I%&$d%P%C%U%!$r@Z$jBX$($FJT=8$G$-$^$9!#(B
$B%5%V%7%'%k$+$i$N=PNO$O!"(B
Emacs$B$,$=$l$r<h$j9~$`=hM}$r<B9T$G$-$k$^$GBT$?$5$l$^$9!#(B
$B<h$j9~$_=hM}$O!"(BEmacs$B$,%-!<%\!<%IF~NO$rBT$C$?$j!"(B
$B;~4VBT$A$KF~$C$?$H$-$K9T$o$l$^$9!#(B
@c To make multiple subshells, rename the buffer @samp{*shell*} to
@c something different using @kbd{M-x rename-uniquely}. Then type @kbd{M-x
@c shell} again to create a new buffer @samp{*shell*} with its own
@c subshell. If you rename this buffer as well, you can create a third
@c one, and so on. All the subshells run independently and in parallel.
$BJ#?t$N%5%V%7%'%k$r;H$&$K$O!"%P%C%U%!(B@samp{*shell*}$B$NL>A0$r%3%^%s%I(B
@kbd{M-x rename-uniquely}$B$GJL$N$b$N$KJQ99$7$^$9!#(B
$B$=$&$7$F$+$i!":FEY(B@kbd{M-x shell}$B$HBG$A9~$s$G!"(B
$B?7$7$$%5%V%7%'%k$r;}$D%P%C%U%!(B@samp{*shell*}$B$r?7$?$K:n$j$^$9!#(B
$B$3$N%P%C%U%!$NL>A0$bF1$8$h$&$KJQ$($l$P!"$5$i$K?7$7$/:n$l$^$9!#(B
$B$9$Y$F$N%5%V%7%'%k$OFHN)$+$DJB9T$K<B9T$5$l$^$9!#(B
@vindex explicit-shell-file-name
@c @cindex @code{ESHELL} environment variable
@c @cindex @code{SHELL} environment variable
@cindex $B4D6-JQ?t(B@code{ESHELL}
@cindex @code{ESHELL}$B!J4D6-JQ?t!K(B
@cindex $B4D6-JQ?t(B@code{SHELL}
@cindex @code{SHELL}$B!J4D6-JQ?t!K(B
@c The file name used to load the subshell is the value of the variable
@c @code{explicit-shell-file-name}, if that is non-@code{nil}. Otherwise,
@c the environment variable @code{ESHELL} is used, or the environment
@c variable @code{SHELL} if there is no @code{ESHELL}. If the file name
@c specified is relative, the directories in the list @code{exec-path} are
@c searched; this list is initialized based on the environment variable
@c @code{PATH} when Emacs is started. Your @file{.emacs} file can override
@c either or both of these default initializations.
$B%5%V%7%'%k$H$7$F<B9T$9$k%U%!%$%kL>$O!"JQ?t(B@code{explicit-shell-file-name}
$B$NCM$,(B@code{nil}$B0J30$J$i$P!"$3$NJQ?t$NCM$G;XDj$7$^$9!#(B
@code{nil}$B$N$H$-$O!"4D6-JQ?t(B@code{ESHELL}$B$NCM$,;H$o$l$^$9$,!"(B
$B$3$l$,B8:_$7$J$$>l9g$O4D6-JQ?t(B@code{SHELL}$B$NCM$,;H$o$l$^$9!#(B
$B;XDj$5$l$?%U%!%$%kL>$,AjBPL>$N>l9g$O!"(B
@code{exec-path}$B$K;XDj$5$l$F$$$k%G%#%l%/%H%j72$rC5:w$7$^$9!#(B
$BJQ?t(B@code{exec-path}$B$O!"(B
Emacs$B5/F0;~$N4D6-JQ?t(B@code{PATH}$B$r$b$H$K=i4|@_Dj$5$l$^$9!#(B
$B8D?M$N%U%!%$%k(B@file{.emacs}$B$G$3$l$i$NJQ?t$r<+M3$KJQ99$7$F$+$^$$$^$;$s!#(B
@c To specify a coding system for the shell, you can use the command
@c @kbd{C-x @key{RET} c} immediately before @kbd{M-x shell}. You can also
@c specify a coding system after starting the shell by using @kbd{C-x
@c @key{RET} p} in the shell buffer. @xref{Specify Coding}.
$B%7%'%k$KBP$9$k%3!<%G%#%s%0%7%9%F%`$r;XDj$9$k$K$O!"(B
@kbd{M-x shell}$B$ND>A0$K%3%^%s%I(B@kbd{C-x @key{RET} c}$B$r;H$$$^$9!#(B
$B$^$?$O!"%7%'%k$r3+;O$7$?$"$H$K%7%'%k%P%C%U%!$G(B@kbd{C-x @key{RET} p}$B$r(B
$B;H$C$F$b;XDj$G$-$^$9!#(B
@xref{Specify Coding}$B!#(B
@c As soon as the subshell is started, it is sent as input the contents
@c of the file @file{~/.emacs_@var{shellname}}, if that file exists, where
@c @var{shellname} is the name of the file that the shell was loaded from.
@c For example, if you use bash, the file sent to it is
@c @file{~/.emacs_bash}.
@var{shellname}$B$r%7%'%k$N%U%!%$%kL>$H$7$F!"(B
$B%U%!%$%k(B@file{~/.emacs_@var{shellname}}$B$,B8:_$9$k$H!"(B
Emacs$B$O%5%V%7%'%k$r<B9T3+;O$7$?D>8e$K=i4|@_Dj$N$?$a$K!"(B
$B$3$N%U%!%$%k$NFbMF$r%7%'%k$X$NF~NO$H$7$FAw$j9~$_$^$9!#(B
$B$?$H$($P!"(Bbash$B$r;H$C$F$$$k$N$J$i%U%!%$%k(B@file{~/.emacs_bash}$B$NFbMF$,Aw$i$l$^$9!#(B
@vindex shell-pushd-regexp
@vindex shell-popd-regexp
@vindex shell-cd-regexp
@c @code{cd}, @code{pushd} and @code{popd} commands given to the inferior
@c shell are watched by Emacs so it can keep the @samp{*shell*} buffer's
@c default directory the same as the shell's working directory. These
@c commands are recognized syntactically by examining lines of input that are
@c sent. If you use aliases for these commands, you can tell Emacs to
@c recognize them also. For example, if the value of the variable
@c @code{shell-pushd-regexp} matches the beginning of a shell command line,
@c that line is regarded as a @code{pushd} command. Change this variable when
@c you add aliases for @samp{pushd}. Likewise, @code{shell-popd-regexp} and
@c @code{shell-cd-regexp} are used to recognize commands with the meaning of
@c @samp{popd} and @samp{cd}. These commands are recognized only at the
@c beginning of a shell command line.@refill
Emacs$B$O!"%7%'%k%3%^%s%I!"(B@code{cd}$B!"(B@code{pushd}$B!"(B@code{popd}$B$,(B
$B%7%'%k$X$NF~NO$H$7$FAw$i$l$k$N$r4F;k$7!"(B
$B%P%C%U%!(B@samp{*shell*}$B$N%G%U%)%k%H%G%#%l%/%H%j$H(B
$B%7%'%k$N%+%l%s%H%G%#%l%/%H%j$,0lCW$9$k$h$&$K$7$^$9!#(B
$B$3$l$i$N%7%'%k%3%^%s%I$O!"Aw$i$l$kF~NO9T$NJ8;zNs$r9=J8E*$KD4$Y$F<1JL$7$^$9!#(B
$B$3$l$i$N%7%'%k%3%^%s%I$KJLL>$rIU$1$k$N$J$i!"(B
Emacs$B$K$b$=$NJLL>$K$D$$$F65$($F$*$/$3$H$,$G$-$^$9!#(B
$B$?$H$($P!"JQ?t(B@code{shell-pushd-regexp}$B$NCM$,%7%'%k$X$NF~NO9T$N@hF,$K(B
$B0lCW$9$k>l9g$O!"$=$N9T$O(B@code{pushd}$B%3%^%s%I$G$"$k$H$_$J$5$l$^$9!#(B
@samp{pushd}$B$KJLL>$rIU$1$?$i!"$3$NJQ?t$NCM$rJQ99$7$^$9!#(B
$BF1MM$K!"(B@code{shell-popd-regexp}$B$H(B@code{shell-cd-regexp}$B$O!"(B
@samp{popd}$B$H(B@samp{cd}$B$r<1JL$9$k$N$K;H$o$l$^$9!#(B
$B$3$l$i$N%3%^%s%I$O%7%'%k$X$NF~NO9T$N@hF,ItJ,$K$"$k$H$-$@$1(B
$B@5$7$/G'<1$5$l$^$9!#(B
@vindex shell-set-directory-error-hook
@c If Emacs gets an error while trying to handle what it believes is a
@c @samp{cd}, @samp{pushd} or @samp{popd} command, it runs the hook
@c @code{shell-set-directory-error-hook} (@pxref{Hooks}).
Emacs$B$O!"(B@samp{cd}$B!"(B@samp{pushd}$B!"(B@samp{popd}$B$N%7%'%k%3%^%s%I$@$H(B
$B;W$o$l$k$b$N$r=hM}Cf$K%(%i!<$KAx6x$9$k$H!"(B
$B%U%C%/(B@code{shell-set-directory-err-hook}$B$r<B9T$7$^$9(B
$B!J(B@pxref{Hooks}$B!K!#(B
@findex dirs
@c If Emacs does not properly track changes in the current directory of
@c the subshell, use the command @kbd{M-x dirs} to ask the shell what its
@c current directory is. This command works for shells that support the
@c most common command syntax; it may not work for unusual shells.
Emacs$B$,%5%V%7%'%k$N%+%l%s%H%G%#%l%/%H%j$r@5$7$/DI=>$G$-$F$$$J$$>l9g$O!"(B
$B%3%^%s%I(B@kbd{M-x dirs}$B$r;H$C$F%7%'%k$K%+%l%s%H%G%#%l%/%H%j$rLd$$9g$o(B
$B$;$F$/$@$5$$!#(B
$B$3$N%3%^%s%I$O0lHLE*$J%3%^%s%I$N9=J8$r;}$D%7%'%k$G$OF0:n$7$^$9!#(B
$B$G$9$,!"$H$F$bJQ$o$C$?%7%'%k$G$OF0$+$J$$$+$b$7$l$^$;$s!#(B
@findex dirtrack-mode
@c You can also use @kbd{M-x dirtrack-mode} to enable (or disable) an
@c alternative and more aggressive method of tracking changes in the
@c current directory.
@kbd{M-x dirtrack}$B$r;H$&$H!"(B
$BJL$N$b$C$H@Q6KE*$J$d$jJ}$G%+%l%s%H%G%#%l%/%H%j$NJQ99$K(B
$BDI=>$9$k!J$7$J$$!K$h$&$K$b$G$-$^$9!#(B
@c Emacs defines the environment variable @code{EMACS} in the subshell,
@c with value @code{t}. A shell script can check this variable to
@c determine whether it has been run from an Emacs subshell.
Emacs$B$O!"%5%V%7%'%k$N4D6-JQ?t(B@code{EMACS}$B$K(B@code{t}$B$r@_Dj$7$^$9!#(B
$B%7%'%k%9%/%j%W%H$G$3$NJQ?t$r8!::$9$l$P!"(B
Emacs$B$N%5%V%7%'%k$H$7$FF0$$$F$$$k$+$I$&$+H=Dj$G$-$^$9!#(B
@node Shell Mode
@c @subsection Shell Mode
@subsection $B%7%'%k%b!<%I!J(BShell$B%b!<%I!K(B
@c @cindex Shell mode
@c @cindex mode, Shell
@cindex $B%7%'%k%b!<%I!J(BShell mode$B!K(B
@cindex $B%b!<%I!"(Bshell
@c Shell buffers use Shell mode, which defines several special keys
@c attached to the @kbd{C-c} prefix. They are chosen to resemble the usual
@c editing and job control characters present in shells that are not under
@c Emacs, except that you must type @kbd{C-c} first. Here is a complete list
@c of the special key bindings of Shell mode:
$B%7%'%k%P%C%U%!$G$O%7%'%k!J(Bshell$B!K%b!<%I$,;H$o$l!"(B
$B%W%l%U%#%C%/%9%-!<(B@kbd{C-c}$B$r;}$DFCJL$J%-!<$r$$$/$D$+Dj5A$7$F$$$^$9!#(B
$B$3$l$i$O!"$^$:(B@kbd{C-c}$B$rBG$D$3$H$r=|$1$P!"(B
Emacs$B$N30$G%7%'%k$r;H$&$H$-$NDL>o$N%3%^%s%I9TJT=8$d(B
$B%8%g%V@)8f$N%-!<$K;w$;$FDj5A$7$F$"$j$^$9!#(B
$B0J2<$O!"%7%'%k!J(Bshell$B!K%b!<%I$G$NFCJL$J%P%$%s%G%#%s%0$N0lMw$G$9!#(B
@table @kbd
@item @key{RET}
@c @kindex RET @r{(Shell mode)}
@kindex RET @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-send-input
@c At end of buffer send line as input; otherwise, copy current line to end
@c of buffer and send it (@code{comint-send-input}). When a line is
@c copied, any text at the beginning of the line that matches the variable
@c @code{shell-prompt-pattern} is left out; this variable's value should be
@c a regexp string that matches the prompts that your shell uses.
$B%P%C%U%!$NKvHx$GBG$D$H!"(B1$B9TJ,$rF~NO$H$7$F%7%'%k$KAw$k!#(B
$B%P%C%U%!$NKvHx0J30$G$O!"8=:_9T$r%P%C%U%!$NKvHx$K%3%T!<$7$F$+$i!"(B
$B$=$l$rF~NO$H$7$F%7%'%k$KAw$k!J(B@code{comint-send-input}$B!K!#(B
$B9T$r%3%T!<$9$k$H$-!"9T$N@hF,ItJ,$NJ8;zNs$G(B
$BJQ?t(B@code{shell-prompt-pattern}$B$K0lCW$9$kItJ,$O%3%T!<$7$J$$!#(B
$B$3$NJQ?t$NCM$O!"%f!<%6!<$N%7%'%k$,%W%m%s%W%H$H$7$FMQ$$$k(B
$BJ8;zNs$K0lCW$9$k@55,I=8=$G$"$k$3$H!#(B
@item @key{TAB}
@c @kindex TAB @r{(Shell mode)}
@kindex TAB @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-dynamic-complete
@c Complete the command name or file name before point in the shell buffer
@c (@code{comint-dynamic-complete}). @key{TAB} also completes history
@c references (@pxref{History References}) and environment variable names.
$B%7%'%k%P%C%U%!$G%]%$%s%H$ND>A0$K$"$k%3%^%s%IL>$d%U%!%$%kL>$rJd40$9$k(B
$B!J(B@code{comint-dynamic-complete}$B!K!#(B
@key{TAB}$B$O!"MzNr;2>H!J(B@pxref{History References}$B!K$d(B
$B4D6-JQ?tL>$bJd40$G$-$k!#(B
@vindex shell-completion-fignore
@vindex comint-completion-fignore
@c The variable @code{shell-completion-fignore} specifies a list of file
@c name extensions to ignore in Shell mode completion. The default setting
@c ignores file names ending in @samp{~}, @samp{#} or @samp{%}. Other
@c related Comint modes use the variable @code{comint-completion-fignore}
@c instead.
$BJQ?t(B@code{shell-completion-fignore}$B$K$O!"(B
$B%7%'%k!J(Bshell$B!K%b!<%I$G$NJd40$K$*$$$F(B
$BL5;k$7$?$$%U%!%$%kL>$N3HD%;R$N%j%9%H$r;XDj$9$k!#(B
$B%G%U%)%k%H$N@_Dj$G$O!"L>A0$,!"(B@samp{~}$B!"(B@samp{#}$B!"(B@samp{%}$B$G(B
$B=*$k%U%!%$%k$rL5;k$9$k!#(B
$B4XO"$9$kB>$N(Bcomint$B%b!<%I$G$O$+$o$j$K(B
$BJQ?t(B@code{comint-completion-fignore}$B$r;H$&!#(B
@item M-?
@c @kindex M-? @r{(Shell mode)}
@kindex M-? @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-dynamic-list-filename@dots{}
@c Display temporarily a list of the possible completions of the file name
@c before point in the shell buffer
@c (@code{comint-dynamic-list-filename-completions}).
$B%7%'%k%P%C%U%!$N%]%$%s%H$ND>A0$K$"$k%U%!%$%kL>$N2DG=$JJd40FbMF$r(B
$B0l;~E*$KI=<($9$k!J(B@code{comint-dynamic-list-filename-completions}$B!K!#(B
@item C-d
@c @kindex C-d @r{(Shell mode)}
@kindex C-d @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-delchar-or-maybe-eof
@c Either delete a character or send @sc{eof}
@c (@code{comint-delchar-or-maybe-eof}). Typed at the end of the shell
@c buffer, @kbd{C-d} sends @sc{eof} to the subshell. Typed at any other
@c position in the buffer, @kbd{C-d} deletes a character as usual.
$BJ8;z$r:o=|$9$k$+!"$^$?$O!"(B
@sc{eof}$B$rAw$k!J(B@code{comint-delchar-or-maybe-eof}$B!K!#(B
$B%7%'%k%P%C%U%!$NKvHx$G(B@kbd{C-d}$B$rBG$D$H%5%V%7%'%k$K(B@sc{eof}$B$rAw$k!#(B
$B%P%C%U%!$N$=$l0J30$N0LCV$G$O!"(B@kbd{C-d}$B$rBG$D$HDL>o$I$*$j(B1$BJ8;z:o=|$9$k!#(B
@item C-c C-a
@c @kindex C-c C-a @r{(Shell mode)}
@kindex C-c C-a @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-bol
@c Move to the beginning of the line, but after the prompt if any
@c (@code{comint-bol}). If you repeat this command twice in a row, the
@c second time it moves back to the process mark, which is the beginning of
@c the input that you have not yet sent to the subshell. (Normally that is
@c the same place---the end of the prompt on this line---but after @kbd{C-c
@c @key{SPC}} the process mark may be in a previous line.)
$B9T$N@hF,$K9T$/!#(B
$B$?$@$7!"%W%m%s%W%H$,$"$k>l9g$K$O%W%m%s%W%H$ND>8e$K9T$/(B
$B!J(B@code{comint-bol}$B!K!#(B
$BF1$89T$G$3$N%3%^%s%I$r(B2$B2s7+$jJV$9$H!"(B2$B2sL\$G$O%W%m%;%9%^!<%/$XLa$k!#(B
$B%W%m%;%9%^!<%/$H$O!"%5%V%7%'%k$X$^$@Aw$C$F$$$J$$F~NO$N3+;O0LCV$N$3$H!#(B
$B!JDL>o!"$3$l$OF1$8>l=j$G$"$j!"(B
$B%W%m%;%9%^!<%/$O$=$N9T$N%W%m%s%W%H$N=*$o$j$K$"$k!#(B
$B$?$@$7!"(B@kbd{C-c @key{SPC}}$B$N$"$H$G$O!"(B
$B%W%m%;%9%^!<%/$O$^$($N9T$K$"$k$+$b$7$l$J$$!#!K(B
@item C-c @key{SPC}
@c Accumulate multiple lines of input, then send them together. This
@c command inserts a newline before point, but does not send the preceding
@c text as input to the subshell---at least, not yet. Both lines, the one
@c before this newline and the one after, will be sent together (along with
@c the newline that separates them), when you type @key{RET}.
$BJ#?t$NF~NO9T$rN/$a$F$*$-!"$^$H$a$FAw$k!#(B
$B$3$N%3%^%s%I$O!"%]%$%s%H$N$^$($K2~9T$rA^F~$9$k$,!"(B
$B>/$J$/$H$b$^$@!"$=$N9T$rF~NO$H$7$F%5%V%7%'%k$XAw$i$J$$!#(B
@key{RET}$B$rBG$D$H!"(B
$B2~9T$N$^$($N(B1$B9T$H$"$H$N(B1$B9T$r!J6h@Z$j$N2~9T$r4^$a$F!K$^$H$a$FAw$k!#(B
@item C-c C-u
@c @kindex C-c C-u @r{(Shell mode)}
@kindex C-c C-u @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-kill-input
@c Kill all text pending at end of buffer to be sent as input
@c (@code{comint-kill-input}).
$B%P%C%U%!$NKvHx$K$"$k!"$^$@%7%'%k$KAw$C$F$$$J$$%F%-%9%H$r$9$Y$F%-%k$9$k(B
$B!J(B@code{comint-kill-input}$B!K!#(B
@item C-c C-w
@c @kindex C-c C-w @r{(Shell mode)}
@kindex C-c C-w @r{$B!J%7%'%k%b!<%I!K(B}
@c Kill a word before point (@code{backward-kill-word}).
$B%]%$%s%H$ND>A0$N(B1$B8l$r%-%k$9$k!J(B@code{backward-kill-word}$B!K!#(B
@item C-c C-c
@c @kindex C-c C-c @r{(Shell mode)}
@kindex C-c C-c @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-interrupt-subjob
@c Interrupt the shell or its current subjob if any
@c (@code{comint-interrupt-subjob}). This command also kills
@c any shell input pending in the shell buffer and not yet sent.
$B%7%'%k!"$^$?$O!"$"$l$P%5%V%8%g%V$K3d$j9~$`(B
$B!J(B@code{comint-interrupt-subjob}$B!K!#(B
$B$^$?!"$3$N%3%^%s%I$O(B
$B%7%'%k%P%C%U%!Fb$N$^$@%7%'%k$KAw$C$F$$$J$$%F%-%9%H$b%-%k$9$k!#(B
@item C-c C-z
@c @kindex C-c C-z @r{(Shell mode)}
@kindex C-c C-z @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-stop-subjob
@c Stop the shell or its current subjob if any (@code{comint-stop-subjob}).
@c This command also kills any shell input pending in the shell buffer and
@c not yet sent.
$B%7%'%k!"$^$?$O!"$"$l$P%5%V%8%g%V$rCfCG$9$k(B
$B!J(B@code{comint-stop-subjob}$B!K!#(B
$B$^$?!"$3$N%3%^%s%I$O(B
$B%7%'%k%P%C%U%!Fb$N$^$@%7%'%k$KAw$C$F$$$J$$%F%-%9%H$b%-%k$9$k!#(B
@item C-c C-\
@findex comint-quit-subjob
@c @kindex C-c C-\ @r{(Shell mode)}
@kindex C-c C-\ @r{$B!J%7%'%k%b!<%I!K(B}
@c Send quit signal to the shell or its current subjob if any
@c (@code{comint-quit-subjob}). This command also kills any shell input
@c pending in the shell buffer and not yet sent.
$B%7%'%k!"$^$?$O!"$"$l$P%5%V%8%g%V$K%7%0%J%k(BQUIT$B$rAw$k(B
$B!J(B@code{comint-quit-subjob}$B!K!#(B
$B$^$?!"$3$N%3%^%s%I$O(B
$B%7%'%k%P%C%U%!Fb$N$^$@%7%'%k$KAw$C$F$$$J$$%F%-%9%H$b%-%k$9$k!#(B
@item C-c C-o
@c @kindex C-c C-o @r{(Shell mode)}
@kindex C-c C-o @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-kill-output
@c Kill the last batch of output from a shell command
@c (@code{comint-kill-output}). This is useful if a shell command spews
@c out lots of output that just gets in the way.
$BD>A0$N%7%'%k%3%^%s%I$+$i$N$R$H$^$H$^$j$N=PNO$r%-%k$9$k(B
$B!J(B@code{comint-kill-output}$B!K!#(B
$B%7%'%k%3%^%s%I$,BgNL$N=PNO$r=P$7$F$7$^$C$?$H$-$J$I$KM-8z!#(B
@item C-c C-r
@itemx C-M-l
@c @kindex C-c C-r @r{(Shell mode)}
@kindex C-c C-r @r{$B!J%7%'%k%b!<%I!K(B}
@c @kindex C-M-l @r{(Shell mode)}
@kindex C-M-l @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-show-output
@c Scroll to display the beginning of the last batch of output at the top
@c of the window; also move the cursor there (@code{comint-show-output}).
$BD>A0$N$R$H$^$H$^$j$N=PNO$,%&%#%s%I%&$N@hF,$K$/$k$h$&$K%9%/%m!<%k$9$k!#(B
$B$^$?!"%]%$%s%H$b$=$3$XF0$+$9!J(B@code{comint-show-output}$B!K!#(B
@item C-c C-e
@c @kindex C-c C-e @r{(Shell mode)}
@kindex C-c C-e @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-show-maximum-output
@c Scroll to put the end of the buffer at the bottom of the window
@c (@code{comint-show-maximum-output}).
$B%P%C%U%!$NKvHx$,%&%#%s%I%&$N2<C<$K$/$k$h$&$K%9%/%m!<%k$9$k(B
$B!J(B@code{comint-show-maximum-output}$B!K!#(B
@item C-c C-f
@c @kindex C-c C-f @r{(Shell mode)}
@kindex C-c C-f @r{$B!J%7%'%k%b!<%I!K(B}
@findex shell-forward-command
@vindex shell-command-regexp
@c Move forward across one shell command, but not beyond the current line
@c (@code{shell-forward-command}). The variable @code{shell-command-regexp}
@c specifies how to recognize the end of a command.
$B%7%'%k%3%^%s%I(B1$B$DJ,$@$1@h$X?J$a$k$,!"8=:_9T$NKvHx$h$j@h$X$O$$$+$J$$(B
$B!J(B@code{shell-forward-command}$B!K!#(B
$BJQ?t(B@code{shell-command-regexp}$B$K$O!"(B
$B%7%'%k%3%^%s%I$N=*$j$NC5$7J}!J@55,I=8=!K$r;XDj$9$k!#(B
@item C-c C-b
@c @kindex C-c C-b @r{(Shell mode)}
@kindex C-c C-b @r{$B!J%7%'%k%b!<%I!K(B}
@findex shell-backward-command
@c Move backward across one shell command, but not beyond the current line
@c (@code{shell-backward-command}).
$B%7%'%k%3%^%s%I(B1$B$DJ,$@$1<jA0$XLa$k$,!"8=:_9T$N@hF,$h$j$^$($X$O$$$+$J$$(B
$B!J(B@code{shell-backward-command}$B!K!#(B
@item C-c C-l
@c @kindex C-c C-l @r{(Shell mode)}
@kindex C-c C-l @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-dynamic-list-input-ring
@c Display the buffer's history of shell commands in another window
@c (@code{comint-dynamic-list-input-ring}).
$B%P%C%U%!$N%7%'%k%3%^%s%IMzNr$rJL$N%&%#%s%I%&$KI=<($9$k(B
$B!J(B@code{comint-dynamic-list-input-ring}$B!K!#(B
@item M-x dirs
@c Ask the shell what its current directory is, so that Emacs can agree
@c with the shell.
$B%7%'%k$K%+%l%s%H%G%#%l%/%H%j$rLd$$9g$o$;!"(B
Emacs$BB&$N$b$N$r%7%'%k$K9g$o$;$k!#(B
@item M-x send-invisible @key{RET} @var{text} @key{RET}
@findex send-invisible
@c Send @var{text} as input to the shell, after reading it without
@c echoing. This is useful when a shell command runs a program that asks
@c for a password.
@var{text}$B$r%(%3!<%P%C%/$;$:$KFI$_<h$j!"(B
$BF~NO$H$7$F%7%'%k$XAw$k!#(B
$B%Q%9%o!<%I$rLd$$9g$o$;$k$h$&$J%W%m%0%i%`$r5/F0$9$k(B
$B%7%'%k%3%^%s%I$GLrN)$D!#(B
@c Alternatively, you can arrange for Emacs to notice password prompts
@c and turn off echoing for them, as follows:
$B$+$o$j$K!"$D$.$N$h$&$K$7$F!"(B
Emacs$B$K%Q%9%o!<%I%W%m%s%W%H$rG'<1$5$;$F%(%3!<%P%C%/$rM^@)$9$kJ}K!$b$"$k!#(B
@example
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt)
@end example
@item M-x comint-continue-subjob
@findex comint-continue-subjob
@c Continue the shell process. This is useful if you accidentally suspend
@c the shell process.@footnote{You should not suspend the shell process.
@c Suspending a subjob of the shell is a completely different matter---that
@c is normal practice, but you must use the shell to continue the subjob;
@c this command won't do it.}
$B%7%'%k%W%m%;%9$r7QB3$5$;$k!#(B
$B$3$l$O$^$A$,$C$F%7%'%k%W%m%;%9$r5Y;_$5$;$F$7$^$C$?>l9g$KLrN)$D!#(B
@footnote{$B%7%'%k%W%m%;%9$r5Y;_$9$Y$-$G$O$J$$!#(B
$B%7%'%k$N%5%V%8%g%V$r5Y;_$9$k$N$H$O$^$C$?$/JL$N$3$H$G$"$j!"(B
$B$3$A$i$OIaDL$K9T$C$F$h$$!#(B
$B$?$@$7!"5Y;_$7$?%5%V%8%g%V$O%7%'%k$G:F3+$5$;$kI,MW$,$"$k!#(B
$B$3$N%3%^%s%I$G$O:F3+$G$-$J$$!#(B}
@item M-x comint-strip-ctrl-m
@findex comint-strip-ctrl-m
@c Discard all control-M characters from the current group of shell output.
@c The most convenient way to use this command is to make it run
@c automatically when you get output from the subshell. To do that,
@c evaluate this Lisp expression:
$B8=:_$N0l72$N%7%'%k$N=PNO$+$iI|5"!J%3%s%H%m!<%k(BM$B!KJ8;z$r:o=|$9$k!#(B
$B$3$N%3%^%s%I$N$b$C$H$bJXMx$J;H$$J}$N(B1$B$D$O!"(B
$B%5%V%7%'%k$N=PNO$r<u$1<h$k$H<+F0E*$K$3$N%3%^%s%I$,<B9T$5$l$k$h$&$K(B
$B@_Dj$7$F$*$/$3$H$G$"$k!#(B
$B$=$N$?$a$K$O!"$D$.$N(BLisp$B<0$rI>2A$9$l$P$h$$!#(B
@example
(add-hook 'comint-output-filter-functions
'comint-strip-ctrl-m)
@end example
@item M-x comint-truncate-buffer
@findex comint-truncate-buffer
@c This command truncates the shell buffer to a certain maximum number of
@c lines, specified by the variable @code{comint-buffer-maximum-size}.
@c Here's how to do this automatically each time you get output from the
@c subshell:
$B$3$N%3%^%s%I$O!"JQ?t(B@code{comint-buffer-maximum-size}$B$G;XDj$7$?Bg$-$5$K(B
$B%7%'%k%P%C%U%!$N9T?t$r@Z$j5M$a$k!#(B
$B%5%V%7%'%k$+$i=PNO$r<u$1<h$k$?$S$K(B
$B$3$l$r<+F0E*$K9T$&$K$O$D$.$N$h$&$K$9$k!#(B
@example
(add-hook 'comint-output-filter-functions
'comint-truncate-buffer)
@end example
@end table
@c Shell mode also customizes the paragraph commands so that only shell
@c prompts start new paragraphs. Thus, a paragraph consists of an input
@c command plus the output that follows it in the buffer.
$B%7%'%k!J(Bshell$B!K%b!<%I$G$OCJMn%3%^%s%I$K$b=$@5$r2C$($F$"$j!"(B
$B%7%'%k%W%m%s%W%H$G$N$_?7$7$$CJMn$,;O$^$k$h$&$K$J$C$F$$$^$9!#(B
$B$D$^$j!"%7%'%k%P%C%U%!$G$O!"(B
1$B$D$NCJMn$O%7%'%k%3%^%s%I$H$=$N=PNO$+$i@.$k$N$G$9!#(B
@c @cindex Comint mode
@c @cindex mode, Comint
@cindex Comint$B%b!<%I!J(BComint mode$B!K(B
@cindex $B%b!<%I!"(Bcomint
@c Shell mode is a derivative of Comint mode, a general-purpose mode for
@c communicating with interactive subprocesses. Most of the features of
@c Shell mode actually come from Comint mode, as you can see from the
@c command names listed above. The special features of Shell mode in
@c particular include the choice of regular expression for detecting
@c prompts, the directory tracking feature, and a few user commands.
$B%7%'%k!J(Bshell$B!K%b!<%I$O!"BPOCE*$J%5%V%W%m%;%9$HDL?.$9$k$?$a$NHFMQ%b!<%I$G$"$k(B
comint$B%b!<%I$+$i$NGI@8$G$9!#(B
$B$3$3$^$G$K$"$2$F$-$?%3%^%s%I$NL>A0$+$i$b$o$+$k$h$&$K!"(B
$B%7%'%k!J(Bshell$B!K%b!<%I$N?tB?$/$N5!G=$O!"<B$O!"(Bcomint$B%b!<%I$+$i$-$F$$$^$9!#(B
$B%7%'%k!J(Bshell$B!K%b!<%I$K8GM-$JFCJL$J5!G=$O!"@55,I=8=$K4p$E$/%W%m%s%W%H$NG'<1!"(B
$B%+%l%s%H%G%#%l%/%H%j$NDI@W!"$*$h$S!">/?t$N%f!<%6!<%3%^%s%I$K8B$i$l$^$9!#(B
@c Other Emacs features that use variants of Comint mode include GUD
@c (@pxref{Debuggers}) and @kbd{M-x run-lisp} (@pxref{External Lisp}).
comint$B%b!<%I$+$iGI@8$7$?(BEmacs$B$N$[$+$N5!G=$H$7$F$O!"(B
GUD$B!J(B@pxref{Debuggers}$B!K$H(B
@kbd{M-x run-lisp}$B!J(B@pxref{External Lisp}$B!K$,$"$j$^$9!#(B
@findex comint-run
@c You can use @kbd{M-x comint-run} to execute any program of your choice
@c in a subprocess using unmodified Comint mode---without the
@c specializations of Shell mode.
@kbd{M-x comint-run}$B$r;H$&$H!"(B
$B%7%'%k!J(Bshell$B!K%b!<%I8GM-$N5!G=$r;}$?$J$$(Bcomint$B%b!<%I$G!"(B
$BG$0U$N%W%m%0%i%`$r%5%V%W%m%;%9$H$7$F<B9T$G$-$^$9!#(B
@node Shell History
@c @subsection Shell Command History
@subsection $B%7%'%k%3%^%s%IMzNr(B
@c Shell buffers support three ways of repeating earlier commands. You
@c can use the same keys used in the minibuffer; these work much as they do
@c in the minibuffer, inserting text from prior commands while point
@c remains always at the end of the buffer. You can move through the
@c buffer to previous inputs in their original place, then resubmit them or
@c copy them to the end. Or you can use a @samp{!}-style history
@c reference.
$B%7%'%k%P%C%U%!$G$O!"0JA0$K;H$C$?%7%'%k%3%^%s%I$r:F<B9T$9$kJ}K!$,(B3$B$D$"$j$^$9!#(B
1$B$D$a$O!"%_%K%P%C%U%!$HF1$8%-!<$r;H$&J}K!$G$9!#(B
$B$9$J$o$A!"%_%K%P%C%U%!$N>l9g$HF1MM$K!"(B
$B%]%$%s%H$O$D$M$K%P%C%U%!$NKvHx$K$"$k>uBV$G!"(B
$B0JA0$K;H$C$?%7%'%k%3%^%s%I$r%P%C%U%!$KA^F~$G$-$^$9!#(B
2$B$D$a$O!"%P%C%U%!Fb$G0JA0$N%7%'%k%3%^%s%I$N2U=j$K0\F0$7$F!"(B
$B$=$l$r$=$N$^$^:F<B9T$9$k$+%P%C%U%!$NKvHx$K%3%T!<$7$^$9!#(B
3$B$D$a$O!"(B@samp{!}$B7A<0$NMzNr;2>H$r;H$&$3$H$G$9!#(B
@menu
* Ring: Shell Ring. Fetching commands from the history list.
* Copy: Shell History Copying. Moving to a command and then copying it.
* History References:: Expanding @samp{!}-style history references.
@end menu
@node Shell Ring
@c @subsubsection Shell History Ring
@subsubsection $B%7%'%kMzNr%j%s%0(B
@table @kbd
@findex comint-previous-input
@c @kindex M-p @r{(Shell mode)}
@kindex M-p @r{$B!J%7%'%k%b!<%I!K(B}
@item M-p
@c Fetch the next earlier old shell command.
$B:#$N$b$N$h$j(B1$B$D$^$($N8E$$%7%'%k%3%^%s%I$r;}$C$F$/$k!#(B
@c @kindex M-n @r{(Shell mode)}
@kindex M-n @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-next-input
@item M-n
@c Fetch the next later old shell command.
$B:#$N$b$N$h$j(B1$B$D$"$H$N8E$$%7%'%k%3%^%s%I$r;}$C$F$/$k!#(B
@c @kindex M-r @r{(Shell mode)}
@kindex M-r @r{$B!J%7%'%k%b!<%I!K(B}
@c @kindex M-s @r{(Shell mode)}
@kindex M-s @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-previous-matching-input
@findex comint-next-matching-input
@item M-r @var{regexp} @key{RET}
@itemx M-s @var{regexp} @key{RET}
@c Search backwards or forwards for old shell commands that match @var{regexp}.
@var{regexp}$B$K0lCW$9$k8E$$%7%'%k%3%^%s%I$r8e8~$-$^$?$OA08~$-$KC5:w$9$k!#(B
@item C-c C-x @r{(Shell mode)}
@findex comint-get-next-from-history
@c Fetch the next subsequent command from the history.
$BMzNr$+$i$D$.$N%3%^%s%I$r;}$C$F$/$k!#(B
@end table
@c Shell buffers provide a history of previously entered shell commands. To
@c reuse shell commands from the history, use the editing commands @kbd{M-p},
@c @kbd{M-n}, @kbd{M-r} and @kbd{M-s}. These work just like the minibuffer
@c history commands except that they operate on the text at the end of the
@c shell buffer, where you would normally insert text to send to the shell.
$B%7%'%k%P%C%U%!$K$O!"$=$l$^$G$KF~NO$7$?%7%'%k%3%^%s%I$NMzNr$,$"$j$^$9!#(B
$B$3$NMzNr$+$i%7%'%k%3%^%s%I$r:FMxMQ$9$k$K$O!"JT=8%3%^%s%I!"(B
@kbd{M-p}$B!"(B@kbd{M-n}$B!"(B@kbd{M-r}$B!"(B@kbd{M-s}$B$r;H$$$^$9!#(B
$B$3$l$i$O%_%K%P%C%U%!$NMzNr%3%^%s%I$HF1MM$KF/$-$^$9$,!"(B
$B!JIaDL$O%7%'%k$KAw$k%F%-%9%H$rA^F~$9$k!K(B
$B%7%'%k%P%C%U%!$NKvHx$K$"$k%F%-%9%H$K:nMQ$9$kE@$,0[$J$j$^$9!#(B
@c @kbd{M-p} fetches an earlier shell command to the end of the shell buffer.
@c Successive use of @kbd{M-p} fetches successively earlier shell commands,
@c each replacing any text that was already present as potential shell input.
@c @kbd{M-n} does likewise except that it finds successively more recent shell
@c commands from the buffer.
@kbd{M-p}$B$O!"(B1$B$D$^$($N%7%'%k%3%^%s%I$r%7%'%k%P%C%U%!$NKvHx$K;}$C$F$-$^$9!#(B
@kbd{M-p}$B$rO"B3$7$F;H$&$H!"<!!9$K$=$l$h$j$^$($K<B9T$7$?%7%'%k%3%^%s%I$r(B
$B;}$C$F$-$F!"$=$l$^$G$N%7%'%k$X$NF~NOMQ%F%-%9%H$rCV$-49$($^$9!#(B
@kbd{M-n}$B$bF1MM$G$9$,!"(B
$B<!!9$K$=$l$h$j$"$H$N%7%'%k%3%^%s%I$r;}$C$F$/$kE@$,0[$J$j$^$9!#(B
@c The history search commands @kbd{M-r} and @kbd{M-s} read a regular
@c expression and search through the history for a matching command. Aside
@c from the choice of which command to fetch, they work just like @kbd{M-p}
@c and @kbd{M-r}. If you enter an empty regexp, these commands reuse the
@c = @kbd{M-n}$B$N%?%$%]!)(B
@c same regexp used last time.
$BMzNrC5:w%3%^%s%I(B@kbd{M-r}$B$H(B@kbd{M-s}$B$O!"(B
$B@55,I=8=$rFI$_<h$j!"$=$l$K0lCW$9$k%7%'%k%3%^%s%I$rMzNr$NCf$+$iC5$7$^$9!#(B
$B$I$N%7%'%k%3%^%s%I$r;}$C$F$/$k$+$H$$$&E@$r=|$1$P!"(B
$B$=$l$i$NF/$-$O(B@kbd{M-p}$B$d(B@kbd{M-n}$B$HF1$8$G$9!#(B
$B@55,I=8=$H$7$F6uJ8;zNs$rF~NO$9$k$H!"D>A0$K;HMQ$7$?@55,I=8=$r:F;HMQ$7$^$9!#(B
@c When you find the previous input you want, you can resubmit it by
@c typing @key{RET}, or you can edit it first and then resubmit it if you
@c wish.
$B:F;HMQ$7$?$$%7%'%k%3%^%s%I$rC5$7$?$J$i$P!"(B
@key{RET}$B$rBG$C$F$=$N%7%'%k%3%^%s%I$r:F<B9T$9$k$+!"(B
$BI,MW$J$iJT=8$7$F$+$i<B9T$7$^$9!#(B
@c Often it is useful to reexecute several successive shell commands that
@c were previously executed in sequence. To do this, first find and
@c reexecute the first command of the sequence. Then type @kbd{C-c C-x};
@c that will fetch the following command---the one that follows the command
@c you just repeated. Then type @key{RET} to reexecute this command. You
@c can reexecute several successive commands by typing @kbd{C-c C-x
@c @key{RET}} over and over.
$B0JA0$KO"B3$7$F<B9T$7$?0lO"$N%7%'%k%3%^%s%I$r$^$H$a$F:F<B9T$G$-$k$HJXMx$J(B
$B$3$H$,$"$j$^$9!#(B
$B$=$l$K$O!"$^$:!"0lO"$N%7%'%k%3%^%s%I$N:G=i$N$b$N$rC5$7$F:F<B9T$7$^$9!#(B
$B$=$&$7$F$+$i(B@kbd{C-c C-x}$B$HBG$A$^$9!#(B
$B$3$l$O!"D>A0$K:F<B9T$7$?%7%'%k%3%^%s%I$N!JMzNrFb$G!K(B
$B$D$.$K$"$k%7%'%k%3%^%s%I$r;}$C$F$-$^$9!#(B
@key{RET}$B$HBG$C$F:F<B9T$7$^$9!#(B
$B$3$N$h$&$K!"(B@kbd{C-c C-x @key{RET}}$B$r7+$jJV$7BG$F$P0lO"$N%7%'%k%3%^%s%I$r(B
$B:F<B9T$G$-$^$9!#(B
@c These commands get the text of previous shell commands from a special
@c history list, not from the shell buffer itself. Thus, editing the shell
@c buffer, or even killing large parts of it, does not affect the history
@c that these commands access.
$B$3$l$i$N%3%^%s%I$O2a5n$K<B9T$7$?%7%'%k%3%^%s%I$r@lMQ$NMzNr%j%9%H$+$i(B
$B;}$C$F$/$k$N$G$"$C$F!"%7%'%k%P%C%U%!$+$i$H$C$F$/$k$N$G$O$"$j$^$;$s!#(B
$B$7$?$,$C$F!"%7%'%k%P%C%U%!$rJT=8$7$?$j!"$=$NBgItJ,$r%-%k$7$?$H$7$F$b!"(B
$B$3$l$i$N%3%^%s%I$,;2>H$9$kMzNr$K$O1F6A$7$^$;$s!#(B
@vindex shell-input-ring-file-name
@c Some shells store their command histories in files so that you can
@c refer to previous commands from previous shell sessions. Emacs reads
@c the command history file for your chosen shell, to initialize its own
@c command history. The file name is @file{~/.bash_history} for bash,
@c @file{~/.sh_history} for ksh, and @file{~/.history} for other shells.
$B$$$/$D$+$N%7%'%k$O!"%3%^%s%IMzNr$r%U%!%$%k$KJ]4I$7$F(B
$B0JA0$N%;%C%7%g%s$NMzNr$r0z$-7Q$2$k$h$&$K$J$C$F$$$^$9!#(B
Emacs$B$O!"<+J,$NMzNr%j%9%H$r=i4|@_Dj$9$k$?$a$K!"(B
$B%f!<%6!<$,;H$&%7%'%k$NMzNr%U%!%$%k$rFI$_9~$_$^$9!#(B
$B%U%!%$%kL>$O!"(Bbash$B$G$"$l$P(B@file{~/.bash_history}$B!"(B
ksh$B$G$"$l$P(B@file{~/.sh_history}$B!"(B
$B$=$NB>$N%7%'%k$G$"$l$P(B@file{~/.history}$B$G$9!#(B
@node Shell History Copying
@c @subsubsection Shell History Copying
@subsubsection $B%7%'%kMzNr$N%3%T!<(B
@table @kbd
@c @kindex C-c C-p @r{(Shell mode)}
@kindex C-c C-p @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-previous-prompt
@item C-c C-p
@c Move point to the previous prompt (@code{comint-previous-prompt}).
$B%]%$%s%H$r(B1$B$D$^$($N%W%m%s%W%H$X0\F0$9$k!J(B@code{comint-previous-prompt}$B!K!#(B
@c @kindex C-c C-n @r{(Shell mode)}
@kindex C-c C-n @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-next-prompt
@item C-c C-n
@c Move point to the following prompt (@code{comint-next-prompt}).
$B%]%$%s%H$r(B1$B$D$"$H$N%W%m%s%W%H$X0\F0$9$k!J(B@code{comint-next-prompt}$B!K!#(B
@c @kindex C-c RET @r{(Shell mode)}
@kindex C-c RET @r{$B!J%7%'%k%b!<%I!K(B}
@findex comint-copy-old-input
@item C-c @key{RET}
@c Copy the input command which point is in, inserting the copy at the end
@c of the buffer (@code{comint-copy-old-input}). This is useful if you
@c move point back to a previous command. After you copy the command, you
@c can submit the copy as input with @key{RET}. If you wish, you can
@c edit the copy before resubmitting it.
$B%]%$%s%H$,$"$k$H$3$m$NF~NO%3%^%s%I$r%P%C%U%!$NKvHx$K%3%T!<$9$k(B
$B!J(B@code{comint-copy-old-input}$B!K!#(B
$B$3$N%3%^%s%I$O%]%$%s%H$r8E$$%7%'%k%3%^%s%I$X0\F0$7$?$H$-$KLrN)$D!#(B
$B%7%'%k%3%^%s%I$r%3%T!<$7$?$i!"(B@key{RET}$B$G$=$l$r!J%7%'%k$X!KAw$k!#(B
$BI,MW$J$i%7%'%k%3%^%s%I$r=$@5$7$F$+$iAw$C$F$b$h$$!#(B
@end table
@c Moving to a previous input and then copying it with @kbd{C-c
@c @key{RET}} produces the same results---the same buffer contents---that
@c you would get by using @kbd{M-p} enough times to fetch that previous
@c input from the history list. However, @kbd{C-c @key{RET}} copies the
@c text from the buffer, which can be different from what is in the history
@c list if you edit the input text in the buffer after it has been sent.
$B%]%$%s%H$r$^$($NF~NO2U=j$K0\F0$7$F$+$i(B@kbd{C-c @key{RET}}$B$G%3%T!<$7$F$b!"(B
@kbd{M-p}$B$rI,MW$J2s?t;H$C$FMzNr%j%9%H$+$i$^$($N%3%^%s%I$r;}$C$F$-$?$N$H(B
$B!J%P%C%U%!$NFbMF$,F1$8$H$$$&0UL#$G!KF1$87k2L$K$J$j$^$9!#(B
$B$?$@$7!"(B@kbd{C-c @key{RET}}$B$O%P%C%U%!$+$i%F%-%9%H$r%3%T!<$9$k$N$G!"(B
$B%7%'%k$XAw$C$?$"$H$G$=$l$r%P%C%U%!>e$GJT=8$7$?>l9g$K$O!"(B
$BMzNr%j%9%H$K$"$k$b$N$H$O0[$J$k$3$H$b$"$j$^$9!#(B
@node History References
@c @subsubsection Shell History References
@subsubsection $B%7%'%kMzNr$N;2>H(B
@c @cindex history reference
@cindex $BMzNr;2>H(B
@c Various shells including csh and bash support @dfn{history references}
@c that begin with @samp{!} and @samp{^}. Shell mode can understand these
@c constructs and perform the history substitution for you. If you insert
@c a history reference and type @key{TAB}, this searches the input history
@c for a matching command, performs substitution if necessary, and places
@c the result in the buffer in place of the history reference. For
@c example, you can fetch the most recent command beginning with @samp{mv}
@c with @kbd{! m v @key{TAB}}. You can edit the command if you wish, and
@c then resubmit the command to the shell by typing @key{RET}.
csh$B$d(Bbash$B$r$O$8$aB?$/$N%7%'%k$O!"(B
@samp{!}$B$d(B@samp{^}$B$G;O$^$k(B@dfn{$BMzNr;2>H(B}$B$N5!G=$rDs6!$7$F$$$^$9!#(B
$B%7%'%k!J(Bshell$B!K%b!<%I$G$b$3$l$i$N;XDj$rM}2r$7!"MzNrCV49$r9T$($^$9!#(B
$BMzNr;2>H$rF~NO$7$F(B@key{TAB}$B$rBG$D$H!"(B
$BMzNr%j%9%H$+$i0lCW$9$k%7%'%k%3%^%s%I$rC5$7!"(B
$BI,MW$J$iCV49$r9T$$!"MzNr;2>H$r$=$N7k2L$GCV$-49$($^$9!#(B
$B$?$H$($P!"(B@samp{mv}$B$G;O$^$k$$$A$P$s:G6a$N%7%'%k%3%^%s%I$r;}$C$F$/$k$K$O(B
@kbd{! m v @key{TAB}}$B$HBG$A$^$9!#(B
$BI,MW$J$i%7%'%k%3%^%s%I$rJT=8$7!"(B@key{RET}$B$HBG$C$F%7%'%k$XAw$j$^$9!#(B
@vindex shell-prompt-pattern
@vindex comint-prompt-regexp
@c History references take effect only following a shell prompt. The
@c variable @code{shell-prompt-pattern} specifies how to recognize a shell
@c prompt. Comint modes in general use the variable
@c @code{comint-prompt-regexp} to specify how to find a prompt; Shell mode
@c uses @code{shell-prompt-pattern} to set up the local value of
@c @code{comint-prompt-regexp}.
$BMzNr;2>H$O!"%7%'%k%W%m%s%W%H$N$"$H$G$N$_8z2L$r;}$A$^$9!#(B
$BJQ?t(B@code{shell-prompt-pattern}$B$G%7%'%k%W%m%s%W%H$HG'<1$9$k$b$N$r;XDj$7$^$9!#(B
comint$B%b!<%I0lHL$K$O!"JQ?t(B@code{comint-promt-regexp}$B$G(B
$B%W%m%s%W%H$NC5$7J}$r;XDj$7$^$9!#(B
$B%7%'%k!J(Bshell$B!K%b!<%I$G$O!"(B@code{shell-prompt-pattern}$B$r;H$C$F(B
@code{comint-prompt-regexp}$B$N%m!<%+%k$JCM$r@_Dj$7$^$9!#(B
@vindex comint-input-autoexpand
@c Shell mode can optionally expand history references in the buffer when
@c you send them to the shell. To request this, set the variable
@c @code{comint-input-autoexpand} to @code{input}.
$B%7%'%k!J(Bshell$B!K%b!<%I$G$O!"%7%'%k$KAw$k:]$K%P%C%U%!Fb$GMzNr;2>H$r(B
$BE83+$9$k$h$&$K$b;XDj$G$-$^$9!#(B
$B$=$l$K$O!"JQ?t(B@code{compint-input-autoexpand}$B$K(B@code{input}$B$r@_Dj$7$^$9!#(B
@findex comint-magic-space
@c You can make @key{SPC} perform history expansion by binding @key{SPC} to
@c the command @code{comint-magic-space}.
@key{SPC}$B$r%3%^%s%I(B@code{comint-magic-space}$B$K%P%$%s%I$9$l$P!"(B
@key{SPC}$B$GMzNrE83+$,9T$($k$h$&$K$J$j$^$9!#(B
@node Shell Options
@c @subsection Shell Mode Options
@subsection $B%7%'%k%b!<%I$N%*%W%7%g%s(B
@vindex comint-scroll-to-bottom-on-input
@c If the variable @code{comint-scroll-to-bottom-on-input} is
@c non-@code{nil}, insertion and yank commands scroll the selected window
@c to the bottom before inserting.
$BJQ?t(B@code{comint-scroll-to-bottom-on-input}$B$,(B@code{nil}$B0J30$N>l9g$K$O!"(B
$BA^F~$*$h$S%d%s%/%3%^%s%I$O!"(B
$BA*Br$5$l$F$$$k%&%#%s%I%&$rKvHx$^$G%9%/%m!<%k$7$F$+$iA^F~$7$^$9!#(B
@vindex comint-scroll-show-maximum-output
@c If @code{comint-scroll-show-maximum-output} is non-@code{nil}, then
@c scrolling due to arrival of output tries to place the last line of text
@c at the bottom line of the window, so as to show as much useful text as
@c possible. (This mimics the scrolling behavior of many terminals.)
@c The default is @code{nil}.
@code{comint-scroll-show-maximum-output}$B$,(B@code{nil}$B0J30$N>l9g!"(B
$B=PNO$KH<$&%9%/%m!<%k$G$O!"(B
$B:G8e$N9T$,$G$-$k$@$1%&%#%s%I%&$N$$$A$P$s2<$K$/$k$h$&$K$7!"(B
$B$J$k$Y$/B?$/$NM-MQ$J%F%-%9%H$,8+$($k$h$&$K$7$^$9(B
$B!J$3$l$OB?$/$NC<Kv$N%9%/%m!<%kF0:n$N??;w!K!#(B
$B%G%U%)%k%H$O(B@code{nil}$B$G$9!#(B
@vindex comint-scroll-to-bottom-on-output
@c By setting @code{comint-scroll-to-bottom-on-output}, you can opt for
@c having point jump to the end of the buffer whenever output arrives---no
@c matter where in the buffer point was before. If the value is
@c @code{this}, point jumps in the selected window. If the value is
@c @code{all}, point jumps in each window that shows the comint buffer. If
@c the value is @code{other}, point jumps in all nonselected windows that
@c show the current buffer. The default value is @code{nil}, which means
@c point does not jump to the end.
@code{comint-scroll-to-bottom-on-output}$B$r@_Dj$9$k$H!"(B
$B%]%$%s%H$,$I$3$K$"$m$&$H!"(B
$B=PNO$,E~Ce$9$k$?$S$K%P%C%U%!$NKvHx$X%]%$%s%H$,%8%c%s%W$9$k$h$&$K@_Dj$G$-$^$9!#(B
$B$3$NJQ?t$NCM$,(B@code{this}$B$G$"$l$P!"(B
$B%]%$%s%H$OA*Br$5$l$?%&%#%s%I%&$G%8%c%s%W$7$^$9!#(B
$BCM$,(B@code{all}$B$G$"$l$P!"(Bcomint$B%P%C%U%!$rI=<($7$F$$$k3F%&%#%s%I%&$G(B
$B%]%$%s%H$O%8%c%s%W$7$^$9!#(B
$BCM$,(B@code{other}$B$G$"$l$P!"%+%l%s%H%P%C%U%!$rI=<($7$F$$$k$9$Y$F$N(B
$BA*Br$5$l$F$$$J$$%&%#%s%I%&$G%]%$%s%H$O%8%c%s%W$7$^$9!#(B
$B%G%U%)%k%H$O(B@code{nil}$B$G$9$+$i!"%]%$%s%H$O%8%c%s%W$7$^$;$s!#(B
@vindex comint-input-ignoredups
@c The variable @code{comint-input-ignoredups} controls whether successive
@c identical inputs are stored in the input history. A non-@code{nil}
@c value means to omit an input that is the same as the previous input.
@c The default is @code{nil}, which means to store each input even if it is
@c equal to the previous input.
$BJQ?t(B@code{comint-input-ignoredups}$B$O!"(B
$BO"B3$9$kF10l$NF~NO$rMzNr$K3JG<$9$k$+$I$&$+$r@)8f$7$^$9!#(B
$BCM$,(B@code{nil}$B0J30$N$H$-$O!"D>A0$NF~NO$HF1$8F~NO$OMzNr$K3JG<$7$^$;$s!#(B
$B%G%U%)%k%H$O(B@code{nil}$B$G$9$+$i!"D>A0$HF1$8F~NO$G$b$9$Y$FMzNr$K3JG<$7$^$9!#(B
@vindex comint-completion-addsuffix
@vindex comint-completion-recexact
@vindex comint-completion-autolist
@c Three variables customize file name completion. The variable
@c @code{comint-completion-addsuffix} controls whether completion inserts a
@c space or a slash to indicate a fully completed file or directory name
@c (non-@code{nil} means do insert a space or slash).
@c @code{comint-completion-recexact}, if non-@code{nil}, directs @key{TAB}
@c to choose the shortest possible completion if the usual Emacs completion
@c algorithm cannot add even a single character.
@c @code{comint-completion-autolist}, if non-@code{nil}, says to list all
@c the possible completions whenever completion is not exact.
3$B$D$NJQ?t$G%U%!%$%kL>$NJd40$r%+%9%?%^%$%:$7$^$9!#(B
$BJQ?t(B@code{comint-completion-addsuffix}$B$O!"(B
$B%U%!%$%kL>$d%G%#%l%/%H%jL>$rJd40$9$k$H$-!"(B
$BL>A0$r40A4$KJd40$G$-$?$3$H$r<($9$?$a$K(B
$BKvHx$K6uGr$d%9%i%C%7%e$rA^F~$9$k$+$I$&$+$r;XDj$7$^$9(B
$B!J(B@code{nil}$B0J30$N$H$-!"6uGr$d%9%i%C%7%e$rA^F~!K!#(B
@code{comint-completion-recexact}$B$O!"(B
$B$=$NCM$,(B@code{nil}$B0J30$N>l9g!"(BEmacs$B$NDL>o$NJd40%"%k%4%j%:%`$G(B1$BJ8;z$b(B
$BDI2C$G$-$J$$$H$-$K$O(B@key{TAB}$B$G2DG=$J$b$C$H$bC;$$Jd40J8;zNs$r(B
$BA^F~$9$k$h$&$K$7$^$9!#(B
@code{comint-completion-autolist}$B$O!"$=$NCM$,(B@code{nil}$B0J30$N>l9g!"(B
$BJd40$,40A4$G$J$$$H$-$K2DG=$JJd408uJd$N0lMw$rI=<($9$k$3$H$r;XDj$7$^$9!#(B
@findex comint-dynamic-complete-variable
@c The command @code{comint-dynamic-complete-variable} does variable-name
@c completion using the environment variables as set within Emacs. The
@c variables controlling file name completion apply to variable-name
@c completion too. This command is normally available through the menu
@c bar.
$B%3%^%s%I(B@code{comint-dynamic-complete-variable}$B$O!"(B
Emacs$BCf$G@_Dj$5$l$F$$$k4D6-JQ?t$rMQ$$$FJQ?tL>$NJd40$r9T$$$^$9!#(B
$B%U%!%$%kL>$NJd40$r@)8f$9$k>e=R$NJQ?t72$bJQ?tL>$NJd40$r@)8f$7$^$9!#(B
$B$3$N%3%^%s%I$O!"DL>o!"%a%K%e!<%P!<$+$i;H$($^$9!#(B
@vindex shell-command-execonly
@c Command completion normally considers only executable files.
@c If you set @code{shell-command-execonly} to @code{nil},
@c it considers nonexecutable files as well.
$B%3%^%s%IJd40$O!"DL>o!"<B9T2DG=$J%U%!%$%k$@$1$rBP>]$H$7$^$9!#(B
@code{shell-command-execonly}$B$r(B@code{nil}$B$K$9$k$H!"(B
$B<B9T2DG=$G$J$$%U%!%$%k$bBP>]$H$J$j$^$9!#(B
@c = $B86J8$N%?%$%]!)(B
@c @findex shell-pushd-tohome
@c @findex shell-pushd-dextract
@c @findex shell-pushd-dunique
@vindex shell-pushd-tohome
@vindex shell-pushd-dextract
@vindex shell-pushd-dunique
@c You can configure the behavior of @samp{pushd}. Variables control
@c whether @samp{pushd} behaves like @samp{cd} if no argument is given
@c (@code{shell-pushd-tohome}), pop rather than rotate with a numeric
@c argument (@code{shell-pushd-dextract}), and only add directories to the
@c directory stack if they are not already on it
@c (@code{shell-pushd-dunique}). The values you choose should match the
@c underlying shell, of course.
@samp{pushd}$B$NF0:n$r%+%9%?%^%$%:$G$-$^$9!#(B
$B0z?t$,M?$($i$l$J$$$H(B@samp{cd}$B$HF1MM$K$U$k$^$&(B
$B!J(B@code{shell-pushd-tohome}$B!K!"(B
$B?t0z?t$r;XDj$9$k$H(B@code{pop}$B$G$O$J$/=d2s$9$k(B
$B!J(B@code{shell-pushd-dextract}$B!K!"(B
$B%G%#%l%/%H%j%9%?%C%/$K$J$$%G%#%l%/%H%j$@$1$r(B
$B%G%#%l%/%H%j%9%?%C%/$K2C$($k(B
$B!J(B@code{shell-pushd-dunique}$B!K(B
$B$r@)8f$G$-$^$9!#(B
$B$3$l$i$NCM$OEvA3!";H$C$F$$$k%7%'%k$NF0:n$H0lCW$9$k$h$&$K@_Dj$9$Y$-$G$9!#(B
@node Remote Host
@c @subsection Remote Host Shell
@subsection $B%j%b!<%H%[%9%H$N%7%'%k(B
@c @cindex remote host
@c @cindex connecting to remote host
@cindex $B%j%b!<%H%[%9%H(B
@cindex $B%j%b!<%H%[%9%H$X$N@\B3(B
@cindex Telnet
@cindex Rlogin
@c Emacs provides two commands for logging in to another computer
@c and communicating with it through an Emacs buffer.
Emacs$B$K$O!"B>$N%[%9%H$K%m%0%$%s$7$F(BEmacs$B%P%C%U%!7PM3$GDL?.$9$k%3%^%s%I$,(B
2$B$D$"$j$^$9!#(B
@table @kbd
@item M-x telnet @key{RET} @var{hostname} @key{RET}
@c Set up a Telnet connection to the computer named @var{hostname}.
$B%[%9%H(B@var{hostname}$B$K(Btelnet$B7PM3$G@\B3$9$k!#(B
@item M-x rlogin @key{RET} @var{hostname} @key{RET}
@c Set up an Rlogin connection to the computer named @var{hostname}.
$B%[%9%H(B@var{hostname}$B$K(Brlogin$B7PM3$G@\B3$9$k!#(B
@end table
@findex telnet
@c Use @kbd{M-x telnet} to set up a Telnet connection to another
@c computer. (Telnet is the standard Internet protocol for remote login.)
@c It reads the host name of the other computer as an argument with the
@c minibuffer. Once the connection is established, talking to the other
@c computer works like talking to a subshell: you can edit input with the
@c usual Emacs commands, and send it a line at a time by typing @key{RET}.
@c The output is inserted in the Telnet buffer interspersed with the input.
$BB>$N%[%9%H$K(Btelnet$B7PM3$G@\B3$9$k$K$O!"(B@kbd{M-x telnet}$B$r;H$$$^$9(B
$B!J(Btelnet$B$O%j%b!<%H%m%0%$%sMQ$N(BInternet$B$NI8=`%W%m%H%3%k!K!#(B
$B$3$N%3%^%s%I$O!"@\B3@h$N%[%9%HL>$r0z?t$H$7$F%_%K%P%C%U%!$GFI$_$^$9!#(B
$B$$$C$?$s@\B3$,3NN)$9$k$H!"B>$N%[%9%H$H$N$d$j$H$j$O%5%V%7%'%k$H$N$d$j$H$j(B
$B$HF1MM$K$7$F9T$($^$9!#(B
$BDL>o$N(BEmacs$B%3%^%s%I$GF~NO$rJT=8$G$-!"(B@key{RET}$B$GAj<jB&$KAw?.$7$^$9!#(B
$BAj<jB&$+$i$N=PNO$O!JF1$8!K(BTelnet$B%P%C%U%!$KA^F~$5$l$^$9!#(B
@findex rlogin
@vindex rlogin-explicit-args
@c Use @kbd{M-x rlogin} to set up an Rlogin connection. Rlogin is
@c another remote login communication protocol, essentially much like the
@c Telnet protocol but incompatible with it, and supported only by certain
@c systems. Rlogin's advantages are that you can arrange not to have to
@c give your user name and password when communicating between two machines
@c you frequently use, and that you can make an 8-bit-clean connection.
@c (To do that in Emacs, set @code{rlogin-explicit-args} to @code{("-8")}
@c before you run Rlogin.)
rlogin$B@\B3$r9T$&$K$O!"(B@kbd{M-x rlogin}$B$r;H$$$^$9!#(B
rlogin$B$OK\<AE*$K$O(Btelnet$B%W%m%H%3%k$H$h$/;w$?(B
$B%j%b!<%H%m%0%$%sMQ$NDL?.%W%m%H%3%k$G$9$,!"(B
telnet$B$H$N8_49@-$O$J$/!"$"$k<o$N%7%9%F%`$G$@$1;H$($^$9!#(B
rlogin$B$NMxE@$O!"(B2$B$D$N%^%7%s4V$GIQHK$KDL?.$9$k>l9g$K(B
$B%f!<%6!<L>$d%Q%9%o!<%I$rKh2sBG$A9~$^$J$$$G$9$`$h$&$K@_Dj$G$-$k$3$H$H!"(B
8$B%S%C%H$rF)2aE*$K;H$&@\B3$,2DG=$J$3$H$G$9!#(B
$B!J(BEmacs$B$G$3$l$r9T$&$K$O!"(B
rlogin$B$r3+;O$9$k$^$($K(B@code{rlogin-explicit-args}$B$K(B@code{("-8")}$B$r(B
$B@_Dj$9$k!#!K(B
@c @kbd{M-x rlogin} sets up the default file directory of the Emacs
@c buffer to access the remote host via FTP (@pxref{File Names}), and it
@c tracks the shell commands that change the current directory, just like
@c Shell mode.
@kbd{M-x rlogin}$B$O!"Aj<jB&$H(BFTP$B7PM3$G%U%!%$%k$r$d$j$H$j$9$k$?$a$K(B
Emacs$B%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$r@_Dj$7!J(B@pxref{File Names}$B!K!"(B
$B%7%'%k!J(Bshell$B!K%b!<%I$HF1MM$K%+%l%s%H%G%#%l%/%H%j$rJQ99$9$k(B
$B%7%'%k%3%^%s%I$r4F;k$7$^$9!#(B
@findex rlogin-directory-tracking-mode
@c There are two ways of doing directory tracking in an Rlogin
@c buffer---either with remote directory names
@c @file{/@var{host}:@var{dir}/} or with local names (that works if the
@c ``remote'' machine shares file systems with your machine of origin).
@c You can use the command @code{rlogin-directory-tracking-mode} to switch
@c modes. No argument means use remote directory names, a positive
@c argument means use local names, and a negative argument means turn
@c off directory tracking.
rlogin$B%P%C%U%!$G%G%#%l%/%H%j$rDI@W$9$kJ}K!$O(B2$B$D$"$j$^$9!#(B
$B%j%b!<%H%G%#%l%/%H%jL>(B@file{/@var{host}:@var{dir}/}$B$r;H$&$+!"(B
$B%m!<%+%k%U%!%$%kL>$r;H$$$^$9!#(B
$B!J8e<T$O!XAj<jB&$N%[%9%H!Y$,%m!<%+%k%[%9%H$H(B
$B%U%!%$%k%7%9%F%`$r6&M-$7$F$$$k>l9g$K$N$_;H$($k!K!#(B
$B%3%^%s%I(B@code{rlogin-directory-tracking-mode}$B$r;H$C$F!"(B
$B$3$l$i$N(B2$B$D$N%b!<%I$rAj8_$K@Z$jBX$($i$l$^$9!#(B
$B0z?t$J$7$G$O%j%b!<%H%G%#%l%/%H%jL>$r;H$&>uBV$K$7!"(B
$B@5$N?t$r0z?t$K$9$k$H%m!<%+%kL>$r;H$&>uBV$K$7$^$9!#(B
$BIi$N?t$r0z?t$K$9$k$H%G%#%l%/%H%j$NDI@W5!G=$r;_$a$^$9!#(B
@node Emacs Server, Hardcopy, Shell, Top
@c @section Using Emacs as a Server
@section Emacs$B$r%5!<%P!<$H$7$F;H$&(B
@pindex emacsclient
@c @cindex Emacs as a server
@c @cindex server, using Emacs as
@c @cindex @code{EDITOR} environment variable
@cindex $B%5!<%P!<$H$7$F$N(BEmacs
@cindex Emacs$B$r%5!<%P!<$H$7$F;H$&(B
@cindex $B4D6-JQ?t(B@code{EDITOR}
@cindex @code{EDITOR}$B!J4D6-JQ?t!K(B
@c Various programs such as @code{mail} can invoke your choice of editor
@c to edit a particular piece of text, such as a message that you are
@c sending. By convention, most of these programs use the environment
@c variable @code{EDITOR} to specify which editor to run. If you set
@c @code{EDITOR} to @samp{emacs}, they invoke Emacs---but in an
@c inconvenient fashion, by starting a new, separate Emacs process. This
@c is inconvenient because it takes time and because the new Emacs process
@c doesn't share the buffers in the existing Emacs process.
@code{mail}$B$r;O$a$H$9$kB?$/$N%W%m%0%i%`$O!"(B
$BAw?.%a%C%;!<%8$J$I$N%F%-%9%H$rJT=8$9$k$?$a$K(B
$B%f!<%6!<$,;XDj$7$?%(%G%#%?$r5/F0$7$^$9!#(B
$B$3$l$i$N%W%m%0%i%`$O!"(B
$B=,47$H$7$F!"4D6-JQ?t(B@code{EDITOR}$B$G;XDj$5$l$?%(%G%#%?$r5/F0$7$^$9!#(B
@code{EDITOR}$B$K(B@samp{emacs}$B$r@_Dj$7$F$*$1$P(BEmacs$B$,5/F0$7$^$9$,!"(B
$B?7$?$KJL$N(BEmacs$B%W%m%;%9$,3+;O$5$l$k$N$GITJX$G$9!#(B
$B$H$$$&$N$O!"?7$7$$(BEmacs$B%W%m%;%9$O4{B8$N(BEmacs$B%W%m%;%9$H%P%C%U%!$r(B
$B6&M-$7$J$$$+$i$G$9!#(B
@c You can arrange to use your existing Emacs process as the editor for
@c programs like @code{mail} by using the Emacs client and Emacs server
@c programs. Here is how.
Emacs$B%/%i%$%"%s%H$H(BEmacs$B%5!<%P!<$rMQ$$$F!"(B
@code{mail}$B$J$I$N%W%m%0%i%`$,4{B8$N(BEmacs$B%W%m%;%9$r(B
$B%(%G%#%?$H$7$F;H$&$h$&$K$G$-$^$9!#(B
$B0J2<$N$h$&$K$7$^$9!#(B
@c @cindex @code{TEXEDIT} environment variable
@cindex $B4D6-JQ?t(B@code{TEXEDIT}
@cindex @code{TEXEDIT}$B!J4D6-JQ?t!K(B
@c First, the preparation. Within Emacs, call the function
@c @code{server-start}. (Your @file{.emacs} file can do this automatically
@c if you add the expression @code{(server-start)} to it.) Then, outside
@c Emacs, set the @code{EDITOR} environment variable to @samp{emacsclient}.
@c (Note that some programs use a different environment variable; for
@c example, to make @TeX{} use @samp{emacsclient}, you should set the
@c @code{TEXEDIT} environment variable to @samp{emacsclient +%d %s}.)
$B$^$:$O=`Hw$G$9!#(B
Emacs$B$NCf$G4X?t(B@code{server-start}$B$r8F$S=P$7$^$9!#(B
$B!J8D?M$N%U%!%$%k(B@file{.emacs}$B$K<0(B@code{(server-start)}$B$r=q$$$F$*$1$P!"(B
$B$3$l$r<+F0E*$K9T$($k!#!K(B
$B$D$.$K!"(BEmacs$B$N30$G4D6-JQ?t(B@code{EDITOR}$B$K(B@samp{emacsclient}$B$r@_Dj$7$^$9!#(B
$B!J%W%m%0%i%`$K$h$C$F$OJL$N4D6-JQ?t$r;H$&!#(B
$B$?$H$($P!"(B@TeX{}$B$K(B@samp{emacsclient}$B$r;H$o$;$k$K$O!"(B
$B4D6-JQ?t(B@code{TEXEDIT}$B$K(B@samp{emacsclient +%d %s}$B$H@_Dj$9$k!#!K(B
@kindex C-x #
@findex server-edit
@c Then, whenever any program invokes your specified @code{EDITOR}
@c program, the effect is to send a message to your principal Emacs telling
@c it to visit a file. (That's what the program @code{emacsclient} does.)
@c Emacs displays the buffer immediately and you can immediately begin
@c editing it.
$B$3$&$9$k$H!"$I$N%W%m%0%i%`$,(B@code{EDITOR}$B$K;XDj$5$l$?%W%m%0%i%`$r%(%G%#%?(B
$B$H$7$F5/F0$7$F$b!"7k2L$H$7$F$O!"K,$l$k$Y$-%U%!%$%k$rEA$($k(B
$B%a%C%;!<%8$,8=:_F0$$$F$$$k(BEmacs$B$KAw$i$l$^$9!#(B
$B!J$3$l$,(B@code{emacsclient}$B$NLr3d!#!K(B
Emacs$B$O$?$@$A$K%P%C%U%!$rI=<($7!"%f!<%6!<$O$9$0$KJT=8$r3+;O$G$-$^$9!#(B
@c When you've finished editing that buffer, type @kbd{C-x #}
@c (@code{server-edit}). This saves the file and sends a message back to
@c the @code{emacsclient} program telling it to exit. The programs that
@c use @code{EDITOR} wait for the ``editor'' (actually, @code{emacsclient})
@c to exit. @kbd{C-x #} also checks for other pending external requests
@c to edit various files, and selects the next such file.
$B$=$N%P%C%U%!$NJT=8$,=*$C$?$i!"(B@kbd{C-x #}$B$HBG$A$^$9!J(B@code{server-edit}$B!K!#(B
$B$3$l$K$h$j!"%U%!%$%k$,J]B8$5$l!"(B
$B=*N;$;$h$H$N%a%C%;!<%8$r(B@code{emacslient}$B$KAw$jJV$7$^$9!#(B
@code{EDITOR}$B$r;2>H$7$?%W%m%0%i%`$O(B
$B!X%(%G%#%?!Y!J<B:]$K$O(B@code{emacsclient}$B!K$,=*N;$9$k$N$rBT$A$^$9!#(B
@kbd{C-x #}$B$OJ#?t$N%U%!%$%k$KBP$9$k30It$+$i$NJT=8MW5a$G(B
$BB>$K;D$C$F$$$k$b$N$,$J$$$+$I$&$+$b8!::$7!"(B
$B$b$7$"$l$P$D$.$N%U%!%$%k$rK,Ld$7$^$9!#(B
@c You can switch to a server buffer manually if you wish; you don't have
@c to arrive at it with @kbd{C-x #}. But @kbd{C-x #} is the only way to
@c say that you are ``finished'' with one.
$BK>$`$J$i<j$G%5!<%P!<%P%C%U%!$K@Z$jBX$($F$b$+$^$$$^$;$s!#(B
$BI,$:(B@kbd{C-x #}$B$r;H$o$J$1$l$P$J$i$J$$$H$$$&$3$H$O$"$j$^$;$s!#(B
$B$?$@$7!"(B@kbd{C-x #}$B$O%5!<%P!<%P%C%U%!$NJT=8$,=*$C$?$H$$$&$3$H$r(B
$B9p$2$kM#0l$NJ}K!$G$9!#(B
@vindex server-window
@c If you set the variable @code{server-window} to a window or a frame,
@c @kbd{C-x #} displays the server buffer in that window or in that frame.
$BJQ?t(B@code{server-window}$B$K%&%#%s%I%&$d%U%l!<%`$r@_Dj$7$F$"$l$P!"(B
@kbd{C-x #}$B$O%5!<%P!<%P%C%U%!$r$=$N%&%#%s%I%&$d%U%l!<%`$KI=<($7$^$9!#(B
@c While @code{mail} or another application is waiting for
@c @code{emacsclient} to finish, @code{emacsclient} does not read terminal
@c input. So the terminal that @code{mail} was using is effectively
@c blocked for the duration. In order to edit with your principal Emacs,
@c you need to be able to use it without using that terminal. There are
@c two ways to do this:
@code{mail}$B$d$=$NB>$N%"%W%j%1!<%7%g%s$,(B@code{emacsclient}$B$N=*N;$r(B
$BBT$C$F$$$k$"$$$@!"(B@code{emacsclient}$B$OC<KvF~NO$rFI$_$^$;$s!#(B
$B$7$?$,$C$F!"(B@code{mail}$B$,;H$C$F$$$kC<Kv$O!"$=$N$"$$$@<B<AE*$K(B
$B%V%m%C%/$5$l$?>uBV$K$"$j$^$9!#(B
$B%5!<%P!<$H$7$F;H$&(BEmacs$B$GJT=8$r$9$k$?$a$K$O!"(B
$B$=$N!J%V%m%C%/$7$F$$$k!KC<Kv$r;H$o$:$K9T$&I,MW$,$"$j$^$9!#(B
$B$=$l$K$O(B2$B$D$NJ}K!$,$"$j$^$9!#(B
@itemize @bullet
@item
@c Using a window system, run @code{mail} and the principal Emacs in two
@c separate windows. While @code{mail} is waiting for @code{emacsclient},
@c the window where it was running is blocked, but you can use Emacs by
@c switching windows.
$B%&%#%s%I%&%7%9%F%`$r;H$$!"(B@code{mail}$B$H(BEmacs$B$H$rJL$N%&%#%s%I%&$GF0$+$9!#(B
@code{mail}$B$,(B@code{emacsclient}$B$rBT$C$F$$$k$"$$$@!"(B
@code{mail}$B$,F0$$$F$k%&%#%s%I%&$O%V%m%C%/$5$l$k$,!"(B
$BB>$N%&%#%s%I%&$K@Z$jBX$($l$P(BEmacs$B$r;H$($k!#(B
@item
@c Use Shell mode in Emacs to run the other program such as @code{mail};
@c then, @code{emacsclient} blocks only the subshell under Emacs, and you
@c can still use Emacs to edit the file.
Emacs$B$N%7%'%k!J(Bshell$B!K%b!<%I$r;H$C$F(B@code{mail}$B$J$I$N%W%m%0%i%`$rF0$+$9!#(B
$B$3$&$9$l$P!"(B@code{emacsclient}$B$O(BEmacs$B$N2<$GF0$$$F$$$k(B
$B%5%V%7%'%k$N$_$r%V%m%C%/$9$k$N$G!"(B
Emacs$B$r;H$C$F%U%!%$%k$rJT=8$9$k$N$ODL>o$I$*$j9T$($k!#(B
@end itemize
@vindex server-temp-file-regexp
@c Some programs write temporary files for you to edit. After you edit
@c the temporary file, the program reads it back and deletes it. If the
@c Emacs server is later asked to edit the same file name, it should assume
@c this has nothing to do with the previous occasion for that file name.
@c The server accomplishes this by killing the temporary file's buffer when
@c you finish with the file. Use the variable
@c @code{server-temp-file-regexp} to specify which files are temporary in
@c this sense; its value should be a regular expression that matches file
@c names that are temporary.
$B%W%m%0%i%`$K$h$C$F$O!"%(%G%#%?$GJT=8$9$k$?$a$N:n6H%U%!%$%k$r:n@.$7$^$9!#(B
$B%f!<%6!<$,:n6H%U%!%$%k$rJT=8$7=*$k$H!"(B
$B%W%m%0%i%`$O$=$N%U%!%$%k$rFI$_9~$s$G$+$i>C5n$7$^$9!#(B
Emacs$B%5!<%P!<$,$"$H$GF1$8L>A0$N%U%!%$%k$rJT=8$9$k$h$&$K9p$2$i$l$?>l9g!"(B
$B$=$l$O$?$^$?$^%U%!%$%kL>$,0lCW$7$?$@$1$G!"(B
$BFbMF$O$^$($N%U%!%$%k$H2?$i4X78$J$$$b$N$H9M$($J$1$l$P$J$j$^$;$s!#(B
$B$3$N$?$a!"%5!<%P!<$O%U%!%$%k$rJT=8$7=*$k$H:n6H%U%!%$%k$N%P%C%U%!$r:o=|$7$^$9!#(B
$BJQ?t(B@code{server-temp-file-regexp}$B$r;H$C$F!"(B
$B$I$N$h$&$J%U%!%$%k$,$3$3$G$$$&0UL#$G$N:n6H%U%!%$%k$G$"$k$+;XDj$7$^$9!#(B
$B$3$NJQ?t$NCM$O!":n6H%U%!%$%k$G$"$k$h$&$J%U%!%$%k$NL>A0$K(B
$B0lCW$9$k@55,I=8=$G$"$kI,MW$,$"$j$^$9!#(B
@c If you run @code{emacsclient} with the option @samp{--no-wait}, it
@c returns immediately without waiting for you to ``finish'' the buffer in
@c Emacs.
$B%*%W%7%g%s(B@samp{--no-wait}$B$r;XDj$7$F(B@code{emacsclient}$B$r5/F0$9$k$H!"(B
Emacs$B>e$G%P%C%U%!$rJT=8$7=*$k$N$rBT$?$:$K$?$@$A$K=*N;$7$^$9!#(B
@node Hardcopy, Postscript, Emacs Server, Top
@c @section Hardcopy Output
@section $B0u:~(B
@c @cindex hardcopy
@cindex $B0u:~(B
@c The Emacs commands for making hardcopy let you print either an entire
@c buffer or just part of one, either with or without page headers.
@c See also the hardcopy commands of Dired (@pxref{Misc File Ops})
@c and the diary (@pxref{Diary Commands}).
$B0u:~MQ$N(BEmacs$B%3%^%s%I$K$O!"%P%C%U%!A4BN$J$$$7$=$N0lIt$r!"(B
$B%Z!<%8%X%C%@IU$-!?$J$7$N$I$A$i$G$G$b=PNO$9$k5!G=$,$"$j$^$9!#(B
dired$B!J(B@pxref{Misc File Ops}$B!K$H(Bdiary$B!J(B@pxref{Diary Commands}$B!K$N(B
$B0u:~5!G=$K$D$$$F$b;2>H$7$F$/$@$5$$!#(B
@table @kbd
@item M-x print-buffer
@c Print hardcopy of current buffer with page headings containing the file
@c name and page number.
$B%+%l%s%H%P%C%U%!$NFbMF$r!"%U%!%$%kL>$H%Z!<%8HV9f$r(B
$B5-$7$?%Z!<%8%X%C%@IU$-$G0u:~$9$k!#(B
@item M-x lpr-buffer
@c Print hardcopy of current buffer without page headings.
$B%+%l%s%H%P%C%U%!$NFbMF$r!"%Z!<%8%X%C%@$J$7$G0u:~$9$k!#(B
@item M-x print-region
@c Like @code{print-buffer} but print only the current region.
@code{print-buffer}$B$HF1MM$@$,!"8=:_$N%j!<%8%g%s$N$_$r0u:~$9$k!#(B
@item M-x lpr-region
@c Like @code{lpr-buffer} but print only the current region.
@code{lpr-buffer}$B$HF1MM$@$,!"8=:_$N%j!<%8%g%s$N$_$r0u:~!#(B
@end table
@findex print-buffer
@findex print-region
@findex lpr-buffer
@findex lpr-region
@vindex lpr-switches
@c The hardcopy commands (aside from the Postscript commands) pass extra
@c switches to the @code{lpr} program based on the value of the variable
@c @code{lpr-switches}. Its value should be a list of strings, each string
@c an option starting with @samp{-}. For example, to specify a line width
@c of 80 columns for all the printing you do in Emacs, set
@c @code{lpr-switches} like this:
$B!J(BPostscript$B%3%^%s%I$r=|$/!K0u:~%3%^%s%I$O!"(B
@code{lpr-switches}$B$NCM$r$b$H$KDI2C%*%W%7%g%s$r(B@code{lpr}$B$KEO$7$^$9!#(B
$B$3$NJQ?t$NCM$OJ8;zNs$N%j%9%H$G$"$j!"(B
$B3FJ8;zNs$O(B@samp{-}$B$G;O$^$k%*%W%7%g%s$G$"$kI,MW$,$"$j$^$9!#(B
$B$?$H$($P!"(BEmacs$B$+$i9T$&0u:~$G(B1$B9T$r(B80$BJ8;z$K@_Dj$9$k$K$O!"(B
@code{lpr-switches}$B$r$D$.$N$h$&$K@_Dj$7$^$9!#(B
@example
(setq lpr-switches '("-w80"))
@end example
@vindex printer-name
@c You can specify the printer to use by setting the variable
@c @code{printer-name}.
$BJQ?t(B@code{printer-name}$B$r@_Dj$9$l$P!";H$&%W%j%s%?$r;XDj$G$-$^$9!#(B
@vindex lpr-headers-switches
@vindex lpr-commands
@vindex lpr-add-switches
@c The variable @code{lpr-command} specifies the name of the printer
@c program to run; the default value depends on your operating system type.
@c On most systems, the default is @code{"lpr"}. The variable
@c @code{lpr-headers-switches} similarly specifies the extra switches to
@c use to make page headers. The variable @code{lpr-add-switches} controls
@c whether to supply @samp{-T} and @samp{-J} options (suitable for
@c @code{lpr}) to the printer program: @code{nil} means don't add them.
@c @code{lpr-add-switches} should be @code{nil} if your printer program is
@c not compatible with @code{lpr}.
$BJQ?t(B@code{lpr-command}$B$O!"<B9T$9$Y$-%W%j%s%?%W%m%0%i%`$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$NCM$O%*%Z%l!<%F%#%s%0%7%9%F%`$K0MB8$7$^$9!#(B
$BB?$/$N%7%9%F%`$G$O!"%G%U%)%k%H$O(B@code{"lpr"}$B$G$9!#(B
$BJQ?t(B@code{lpr-headers-switches}$B$bF1MM$K!"(B
$B%Z!<%8%X%C%@$r:n$k$?$a$NDI2C%*%W%7%g%s$r;XDj$7$^$9!#(B
$BJQ?t(B@code{lpr-add-switches}$B$O!"(B
$B%W%j%s%?%W%m%0%i%`$K!J(B@code{lpr}$B$K$OE,$7$?!K(B
$B%*%W%7%g%s(B@samp{-T}$B$H%*%W%7%g%s(B@samp{-J}$B$r;XDj$9$k$+$I$&$+@)8f$7$^$9!#(B
$B$3$NJQ?t$NCM$,(B@code{nil}$B$J$i$3$l$i$N%*%W%7%g%s$r;XDj$7$^$;$s!#(B
$B%W%j%s%?%W%m%0%i%`$,(B@code{lpr}$B$H8_49@-$,$J$$$J$i!"(B
$BJQ?t(B@code{lpr-add-switches}$B$O(B@code{nil}$B$K$9$Y$-$G$9!#(B
@node Postscript, Postscript Variables, Hardcopy, Top
@c @section Postscript Hardcopy
@section Postscript$B$N0u:~(B
@c These commands convert buffer contents to Postscript,
@c either printing it or leaving it in another Emacs buffer.
$B$3$l$i$N%3%^%s%I$O!"%P%C%U%!$NFbMF$r(BPostscript$B$KJQ49$7!"(B
$B%W%j%s%?$XAw$k$+B>$N(BEmacs$B%P%C%U%!$KF~$l$^$9!#(B
@table @kbd
@item M-x ps-print-buffer
@c Print hardcopy of the current buffer in Postscript form.
$B%+%l%s%H%P%C%U%!$r(BPostscript$B7A<0$G0u:~$9$k!#(B
@item M-x ps-print-region
@c Print hardcopy of the current region in Postscript form.
$B8=:_$N%j!<%8%g%s$r(BPostscript$B7A<0$G0u:~$9$k!#(B
@item M-x ps-print-buffer-with-faces
@c Print hardcopy of the current buffer in Postscript form, showing the
@c faces used in the text by means of Postscript features.
$B%+%l%s%H%P%C%U%!$r(BPostscript$B7A<0$G0u:~$9$k$,!"(B
$B%F%-%9%H$GMQ$$$F$$$k%U%'%$%9$r(BPostscript$B$N5!G=$GI=<($9$k!#(B
@item M-x ps-print-region-with-faces
@c Print hardcopy of the current region in Postscript form, showing the
@c faces used in the text.
$B8=:_$N%j!<%8%g%s$r(BPostscript$B7A<0$G0u:~$9$k$,!"(B
$B%F%-%9%H$GMQ$$$F$$$k%U%'%$%9$bI=<($9$k!#(B
@item M-x ps-spool-buffer
@c Generate Postscript for the current buffer text.
$B%+%l%s%H%P%C%U%!$N%F%-%9%H$r(BPostscript$B$KJQ49$9$k!#(B
@item M-x ps-spool-region
@c Generate Postscript for the current region.
$B8=:_$N%j!<%8%g%s$r(BPostscript$B$KJQ49$9$k!#(B
@c @item M-x ps-spool-buffer-with-faces
@c Generate Postscript for the current buffer, showing the faces used.
$B%+%l%s%H%P%C%U%!$r(BPostscript$B$KJQ49$9$k$,!";H$o$l$F$$$k%U%'%$%9$bI=<($9$k!#(B
@item M-x ps-spool-region-with-faces
@c Generate Postscript for the current region, showing the faces used.
$B8=:_$N%j!<%8%g%s$r(BPostscript$B$KJQ49$9$k$,!";H$o$l$F$$$k%U%'%$%9$bI=<($9$k!#(B
@end table
@findex ps-print-region
@findex ps-print-buffer
@findex ps-print-region-with-faces
@findex ps-print-buffer-with-faces
@c The Postscript commands, @code{ps-print-buffer} and
@c @code{ps-print-region}, print buffer contents in Postscript form. One
@c command prints the entire buffer; the other, just the region. The
@c corresponding @samp{-with-faces} commands,
@c @code{ps-print-buffer-with-faces} and @code{ps-print-region-with-faces},
@c use Postscript features to show the faces (fonts and colors) in the text
@c properties of the text being printed.
Postscript$B%3%^%s%I(B@code{ps-print-buffer}$B$*$h$S(B@code{ps-print-region}$B$O(B
$B%P%C%U%!$NFbMF$r(BPostscript$B7A<0$G=PNO$7$^$9!#(B
$BA0<T$O%P%C%U%!A4BN$r=PNO$7$^$9$,!"8e<T$O%j!<%8%g%s$N$_$G$9!#(B
$B$3$l$i$KBP1~$7$?(B@samp{-with-faces}$B%3%^%s%I$G$"$k(B
@code{ps-print-buffer-with-faces}$B$*$h$S(B@code{ps-print-region-with-faces}$B$O!"(B
$B=PNO$9$k%F%-%9%H$N%F%-%9%HB0@-$N%U%'%$%9!J%U%)%s%H$HI=<(?'!K$r(B
Postscript$B$N5!G=$rMQ$$$F:F8=$7$^$9!#(B
@c If you are using a color display, you can print a buffer of program
@c code with color highlighting by turning on Font-Lock mode in that
@c buffer, and using @code{ps-print-buffer-with-faces}.
$B%+%i!<%G%#%9%W%l%$$r;H$C$F$$$k>l9g!"(B
$B%P%C%U%!$G%U%)%s%H%m%C%/!J(Bfont-lock$B!K%b!<%I$r;H$C$F?'IU$1$7$?%W%m%0%i%`%3!<%I$r(B
@code{ps-print-buffer-with-faces}$B$G!J$=$N$^$^!K0u:~$G$-$^$9!#(B
@findex ps-spool-region
@findex ps-spool-buffer
@findex ps-spool-region-with-faces
@findex ps-spool-buffer-with-faces
@c The commands whose names have @samp{spool} instead of @samp{print}
@c generate the Postscript output in an Emacs buffer instead of sending
@c it to the printer.
$B%3%^%s%IL>$,(B@samp{print}$B$N$+$o$j$K(B@samp{spool}$B$G$"$k$b$N$O!"(B
$BJQ49$7$?(BPostscript$B=PNO$r%W%j%s%?$KAw$k$+$o$j$K(BEmacs$B%P%C%U%!$KCV$-$^$9!#(B
@ifinfo
@c The following section describes variables for customizing these commands.
$B$D$.$N@a$G$O!"$3$l$i$N%3%^%s%I$r%+%9%?%^%$%:$9$kJQ?t$K$D$$$F@bL@$7$^$9!#(B
@end ifinfo
@node Postscript Variables, Sorting, Postscript, Top
@c @section Variables for Postscript Hardcopy
@section Postscript$B$N0u:~$r@)8f$9$kJQ?t(B
@vindex ps-lpr-command
@vindex ps-lpr-switches
@vindex ps-printer-name
@c All the Postscript hardcopy commands use the variables
@c @code{ps-lpr-command} and @code{ps-lpr-switches} to specify how to print
@c the output. @code{ps-lpr-command} specifies the command name to run,
@c @code{ps-lpr-switches} specifies command line options to use, and
@c @code{ps-printer-name} specifies the printer. If you don't set the
@c first two variables yourself, they take their initial values from
@c @code{lpr-command} and @code{lpr-switches}. If @code{ps-printer-name}
@c is @code{nil}, @code{printer-name} is used.
$B$9$Y$F$N(BPostscript$B$N0u:~%3%^%s%I$O!"=PNO$r$I$N$h$&$K0u:~$9$k$+$r(B
$BJQ?t(B@code{ps-lpr-command}$B$H(B@code{ps-lpr-switches}$B$G;XDj$G$-$^$9!#(B
@code{ps-lpr-command}$B$K$O0u:~$N$?$a<B9T$9$k%7%'%k%3%^%s%I!"(B
@code{ps-lpr-switches}$B$K$O$=$N%7%'%k%3%^%s%I$K;XDj$9$k%*%W%7%g%s!"(B
@code{ps-printer-name}$B$K$O%W%j%s%?$r;XDj$7$^$9!#(B
$B;O$a$N(B2$B$D$NJQ?t$r@_Dj$7$J$+$C$?>l9g$O!"(B
@code{lpr-command}$B$H(B@code{lpr-switches}$B$K4p$E$$$F=i4|CM$,@_Dj$5$l$^$9!#(B
@code{ps-printer-name}$B$,(B@code{nil}$B$@$H(B@code{printer-name}$B$r;H$$$^$9!#(B
@vindex ps-print-header
@vindex ps-print-color-p
@c The variable @code{ps-print-header} controls whether these commands
@c add header lines to each page---set it to @code{nil} to turn headers
@c off. You can turn off color processing by setting
@c @code{ps-print-color-p} to @code{nil}.
$BJQ?t(B@code{ps-print-header}$B$O!"$3$l$i$N%3%^%s%I$,(B
$B3F%Z!<%8$K%X%C%@$r$D$1$k$+$I$&$+$r@)8f$7$^$9!#(B
@code{nil}$B$@$H%X%C%@$rIU$1$^$;$s!#(B
@code{ps-print-color-p}$B$r(B@code{nil}$B$K$9$k$H%+%i!<=hM}$r9T$$$^$;$s!#(B
@vindex ps-paper-type
@vindex ps-page-dimensions-database
@c The variable @code{ps-paper-type} specifies which size of paper to
@c format for; legitimate values include @code{a4}, @code{a3},
@c @code{a4small}, @code{b4}, @code{b5}, @code{executive}, @code{ledger},
@c @code{legal}, @code{letter}, @code{letter-small}, @code{statement},
@c @code{tabloid}. The default is @code{letter}. You can define
@c additional paper sizes by changing the variable
@c @code{ps-page-dimensions-database}.
$BJQ?t(B@code{ps-paper-type}$B$O!"0u:~MQ;f%5%$%:$r;XDj$7$^$9!#(B
$B;XDj$G$-$kCM$O!"(B@code{a4}$B!"(B@code{a3}$B!"(B@code{a4small}$B!"(B
@code{b4}$B!"(B@code{b5}$B!"(B@code{executive}$B!"(B@code{ledger}$B!"(B@code{legal}$B!"(B
@code{letter}$B!"(B@code{letter-small}$B!"(B@code{statement}$B!"(B@code{tabloid}$B$G$9!#(B
$B%G%U%)%k%H$O(B@code{letter}$B$G$9!#(B
$BJQ?t(B@code{ps-page-dimensions-database}$B$rJQ99$9$l$P(B
$BJL$NMQ;f%5%$%:$rDj5A$G$-$^$9!#(B
@vindex ps-landscape-mode
@c The variable @code{ps-landscape-mode} specifies the orientation of
@c printing on the page. The default is @code{nil}, which stands for
@c ``portrait'' mode. Any non-@code{nil} value specifies ``landscape''
@c mode.
$BJQ?t(B@code{ps-landscape-mode}$B$OMQ;f$N8~$-$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$O(B@code{nil}$B$G!"!X=D$E$+$$!Y!J%]!<%H%l!<%H!K$G$9!#(B
@code{nil}$B0J30$NCM$r;XDj$9$k$H!X2#$E$+$$!Y!J%i%s%I%9%1!<%W!K$G$9!#(B
@vindex ps-number-of-columns
@c The variable @code{ps-number-of-columns} specifies the number of
@c columns; it takes effect in both landscape and portrait mode. The
@c default is 1.
$BJQ?t(B@code{ps-number-of-columns}$B$OCJ?t$r;XDj$7$^$9!#(B
$B=D$E$+$$$G$b2#$E$+$$$G$bM-8z$G!"%G%U%)%k%H$O(B1$B$G$9!#(B
@vindex ps-font-family
@vindex ps-font-size
@vindex ps-font-info-database
@c The variable @code{ps-font-family} specifies which font family to use
@c for printing ordinary text. Legitimate values include @code{Courier},
@c @code{Helvetica}, @code{NewCenturySchlbk}, @code{Palatino} and
@c @code{Times}. The variable @code{ps-font-size} specifies the size of
@c the font for ordinary text. It defaults to 8.5 points.
$BJQ?t(B@code{ps-font-family}$B$O!"(B
$BDL>o$N%F%-%9%H$N0u:~$K;H$&%U%)%s%H%U%!%_%j$r;XDj$7$^$9!#(B
$B;XDj$G$-$kCM$O!"(B@code{Courier}$B!"(B@code{Helvetica}$B!"(B
@code{NewCenturySchlbk}$B!"(B@code{Palatino}$B!"(B@code{Times}$B$G$9!#(B
$BJQ?t(B@code{ps-font-size}$B$O!"(B
$BDL>o$N%F%-%9%H0u:~$K;H$&%U%)%s%H$N%5%$%:$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$O(B8.5$B%]%$%s%H(B@footnote{$B!ZLuCm![(B
$B0u:~5!$ND9$5$NC10L!#(B
1$B%]%$%s%H$OLs(B1/72$B%$%s%A!J(B0.35mm$B!K(B}$B$G$9!#(B
@c Many other customization variables for these commands are defined and
@c described in the Lisp file @file{ps-print.el}.
$B$3$l$i$N%3%^%s%I$K$OB>$K$bB?$/$N%+%9%?%^%$%:2DG=$JJQ?t$,$"$j!"(B
$B$=$l$i$O(BLisp$B%U%!%$%k(B@file{ps-print.el}$B$GDj5A$5$l$F$$$^$9!#(B
@node Sorting, Narrowing, Postscript Variables, Top
@c @section Sorting Text
@section $B%F%-%9%H$N%=!<%H(B
@c @cindex sorting
@cindex $B%=!<%H(B
@c Emacs provides several commands for sorting text in the buffer. All
@c operate on the contents of the region (the text between point and the
@c mark). They divide the text of the region into many @dfn{sort records},
@c identify a @dfn{sort key} for each record, and then reorder the records
@c into the order determined by the sort keys. The records are ordered so
@c that their keys are in alphabetical order, or, for numeric sorting, in
@c numeric order. In alphabetic sorting, all upper-case letters `A' through
@c `Z' come before lower-case `a', in accord with the ASCII character
@c sequence.
Emacs$B$K$O!"%P%C%U%!Cf$N%F%-%9%H$r%=!<%H$9$k%3%^%s%I$,$$$/$D$+$"$j$^$9!#(B
$B$9$Y$F$O%j!<%8%g%s!J%]%$%s%H$H%^!<%/$N$"$$$@$N%F%-%9%H!K$KF/$-$^$9!#(B
$B$3$l$i$N%3%^%s%I$O!"%j!<%8%g%sCf$N%F%-%9%H$r(B
$BB??t$N(B@dfn{$B%=!<%H%l%3!<%I(B}$B$K$o$1!"(B
$B3F%l%3!<%I$K$D$$$F(B@dfn{$B%=!<%H%-!<(B}$B$r<1JL$7!"(B
$B0lO"$N%l%3!<%I$r%=!<%H%-!<$K$h$C$FDj$^$k=g=x$KJB$YBX$($^$9!#(B
$B%l%3!<%I$O%-!<$N%"%k%U%!%Y%C%H!J<-=q!K=g$K$b!"(B
$B$^$??tCM$K4p$E$/?tCM=g$K$bJB$Y$i$l$^$9!#(B
$B%"%k%U%!%Y%C%H=g$N>l9g$O!"(BASCII$BJ8;z$N=g=x$K4p$E$$$F(B
$B$9$Y$F$NBgJ8;z!V(BA$B!W!A!V(BZ$B!W$O>.J8;z!V(Ba$B!W$h$j$^$($K$-$^$9!#(B
@c The various sort commands differ in how they divide the text into sort
@c records and in which part of each record is used as the sort key. Most of
@c the commands make each line a separate sort record, but some commands use
@c paragraphs or pages as sort records. Most of the sort commands use each
@c entire sort record as its own sort key, but some use only a portion of the
@c record as the sort key.
$B3F<o$N%=!<%H%3%^%s%I$N0c$$$O!"%F%-%9%H$r%=!<%H%l%3!<%I$KJ,$1$kJ}K!$H!"(B
$B3F%l%3!<%I$N$I$NItJ,$r%=!<%H%-!<$K;H$&$+$G$9!#(B
$B$[$H$s$I$N%3%^%s%I$O3F9T$r%=!<%H%l%3!<%I$H$7$F07$$$^$9$,!"(B
$BCJMn$d%Z!<%8$r%=!<%H%l%3!<%I$H$7$F07$&%3%^%s%I$b$"$j$^$9!#(B
$B$[$H$s$I$N%=!<%H%3%^%s%I$O3F%=!<%H%l%3!<%IA4BN$r(B
$B$=$l<+?H$N%=!<%H%-!<$H$7$F07$$$^$9$,!"(B
$B%=!<%H%l%3!<%I$N0lItJ,$@$1$r%=!<%H%-!<$H$7$F07$&%3%^%s%I$b$"$j$^$9!#(B
@findex sort-lines
@findex sort-paragraphs
@findex sort-pages
@findex sort-fields
@findex sort-numeric-fields
@table @kbd
@item M-x sort-lines
@c Divide the region into lines, and sort by comparing the entire
@c text of a line. A numeric argument means sort into descending order.
$B%j!<%8%g%s$r9T$NJB$S$H$_$J$7!"9TA4BN$N%F%-%9%H$rHf3S$7$F!J>:=g$K!K%=!<%H$9$k!#(B
$B?t0z?t$r;XDj$9$k$H9_=g$K%=!<%H$9$k!#(B
@item M-x sort-paragraphs
@c Divide the region into paragraphs, and sort by comparing the entire
@c text of a paragraph (except for leading blank lines). A numeric
@c argument means sort into descending order.
$B%j!<%8%g%s$rCJMn$NJB$S$H$_$J$7!"!J@hF,$N6u9T$r=|$/!K(B
$BCJMnA4BN$N%F%-%9%H$rHf3S$7$F!J>:=g$K!K%=!<%H$9$k!#(B
$B?t0z?t$r;XDj$9$k$H9_=g$K%=!<%H$9$k!#(B
@item M-x sort-pages
@c Divide the region into pages, and sort by comparing the entire
@c text of a page (except for leading blank lines). A numeric
@c argument means sort into descending order.
$B%j!<%8%g%s$r%Z!<%8$NJB$S$H$_$J$7!"!J@hF,$N6u9T$r=|$/!K(B
$B%Z!<%8A4BN$N%F%-%9%H$rHf3S$7$F!J>:=g$K!K%=!<%H$9$k!#(B
$B?t0z?t$r;XDj$9$k$H9_=g$K%=!<%H$9$k!#(B
@item M-x sort-fields
@c Divide the region into lines, and sort by comparing the contents of
@c one field in each line. Fields are defined as separated by
@c whitespace, so the first run of consecutive non-whitespace characters
@c in a line constitutes field 1, the second such run constitutes field
@c 2, etc.
$B%j!<%8%g%s$r9T$NJB$S$H$_$J$7!"(B
$B9T$N(B1$B$D$NMs$rHf3S$7$F!J>:=g$K!K%=!<%H$9$k!#(B
$BMs$OGrJ8;z$G6h@Z$i$l$k!#(B
$B$D$^$j!"9T$N;O$a$K$"$kGrJ8;z$G$J$$J8;z$NJB$S$,Bh(B1$BMs!"(B
$B$=$N$D$.$N6uGr$G$J$$J8;z$NJB$S$,Bh(B2$BMs!"$H$$$&$h$&$K$J$k!#(B
@c Specify which field to sort by with a numeric argument: 1 to sort by
@c field 1, etc. A negative argument means count fields from the right
@c instead of from the left; thus, minus 1 means sort by the last field.
@c If several lines have identical contents in the field being sorted, they
@c keep same relative order that they had in the original buffer.
$B$I$NMs$r%-!<$H$7$F%=!<%H$9$k$+$O!"(B
1$B$r;XDj$9$l$PBh(B1$BMs!"$H$$$&$h$&$K?t0z?t$G;XDj$9$k!#(B
$BIi$NCM$r;XDj$7$?$H$-$O:8$+$i$G$J$/1&$+$iMs$r?t$($k!#(B
$B$D$^$j!"(B-1$B$O:G8e$NMs$G%=!<%H$9$k!#(B
$BJ#?t$N9T$K$*$$$FMs$NCM$,F10l$N>l9g!"(B
$B%P%C%U%!>e$N$b$H$N=g=x$,J]B8$5$l$k!#(B
@item M-x sort-numeric-fields
@c Like @kbd{M-x sort-fields} except the specified field is converted
@c to an integer for each line, and the numbers are compared. @samp{10}
@c comes before @samp{2} when considered as text, but after it when
@c considered as a number.
@kbd{M-x sort-fields}$B$HF1MM$@$,!"(B
$B;XDj$7$?Ms$r9T$4$H$K?tCM$KJQ49$7!"$=$N?tCMF1;N$rHf3S$9$k!#(B
@samp{10}$B$O%"%k%U%!%Y%C%H=g$G$O(B@samp{2}$B$h$j$^$($K$/$k$,!"(B
$B?tCM$H$7$F8+$l$P(B@samp{2}$B$h$j$"$H$K$/$k!#(B
@item M-x sort-columns
@c Like @kbd{M-x sort-fields} except that the text within each line
@c used for comparison comes from a fixed range of columns. See below
@c for an explanation.
@kbd{M-x sort-fields}$B$HF1MM$@$,!"9T$NHf3S$K;H$&%F%-%9%H$O(B
$B8GDjJ8;z0LCV$+$i$H$k!#(B
$B0J2<$N@bL@$r;2>H$N$3$H!#(B
@item M-x reverse-region
@c Reverse the order of the lines in the region. This is useful for
@c sorting into descending order by fields or columns, since those sort
@c commands do not have a feature for doing that.
$B%j!<%8%g%sFb$N9T$N=gHV$r5U$K$9$k!#(B
$BMs$dJ8;z0LCV$G%=!<%H$9$k%3%^%s%I$O9_=g$K$O%=!<%H$G$-$J$$$N$G!"(B
$B>:=g$K%=!<%H$7$?$"$H9_=g$KJB$YBX$($k$N$KLrN)$D!#(B
@end table
@c For example, if the buffer contains this:
$B$?$H$($P!"%P%C%U%!$K$D$.$N$h$&$JFbMF$,F~$C$F$$$?$H$7$^$9!#(B
@smallexample
On systems where clash detection (locking of files being edited) is
implemented, Emacs also checks the first time you modify a buffer
whether the file has changed on disk since it was last visited or
saved. If it has, you are asked to confirm that you want to change
the buffer.
@end smallexample
@noindent
@c applying @kbd{M-x sort-lines} to the entire buffer produces this:
$B%P%C%U%!A4BN$K(B@kbd{M-x sort-lines}$B$rE,MQ$9$k$H!"(B
$B$D$.$N$h$&$K$J$j$^$9!#(B
@smallexample
On systems where clash detection (locking of files being edited) is
implemented, Emacs also checks the first time you modify a buffer
saved. If it has, you are asked to confirm that you want to change
the buffer.
whether the file has changed on disk since it was last visited or
@end smallexample
@noindent
@c where the upper-case @samp{O} sorts before all lower-case letters. If
@c you use @kbd{C-u 2 M-x sort-fields} instead, you get this:
$B$3$3$G!"(B@samp{O}$B$OBgJ8;z$J$N$G$9$Y$F$N>.J8;z$h$j$^$($K$-$^$9!#(B
$B>e5-$N$+$o$j$K(B@kbd{C-u 2 M-x sort-filelds}$B$r;H$C$?$H$9$k$H!"(B
$B7k2L$O$D$.$N$h$&$K$J$j$^$9!#(B
@smallexample
implemented, Emacs also checks the first time you modify a buffer
saved. If it has, you are asked to confirm that you want to change
the buffer.
On systems where clash detection (locking of files being edited) is
whether the file has changed on disk since it was last visited or
@end smallexample
@noindent
@c where the sort keys were @samp{Emacs}, @samp{If}, @samp{buffer},
@c @samp{systems} and @samp{the}.
$B$3$NNc$G$O%=!<%H%-!<$O!"(B@samp{Emacs}$B!"(B@samp{If}$B!"(B@samp{buffer}$B!"(B
@samp{systems}$B!"(B@samp{the}$B$@$C$?$o$1$G$9!#(B
@findex sort-columns
@c @kbd{M-x sort-columns} requires more explanation. You specify the
@c columns by putting point at one of the columns and the mark at the other
@c column. Because this means you cannot put point or the mark at the
@c beginning of the first line of the text you want to sort, this command
@c uses an unusual definition of `region': all of the line point is in is
@c considered part of the region, and so is all of the line the mark is in,
@c as well as all the lines in between.
@kbd{M-x sort-columns}$B$K$O>/!9@bL@$,I,MW$G$9!#(B
$BJ8;z0LCV$NHO0O$r;XDj$9$k$K$O!"%]%$%s%H$rJ8;z0LCV$N0lJ}$K!"(B
$B%^!<%/$rB>J}$NJ8;z0LCV$KCV$-$^$9!#(B
$B$3$N$?$a!"%]%$%s%H$d%^!<%/$r%=!<%H$7$?$$:G=i$N9T$N@hF,$K(B
$BCV$/$3$H$,$G$-$^$;$s$+$i!"$3$N%3%^%s%I$G$OJQ$o$C$?(B
$B!V%j!<%8%g%s!W$NDj5A$rMQ$$$^$9!#(B
$B%]%$%s%H$,$"$k9TA4BN$O%j!<%8%g%s$K4^$^$l!"(B
$BF1MM$K!"%^!<%/$,$"$k9TA4BN$b%j!<%8%g%s$K4^$^$l!"(B
$B$3$N(B2$B$D$N9T$N$"$$$@$K$"$k9T$O$9$Y$F%j!<%8%g%s$K4^$^$l$k$H$_$J$9$N$G$9!#(B
@c For example, to sort a table by information found in columns 10 to 15,
@c you could put the mark on column 10 in the first line of the table, and
@c point on column 15 in the last line of the table, and then run
@c @code{sort-columns}. Equivalently, you could run it with the mark on
@c column 15 in the first line and point on column 10 in the last line.
$B$?$H$($P!"$"$kI=$r(B10$BJ8;zL\$+$i(B15$BJ8;zL\$^$G$N>pJs$r$b$H$K%=!<%H$9$k>l9g!"(B
$BI=$N:G=i$N9T$N(B10$BJ8;zL\$K%^!<%/$rCV$-!"(B
$BI=$N:G8e$N9T$N(B15$BJ8;zL\$K%]%$%s%H$rCV$-!"(B
$B$=$7$F(B@code{sort-column}$B$r<B9T$7$^$9!#(B
$B$"$k$$$O!"%^!<%/$r:G=i$N9T$N(B15$BJ8;zL\!"(B
$B%]%$%s%H$r:G8e$N9T$N(B10$BJ8;zL\$KCV$$$F$bF1$8$3$H$G$9!#(B
@c This can be thought of as sorting the rectangle specified by point and
@c the mark, except that the text on each line to the left or right of the
@c rectangle moves along with the text inside the rectangle.
@c @xref{Rectangles}.
$B$3$l$O!"%]%$%s%H$H%^!<%/$G;XDj$5$l$?6k7ANN0h$r%=!<%H$9$k$b$N$H9M$($i$l$^$9!#(B
$B$?$@$7!"6k7ANN0h$N1&B&$d:8B&$K$"$k3F9T$N%F%-%9%H$b0l=o$K0\F0$7$^$9!#(B
@vindex sort-fold-case
@c Many of the sort commands ignore case differences when comparing, if
@c @code{sort-fold-case} is non-@code{nil}.
@code{sort-fold-case}$B$,(B@code{nil}$B0J30$N>l9g!"(B
$B%=!<%H%3%^%s%I$N$[$H$s$I$OHf3S$K:]$7$FBgJ8;z>.J8;z$r6hJL$7$^$;$s!#(B
@node Narrowing, Two-Column, Sorting, Top
@c @section Narrowing
@section $B%J%m%$%s%0(B
@c @cindex widening
@c @cindex restriction
@c @cindex narrowing
@c @cindex accessible portion
@cindex $B%o%$%I%K%s%0(B
@cindex $BHO0O@)8B(B
@cindex $B%J%m%$%s%0(B
@cindex $B;2>H2DG=HO0O(B
@c @dfn{Narrowing} means focusing in on some portion of the buffer,
@c making the rest temporarily inaccessible. The portion which you can
@c still get to is called the @dfn{accessible portion}. Canceling the
@c narrowing, which makes the entire buffer once again accessible, is
@c called @dfn{widening}. The amount of narrowing in effect in a buffer at
@c any time is called the buffer's @dfn{restriction}.
@dfn{$B%J%m%$%s%0(B}$B!J(Bnarrowing$B!K$H$O!"%P%C%U%!$N$"$kItJ,$@$1$K>GE@$rEv$F!"(B
$B;D$j$NItJ,$r0l;~E*$K;2>H$G$-$J$/$9$k$3$H$G$9!#(B
$B07$($kItJ,$N$3$H$r(B@dfn{$B;2>H2DG=HO0O(B}$B$H8F$S$^$9!#(B
$B%J%m%$%s%0$r<h$j>C$7$F!"%P%C%U%!A4BN$r;2>H$G$-$k$h$&$KLa$9$3$H$r(B
@dfn{$B%o%$%I%K%s%0(B}$B!J(Bwidening$B!K$H8F$S$^$9!#(B
@c Narrowing can make it easier to concentrate on a single subroutine or
@c paragraph by eliminating clutter. It can also be used to restrict the
@c range of operation of a replace command or repeating keyboard macro.
$B%J%m%$%s%0$9$k$H!"B>$NItJ,$KHQ$o$5$l$k$3$H$J$/!"(B
1$B$D$N%5%V%k!<%A%s$dCJMn$J$I$K=8Cf$G$-$^$9!#(B
$B$^$?!"CV49%3%^%s%I$d%-!<%\!<%I%^%/%m$NE,MQHO0O$r@)8B$9$k$N$K$bMxMQ$G$-$^$9!#(B
@c WideCommands
@table @kbd
@item C-x n n
@c Narrow down to between point and mark (@code{narrow-to-region}).
$B%]%$%s%H$H%^!<%/$N$"$$$@$K%J%m%$%s%0$9$k!J(B@code{narrow-to-region}$B!K!#(B
@item C-x n w
@c Widen to make the entire buffer accessible again (@code{widen}).
$B:FEY%P%C%U%!A4BN$r;2>H2DG=$K$9$k!J(B@code{widen}$B!K!#(B
@item C-x n p
@c Narrow down to the current page (@code{narrow-to-page}).
$B8=:_$N%Z!<%8$K%J%m%$%s%0$9$k!J(B@code{narrow-to-page}$B!K!#(B
@item C-x n d
@c Narrow down to the current defun (@code{narrow-to-defun}).
$B8=:_$N4X?tDj5A$K%J%m%$%s%0$9$k!J(B@code{narrow-to-defun}$B!K!#(B
@end table
@c When you have narrowed down to a part of the buffer, that part appears
@c to be all there is. You can't see the rest, you can't move into it
@c (motion commands won't go outside the accessible part), you can't change
@c it in any way. However, it is not gone, and if you save the file all
@c the inaccessible text will be saved. The word @samp{Narrow} appears in
@c the mode line whenever narrowing is in effect.
$B%P%C%U%!$N0lItJ,$X%J%m%$%s%0$9$k$H!"$=$NItJ,$@$1$7$+$J$$$h$&$K8+$($^$9!#(B
$B;D$j$NItJ,$O8+$($^$;$s$7!"$=$3$X%]%$%s%H$r0\F0$9$k$3$H$b$G$-$^$;$s(B
$B!J0\F0%3%^%s%I$O;2>H2DG=HO0O$+$i30$X=P$i$l$J$$!K$7!"(B
$B8+$($J$$ItJ,$O$I$N$h$&$K$7$F$bJQ99$G$-$^$;$s!#(B
$B$7$+$7!"$=$NItJ,$,$J$/$J$C$?$o$1$G$O$J$$$N$G!"(B
$B%U%!%$%k$KJ]B8$9$l$P;2>H$G$-$J$$%F%-%9%H$bJ]B8$5$l$^$9!#(B
$B%J%m%$%s%0$7$F$$$k$"$$$@$O!"%b!<%I9T$K(B@samp{Narrow}$B$HI=<($5$l$^$9!#(B
@kindex C-x n n
@findex narrow-to-region
@c The primary narrowing command is @kbd{C-x n n} (@code{narrow-to-region}).
@c It sets the current buffer's restrictions so that the text in the current
@c region remains accessible but all text before the region or after the region
@c is inaccessible. Point and mark do not change.
$B<gMW$J%J%m%$%s%0%3%^%s%I$O(B@kbd{C-x n n}$B!J(B@code{narrow-to-region}$B!K$G$9!#(B
$B8=:_$N%j!<%8%g%s$@$1$,;2>H2DG=$G!"$=$NA08e$N%F%-%9%H$O;2>H$G$-$J$$$h$&$K(B
$B%+%l%s%H%P%C%U%!$K@)8B$r2]$7$^$9!#(B
$B%]%$%s%H$H%^!<%/$OJQ2=$7$^$;$s!#(B
@kindex C-x n p
@findex narrow-to-page
@kindex C-x n d
@findex narrow-to-defun
@c Alternatively, use @kbd{C-x n p} (@code{narrow-to-page}) to narrow
@c down to the current page. @xref{Pages}, for the definition of a page.
@c @kbd{C-x n d} (@code{narrow-to-defun}) narrows down to the defun
@c containing point (@pxref{Defuns}).
$BJL$N$d$jJ}$H$7$F!"(B@kbd{C-x n p}$B!J(B@code{narrow-to-page}$B!K$O8=:_$N%Z!<%8(B
$B$@$1$,8+$($k$h$&$K%J%m%$%s%0$7$^$9!#(B
$B%Z!<%8$NDj5A$K$D$$$F$O!"(B@xref{Pages}$B!#(B
@kbd{C-x n d}$B!J(B@code{narrow-to-defun}$B!K$O%]%$%s%H$r4^$`4X?tDj5A$NHO0O$K(B
$B%J%m%$%s%0$7$^$9!J(B@pxref{Defuns}$B!K!#(B
@kindex C-x n w
@findex widen
@c The way to cancel narrowing is to widen with @kbd{C-x n w}
@c (@code{widen}). This makes all text in the buffer accessible again.
$B%J%m%$%s%0$r<h$j>C$9$K$O!"(B@kbd{C-x n w}$B$G%o%$%I%K%s%0$7$^$9!#(B
$B$3$l$K$h$C$F%P%C%U%!Cf$NA4%F%-%9%H$,:FEY;2>H2DG=$K$J$j$^$9!#(B
@c You can get information on what part of the buffer you are narrowed down
@c to using the @kbd{C-x =} command. @xref{Position Info}.
$B%P%C%U%!Cf$N$I$NItJ,$K%J%m%$%s%0$7$F$$$k$+$O!"(B
$B%3%^%s%I(B@kbd{C-x =}$B$GD4$Y$k$3$H$,$G$-$^$9!#(B
@xref{Position Info}$B!#(B
@c Because narrowing can easily confuse users who do not understand it,
@c @code{narrow-to-region} is normally a disabled command. Attempting to use
@c this command asks for confirmation and gives you the option of enabling it;
@c if you enable the command, confirmation will no longer be required for
@c it. @xref{Disabling}.
$B%J%m%$%s%0$O!"$=$l$K$D$$$FCN$i$J$$%f!<%6!<$r4JC1$K:.Mp$5$;$^$9$N$G!"(B
@code{narrow-to-region}$B$O!"DL>o!";HMQ6X;_%3%^%s%I$K$J$C$F$$$^$9!#(B
$B$3$N%3%^%s%I$r;H$*$&$H$9$k$H!"(BEmacs$B$O3NG'$r5a$a$F$-$F!"(B
$B%3%^%s%I$r;H$($k$h$&$K$9$k$+$I$&$+Ld$$9g$o$;$F$-$^$9!#(B
$B%3%^%s%I$rMxMQ2DG=$K$9$k$H!"$=$l0J8e$O3NG'$OI,MW$J$/$J$j$^$9!#(B
@xref{Disabling}$B!#(B
@node Two-Column, Editing Binary Files, Narrowing, Top
@c @section Two-Column Editing
@section 2$BCJAH$_JT=8(B
@c @cindex two-column editing
@c @cindex splitting columns
@c @cindex columns, splitting
@cindex 2$BCJAH$_JT=8(B
@cindex $BCJ$NJ,3d(B
@c Two-column mode lets you conveniently edit two side-by-side columns of
@c text. It uses two side-by-side windows, each showing its own
@c buffer.
2$BCJAH$_!J(Btwo-column$B!K%b!<%I$O!":81&$NCJ$KJ,$1$?%F%-%9%H$rJT=8$9$k$N$KJXMx$G$9!#(B
$B$3$N%b!<%I$G$O!":81&$KJB$s$@(B2$B$D$N%&%#%s%I%&$r;HMQ$7!"(B
$B$=$l$>$l$KJL$N%P%C%U%!$rI=<($7$^$9!#(B
@c There are three ways to enter two-column mode:
2$BCJAH$_!J(Btwo-column$B!K%b!<%I$KF~$k$K$O!"(B3$B$D$NJ}K!$,$"$j$^$9!#(B
@table @asis
@c @item @kbd{@key{F2} 2} or @kbd{C-x 6 2}
@item @kbd{@key{F2} 2} $B$^$?$O(B @kbd{C-x 6 2}
@kindex F2 2
@kindex C-x 6 2
@findex 2C-two-columns
@c Enter two-column mode with the current buffer on the left, and on the
@c right, a buffer whose name is based on the current buffer's name
@c (@code{2C-two-columns}). If the right-hand buffer doesn't already
@c exist, it starts out empty; the current buffer's contents are not
@c changed.
$B%+%l%s%H%P%C%U%!$r:8B&$K!"%+%l%s%H%P%C%U%!$NL>A0$K4p$E$$$?L>A0$N(B
$B%P%C%U%!$r1&B&$K$7$F(B2$BCJAH$_!J(Btwo-column$B!K%b!<%I$KF~$k(B
$B!J(B@code{2C-two-columns}$B!K!#(B
$B1&B&$N%P%C%U%!$,$^$@B8:_$7$J$1$l$P6u$N%P%C%U%!$G;O$^$j!"(B
$B%+%l%s%H%P%C%U%!$NFbMF$OJQ2=$7$J$$!#(B
@c This command is appropriate when the current buffer is empty or contains
@c just one column and you want to add another column.
$B$3$N%3%^%s%I$O%+%l%s%H%P%C%U%!$,6u$+!"$^$?$O(B1$BCJL\$NFbMF$@$1$r;}$C$F$$$F!"(B
$B$3$l$+$i(B2$BCJL\$r:n@.$7$h$&$H$9$k$H$-$K;H$&!#(B
@c @item @kbd{@key{F2} s} or @kbd{C-x 6 s}
@item @kbd{@key{F2} s} $B$^$?$O(B @kbd{C-x 6 s}
@kindex F2 s
@kindex C-x 6 s
@findex 2C-split
@c Split the current buffer, which contains two-column text, into two
@c buffers, and display them side by side (@code{2C-split}). The current
@c buffer becomes the left-hand buffer, but the text in the right-hand
@c column is moved into the right-hand buffer. The current column
@c specifies the split point. Splitting starts with the current line and
@c continues to the end of the buffer.
2$BCJAH$_%F%-%9%H$r4^$s$G$$$k%+%l%s%H%P%C%U%!$NFbMF$r(B2$B$D$N%P%C%U%!$KJ,3d$7!"(B
$B$=$l$i$r:81&$KJB$Y$FI=<($9$k!J(B@code{2C-split}$B!K!#(B
$B%+%l%s%H%P%C%U%!$O:8B&$N%P%C%U%!$K$J$k$,!"(B
$B1&B&$NCJ$NFbMF$O1&B&$N%P%C%U%!$K0\$5$l$k!#(B
$BJ,3d0LCV$O%]%$%s%H$N$"$kJ8;z0LCV$G;XDj$9$k!#(B
$B8=:_9T$+$i%P%C%U%!$NKvHx$rJ,3d$9$k!#(B
@c This command is appropriate when you have a buffer that already contains
@c two-column text, and you wish to separate the columns temporarily.
$B$3$N%3%^%s%I$O%P%C%U%!$K$9$G$K(B2$BCJAH$_$N%F%-%9%H$,F~$C$F$$$F!"(B
$B0l;~E*$K:81&$NCJ$rJ,$1$FJT=8$7$?$$$H$-$KMQ$$$k!#(B
@item @kbd{@key{F2} b @var{buffer} @key{RET}}
@itemx @kbd{C-x 6 b @var{buffer} @key{RET}}
@kindex F2 b
@kindex C-x 6 b
@findex 2C-associate-buffer
@c Enter two-column mode using the current buffer as the left-hand buffer,
@c and using buffer @var{buffer} as the right-hand buffer
@c (@code{2C-associate-buffer}).
$B%+%l%s%H%P%C%U%!$r:8B&$N%P%C%U%!!"(B@var{buffer}$B$r1&B&$N%P%C%U%!$H$7$F(B
2$BCJAH$_!J(Btwo-column$B!K%b!<%I$KF~$k!J(B@code{2C-associate-buffer}$B!K!#(B
@end table
@c @kbd{@key{F2} s} or @kbd{C-x 6 s} looks for a column separator, which
@c is a string that appears on each line between the two columns. You can
@c specify the width of the separator with a numeric argument to
@c @kbd{@key{F2} s}; that many characters, before point, constitute the
@c separator string. By default, the width is 1, so the column separator
@c is the character before point.
@kbd{@key{F2} s}$B$H(B@kbd{C-x 6 s}$B$O!"(B
$B3F9T$r(B2$B$D$NCJ$KJ,$1$kJ8;zNs$G$"$k!VCJ6h@Z$jJ8;zNs!W$rC5$7$^$9!#(B
$BCJ6h@Z$jJ8;zNs$NJ8;z?t$O!"(B@kbd{@key{F2} s}$B$X$N?t0z?t$G;XDj$G$-$^$9!#(B
$B%]%$%s%H$ND>A0$N$=$NJ8;z?tJ,$NJ8;zNs$,CJ6h@Z$jJ8;zNs$K$J$j$^$9!#(B
$B%G%U%)%k%H$G$OI}$O(B1$B$G$9$+$i!"%]%$%s%H$ND>A0$NJ8;z$,CJ6h@Z$jJ8;zNs$K$J$j$^$9!#(B
@c When a line has the separator at the proper place, @kbd{@key{F2} s}
@c puts the text after the separator into the right-hand buffer, and
@c deletes the separator. Lines that don't have the column separator at
@c the proper place remain unsplit; they stay in the left-hand buffer, and
@c the right-hand buffer gets an empty line to correspond. (This is the
@c way to write a line that ``spans both columns while in two-column
@c mode'': write it in the left-hand buffer, and put an empty line in the
@c right-hand buffer.)
$B3F9T$N@5$7$$0LCV$KCJ6h@Z$jJ8;zNs$,$"$l$P!"(B
@kbd{@key{F2} s}$B$O3F9T$NCJ6h@Z$jJ8;zNs$N$&$7$m$NJ8;zNs$r1&B&$N%P%C%U%!$K0\$7!"(B
$BCJ6h@Z$jJ8;zNs$r:o=|$7$^$9!#(B
$BCJ6h@Z$jJ8;zNs$,@5$7$$0LCV$K$J$$9T$OJ,3d$5$l$:$K:8B&$N%P%C%U%!$K;D$j!"(B
$BBP1~$9$k1&B&$N%P%C%U%!$NFbMF$O6u9T$K$J$j$^$9!#(B
$B!J$3$l$O!"!X(B2$BCJAH$_!J(Btwo-column$B!K%b!<%I$GN>B&$NCJ$K$^$?$,$C$?9T!Y$N=q$-J}!#(B
$B$D$^$j!":8B&$N%P%C%U%!$K$=$N$h$&$J9T$r=q$-!"(B
$B1&B&$N%P%C%U%!$O6u9T$K$7$F$*$/!K!#(B
@kindex F2 RET
@kindex C-x 6 RET
@findex 2C-newline
@c The command @kbd{C-x 6 @key{RET}} or @kbd{@key{F2} @key{RET}}
@c (@code{2C-newline}) inserts a newline in each of the two buffers at
@c corresponding positions. This is the easiest way to add a new line to
@c the two-column text while editing it in split buffers.
$B%3%^%s%I(B@kbd{C-x 6 @key{RET}}$B$d(B@kbd{@key{F2} @key{RET}}
$B!J(B@code{2C-newline}$B!K$O!"(B
$B:81&$N(B2$B$D$N%P%C%U%!$NBP1~$9$k0LCV$K2~9T$rA^F~$7$^$9!#(B
$B%P%C%U%!$rJ,3d$7$FJT=8$7$F$$$k$H$-$K(B2$BCJAH$_%F%-%9%H$K(B
$B?7$7$$9T$rDI2C$9$k$K$O$3$l$,$b$C$H$b4JC1$JJ}K!$G$9!#(B
@kindex F2 1
@kindex C-x 6 1
@findex 2C-merge
@c When you have edited both buffers as you wish, merge them with
@c @kbd{@key{F2} 1} or @kbd{C-x 6 1} (@code{2C-merge}). This copies the
@c text from the right-hand buffer as a second column in the other buffer.
@c To go back to two-column editing, use @kbd{@key{F2} s}.
$B:81&$N%P%C%U%!$rK>$`$h$&$KJT=8$7=*$($?$i!"(B
$B$=$l$i$r(B@kbd{@key{F2} 1}$B$^$?$O(B@kbd{C-x 6 1}$B!J(B@code{2C-merge}$B!K$G(B
$B:FEYJ;9g$7$^$9!#(B
$B1&B&%P%C%U%!$NFbMF$r:8B&%P%C%U%!$KBh(B2$BCJL\$H$7$F%3%T!<$7$^$9!#(B
$B:FEY(B2$BCJAH$_JT=8$KLa$k$K$O!"(B@kbd{@key{F2} s}$B$r;H$$$^$9!#(B
@kindex F2 d
@kindex C-x 6 d
@findex 2C-dissociate
@c Use @kbd{@key{F2} d} or @kbd{C-x 6 d} to dissociate the two buffers,
@c leaving each as it stands (@code{2C-dissociate}). If the other buffer,
@c the one not current when you type @kbd{@key{F2} d}, is empty,
@c @kbd{@key{F2} d} kills it.
2$B$D$N%P%C%U%!4V$N4XO"$r2r>C$9$k$K$O!"(B
@kbd{@key{F2} d}$B$^$?$O(B@kbd{C-x 6 d}$B!J(B@code{2C-dissociate}$B!K$r;H$$$^$9!#(B
$B%3%^%s%I$rF~NO$7$?$H$-$K%+%l%s%H%P%C%U%!$G$J$$B&$N%P%C%U%!$,6u$G$"$l$P!"(B
$B$=$N%P%C%U%!$O:o=|$7$^$9!#(B
@node Editing Binary Files, Saving Emacs Sessions, Two-Column, Top
@c @section Editing Binary Files
@section $B%P%$%J%j%U%!%$%k$NJT=8(B
@c @cindex Hexl mode
@c @cindex mode, Hexl
@c @cindex editing binary files
@cindex hexl$B%b!<%I(B
@cindex $B%b!<%I!"(Bhexl
@cindex $B%P%$%J%j%U%!%$%k$NJT=8(B
@c There is a special major mode for editing binary files: Hexl mode. To
@c use it, use @kbd{M-x hexl-find-file} instead of @kbd{C-x C-f} to visit
@c the file. This command converts the file's contents to hexadecimal and
@c lets you edit the translation. When you save the file, it is converted
@c automatically back to binary.
$B%P%$%J%j%U%!%$%k$rJT=8$9$k$?$a$NFCJL$J%a%8%c!<%b!<%I!"(B
hexl$B%b!<%I$,$"$j$^$9!#(B
$B$3$N%b!<%I$r;H$&$K$O!"%U%!%$%k$rK,Ld$9$k(B@kbd{C-x C-f}$B$N$+$o$j$K(B
@kbd{M-x hexl-find-file}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O%U%!%$%k$NFbMF$r(B16$B?J?tI=8=$KJQ49$7!"(B
$BJQ49$7$?$b$N$rJT=8$9$k$h$&$K$7$^$9!#(B
$B%U%!%$%k$rJ]B8$9$k$H<+F0E*$K%P%$%J%j$KLa$5$l$^$9!#(B
@c You can also use @kbd{M-x hexl-mode} to translate an existing buffer
@c into hex. This is useful if you visit a file normally and then discover
@c it is a binary file.
@kbd{M-x hexl-mode}$B$r;H$($P!"4{B8$N%P%C%U%!$r(B16$B?J?tI=8=$KJQ49$G$-$^$9!#(B
$BIaDL$K%U%!%$%k$rK,Ld$7$F$_$?$i!"<B$O%P%$%J%j%U%!%$%k$@$H$o$+$C$?>l9g$KJXMx$G$9!#(B
@c Ordinary text characters overwrite in Hexl mode. This is to reduce
@c the risk of accidentally spoiling the alignment of data in the file.
@c There are special commands for insertion. Here is a list of the
@c commands of Hexl mode:
hexl$B%b!<%I$G$ODL>o$N%F%-%9%HJ8;z$O>e=q$-$7$^$9!#(B
$B$3$l$O%U%!%$%kCf$N%G!<%?$NG[CV$r$^$A$,$C$F2u$7$F$7$^$&4m81$r8:$i$9$?$a$G$9!#(B
$BFCJL$JA^F~%3%^%s%I$,$"$j$^$9!#(B
$B0J2<$O!"(Bhexl$B%b!<%I$G;H$($k%3%^%s%I$N0lMw$G$9!#(B
@c I don't think individual index entries for these commands are useful--RMS.
@table @kbd
@item C-M-d
@c Insert a byte with a code typed in decimal.
10$B?t?J$GF~NO$7$?%3!<%I$N%P%$%H$rA^F~$9$k!#(B
@item C-M-o
@c Insert a byte with a code typed in octal.
8$B?t?J$GF~NO$7$?%3!<%I$N%P%$%H$rA^F~$9$k!#(B
@item C-M-x
@c Insert a byte with a code typed in hex.
16$B?t?J$GF~NO$7$?%3!<%I$N%P%$%H$rA^F~$9$k!#(B
@item C-x [
@c Move to the beginning of a 1k-byte ``page.''
1k$B%P%$%HC10L$N!X%Z!<%8!Y$N@hF,$X0\F0$9$k!#(B
@item C-x ]
@c Move to the end of a 1k-byte ``page.''
1k$B%P%$%HC10L$N!X%Z!<%8!Y$NKvHx$X0\F0$9$k!#(B
@item M-g
@c Move to an address specified in hex.
16$B?J?t$G;XDj$7$?%"%I%l%90LCV$X0\F0$9$k!#(B
@item M-j
@c Move to an address specified in decimal.
10$B?J?t$G;XDj$7$?%"%I%l%90LCV$X0\F0$9$k!#(B
@item C-c C-c
@c Leave Hexl mode, going back to the major mode this buffer had before you
@c invoked @code{hexl-mode}.
hexl$B%b!<%I$rH4$1!"(B
@code{hexl-mode}$B<B9TA0$N$3$N%P%C%U%!$N%a%8%c!<%b!<%I$KLa$k!#(B
@end table
@node Saving Emacs Sessions, Recursive Edit, Editing Binary Files, Top
@c @section Saving Emacs Sessions
@section Emacs$B%;%C%7%g%s$NJ]B8(B
@c @cindex saving sessions
@c @cindex desktop
@cindex $B%;%C%7%g%s$NJ]B8(B
@cindex $B%G%9%/%H%C%W(B
@c You can use the Desktop library to save the state of Emacs from one
@c session to another. Saving the state means that Emacs starts up with
@c the same set of buffers, major modes, buffer positions, and so on that
@c the previous Emacs session had.
$B%G%9%/%H%C%W!J(Bdesktop$B!K%i%$%V%i%j$r;H$&$H!"(B
$B%;%C%7%g%s$+$i%;%C%7%g%s$X(BEmacs$B$N>uBV$rJ]B8$G$-$^$9!#(B
$B>uBV$rJ]B8$9$k$H$$$&$N$O!"(B
$B0JA0$N(BEmacs$B%;%C%7%g%s$G;H$C$F$$$?$N$HF1$8%P%C%U%!72!"%a%8%c!<%b!<%I!"(B
$B%P%C%U%!Fb$N0LCV$N>uBV$G(BEmacs$B$,;O$^$k$H$$$&0UL#$G$9!#(B
@vindex desktop-enable
@c To use Desktop, you should use the Customization buffer (@pxref{Easy
@c Customization}) to set @code{desktop-enable} to a non-@code{nil} value,
@c or add these lines at the end of your @file{.emacs} file:
$B%G%9%/%H%C%W5!G=$r;H$&$K$O!"%+%9%?%^%$%:%P%C%U%!(B
$B!J(B@pxref{Easy Customization}$B!K$r;H$C$F(B
@code{desktop-enable}$B$K(B@code{nil}$B0J30$NCM$r@_Dj$9$k$+!"(B
$B8D?M$N(B@file{.emacs}$B%U%!%$%k$NKvHx$K0J2<$N$h$&$J9T$rDI2C$7$^$9!#(B
@example
(desktop-load-default)
(desktop-read)
@end example
@noindent
@findex desktop-save
@c The first time you save the state of the Emacs session, you must do it
@c manually, with the command @kbd{M-x desktop-save}. Once you have done
@c that, exiting Emacs will save the state again---not only the present
@c Emacs session, but also subsequent sessions. You can also save the
@c state at any time, without exiting Emacs, by typing @kbd{M-x
@c desktop-save} again.
$B%f!<%6!<$,:G=i$K(BEmacs$B%;%C%7%g%s$N>uBV$rJ]B8$9$k$H$-$O!"(B
@kbd{M-x desktop-save}$B$GM[$K>uBV$rJ]B8$9$kI,MW$,$"$j$^$9!#(B
$B0lEY$3$l$r9T$C$F$*$1$P!"(BEmacs$B$r=*$o$k$H$-$K(B
$B!J8=:_$N%;%C%7%g%s$@$1$G$J$/!"$=$l0J9_$N%;%C%7%g%s$G$b!K(B
$B<+F0E*$K>uBV$rJ]B8$7$^$9!#(B
$B$^$?!"(BEmacs$B$r=*$o$i$;$k$3$H$J$/G$0U$N;~E@$G>uBV$rJ]B8$9$k$K$O!"(B
@kbd{M-x desktop-save}$B$r;H$$$^$9!#(B
@c In order for Emacs to recover the state from a previous session, you
@c must start it with the same current directory as you used when you
@c started the previous session. This is because @code{desktop-read} looks
@c in the current directory for the file to read. This means that you can
@c have separate saved sessions in different directories; the directory in
@c which you start Emacs will control which saved session to use.
Emacs$B$,$^$($N%;%C%7%g%s$N>uBV$r0z$-7Q$0$?$a$K$O!"(B
$B$^$($N%;%C%7%g%s$r3+;O$7$?$H$-$HF1$8%+%l%s%H%G%#%l%/%H%j$G(B
Emacs$B$r5/F0$9$kI,MW$,$"$j$^$9!#(B
$B$3$l$O!"(B@code{desktop-read}$B$,FI$_9~$`%U%!%$%k$r%+%l%s%H%G%#%l%/%H%j$G(B
$BC5$9$+$i$G$9!#(B
$B$D$^$j!"0[$J$k%G%#%l%/%H%j$4$H$KJL$N%;%C%7%g%s$rJ]B8$G$-$k$3$H$r0UL#$7$^$9!#(B
Emacs$B$r5/F0$9$k%G%#%l%/%H%j$G!"(B
$BJ]B8$7$?$I$N%;%C%7%g%s$r;H$&$+@)8f$G$-$^$9!#(B
@vindex desktop-files-not-to-save
@c The variable @code{desktop-files-not-to-save} controls which files are
@c excluded from state saving. Its value is a regular expression that
@c matches the files to exclude. By default, remote (ftp-accessed) files
@c are excluded; this is because visiting them again in the subsequent
@c session would be slow. If you want to include these files in state
@c saving, set @code{desktop-files-not-to-save} to @code{"^$"}.
@c @xref{Remote Files}.
$BJQ?t(B@code{desktop-files-not-to-save}$B$O!"(B
$B>uBVJ]B8$+$i=|30$9$k%U%!%$%k$r@)8f$7$^$9!#(B
$B$3$NJQ?t$NCM$O!"=|30$7$?$$%U%!%$%k$K0lCW$9$k@55,I=8=$G$9!#(B
$B%G%U%)%k%H$G$O!"!J(Bftp$B$G<h$C$F$-$?!K%j%b!<%H%U%!%$%k$r=|30$7$^$9!#(B
$B$3$l$O%j%b!<%H%U%!%$%k$r:FEY<h$C$F$/$k$H%;%C%7%g%s$N3+;O$,CY$/$J$k$+$i$G$9!#(B
$B%j%b!<%H%U%!%$%k$b>uBVJ]B8$K4^$a$k$K$O!"(B
@code{desktop-files-not-to-save}$B$K(B
@code{"^$"}$B$H@_Dj$7$^$9!#(B
@xref{Remote Files}$B!#(B
@node Recursive Edit, Emulation, Saving Emacs Sessions, Top
@c @section Recursive Editing Levels
@section $B:F5"JT=8%l%Y%k(B
@c @cindex recursive editing level
@c @cindex editing level, recursive
@cindex $B:F5"JT=8%l%Y%k(B
@c A @dfn{recursive edit} is a situation in which you are using Emacs
@c commands to perform arbitrary editing while in the middle of another
@c Emacs command. For example, when you type @kbd{C-r} inside of a
@c @code{query-replace}, you enter a recursive edit in which you can change
@c the current buffer. On exiting from the recursive edit, you go back to
@c the @code{query-replace}.
@dfn{$B:F5"JT=8(B}$B$H$O!"$"$k(BEmacs$B%3%^%s%I$N<B9TESCf$G(B
$BG$0U$N(BEmacs$B%3%^%s%I$r;H$C$FJT=8$r9T$&>u67$r$$$$$^$9!#(B
$B$?$H$($P!"(B@code{query-replace}$B$NESCf$G(B@kbd{C-r}$B$rBG$D$H!"(B
$B:F5"JT=8$KF~$j%+%l%s%H%P%C%U%!$r<+M3$KJQ99$G$-$^$9!#(B
$B:F5"JT=8$+$iH4$1$k$H!"(B@code{query-replace}$B$NB3$-$KLa$j$^$9!#(B
@kindex C-M-c
@findex exit-recursive-edit
@c @cindex exiting recursive edit
@cindex $B:F5"JT=8$+$i$NC&=P(B
@c @dfn{Exiting} the recursive edit means returning to the unfinished
@c command, which continues execution. The command to exit is @kbd{C-M-c}
@c (@code{exit-recursive-edit}).
$B:F5"JT=8$+$i(B@dfn{$BC&=P(B}$B$9$k$H$O!"(B
$B<B9TESCf$N%3%^%s%I$KLa$C$F$=$NB3$-$r9T$&$3$H$r0UL#$7$^$9!#(B
$BC&=P$N$?$a$N%3%^%s%I$O(B@kbd{C-M-c}$B!J(B@code{exit-recursive-edit}$B!K$G$9!#(B
@c You can also @dfn{abort} the recursive edit. This is like exiting,
@c but also quits the unfinished command immediately. Use the command
@c @kbd{C-]} (@code{abort-recursive-edit}) to do this. @xref{Quitting}.
$B:F5"JT=8$r(B@dfn{$B%"%\!<%H(B}$B$9$k$3$H$b$G$-$^$9!#(B
$B$3$l$OC&=P$H;w$F$$$^$9$,!"<B9TESCf$@$C$?%3%^%s%I$b0l=o$KCfCG$7$^$9!#(B
$B%"%\!<%H$9$k$K$O!"(B
@kbd{C-]}$B!J(B@code{abort-recursive-edit}$B!K$r;H$$$^$9!#(B
@xref{Quitting}$B!#(B
@c The mode line shows you when you are in a recursive edit by displaying
@c square brackets around the parentheses that always surround the major and
@c minor mode names. Every window's mode line shows this, in the same way,
@c since being in a recursive edit is true of Emacs as a whole rather than
@c any particular window or buffer.
$B:F5"JT=8Cf$O!"%b!<%I9T$N%a%8%c!<!?%^%$%J%b!<%IL>$r(B
$B0O$`4]3g8L$N30B&$KCf3g8L(B@samp{[@dots{}]}$B$,I=<($5$l$^$9!#(B
$B3F%&%#%s%I%&$N%b!<%I9T$9$Y$F$K$3$N$h$&$KI=<($5$l$^$9!#(B
$B$H$$$&$N$O!"FCDj$N%&%#%s%I%&$d%P%C%U%!$G$O$J$/(BEmacs$BA4BN$,:F5"JT=8$K(B
$BF~$C$F$$$k$+$i$G$9!#(B
@c It is possible to be in recursive edits within recursive edits. For
@c example, after typing @kbd{C-r} in a @code{query-replace}, you may type a
@c command that enters the debugger. This begins a recursive editing level
@c for the debugger, within the recursive editing level for @kbd{C-r}.
@c Mode lines display a pair of square brackets for each recursive editing
@c level currently in progress.
$B:F5"JT=8Cf$K$5$i$K:F5"JT=8$KF~$k$3$H$b$G$-$^$9!#(B
$B$?$H$($P!"(B@code{query-replace}$B$NESCf$G(B@kbd{C-r}$B$rBG$C$F$+$i(B
$B%G%P%C%,$r5/F0$9$k%3%^%s%I$rBG$C$?$H$7$^$9!#(B
$B$9$k$H!"(B@kbd{C-r}$B$K$h$k:F5"JT=8$NCf$G$5$i$K%G%P%C%,$N$?$a$N:F5"JT=8$K(B
$BF~$k$3$H$K$J$j$^$9!#(B
$B%b!<%I9T$K$O!"8=:_$N:F5"JT=8%l%Y%k$N?t$@$1Cf3g8L$NBP$,I=<($5$l$^$9!#(B
@c Exiting the inner recursive edit (such as, with the debugger @kbd{c}
@c command) resumes the command running in the next level up. When that
@c command finishes, you can then use @kbd{C-M-c} to exit another recursive
@c editing level, and so on. Exiting applies to the innermost level only.
@c Aborting also gets out of only one level of recursive edit; it returns
@c immediately to the command level of the previous recursive edit. If you
@c wish, you can then abort the next recursive editing level.
$BFbB&$N:F5"JT=8$r!J$?$H$($P%G%P%C%,$N%3%^%s%I(B@kbd{c}$B$G!KC&=P$9$k$H!"(B
1$B$D>e$N%l%Y%k$G$N%3%^%s%I$,:F3+$5$l$^$9!#(B
$B$=$N%3%^%s%I$,=*$o$C$?$H$3$m$G(B@kbd{C-M-c}$B$r;H$&$H(B
$B$=$N%l%Y%k$N:F5"JT=8$rC&=P$9$k!"(B
$B$H$$$&$h$&$K$7$F:F5"JT=8$r=*$o$i$;$F$$$/$3$H$,$G$-$^$9!#(B
$BC&=P$O$D$M$K$b$C$H$bFbB&$N%l%Y%k$KBP$7$F5/$3$j$^$9!#(B
$B$^$?!"%"%\!<%H$b(B1$B$D$N%l%Y%k$N:F5"JT=8$+$iC&=P$7!"(B
1$B$D$^$($N:F5"JT=8$N%3%^%s%I%l%Y%k$KLa$j$^$9!#(B
$BI,MW$J$i$=$3$G$D$.$N:F5"JT=8%l%Y%k$r%"%\!<%H$9$k!"(B
$B$H$$$&$h$&$KB3$1$k$3$H$,$G$-$^$9!#(B
@c Alternatively, the command @kbd{M-x top-level} aborts all levels of
@c recursive edits, returning immediately to the top-level command reader.
$B$"$k$$$O!"(B
$B%3%^%s%I(B@kbd{M-x top-level}$B$G$9$Y$F$N%l%Y%k$N:F5"JT=8$r%"%\!<%H$7!"(B
$B$?$@$A$K%H%C%W%l%Y%k$N%3%^%s%IF~NO$KLa$k$3$H$,$G$-$^$9!#(B
@c The text being edited inside the recursive edit need not be the same text
@c that you were editing at top level. It depends on what the recursive edit
@c is for. If the command that invokes the recursive edit selects a different
@c buffer first, that is the buffer you will edit recursively. In any case,
@c you can switch buffers within the recursive edit in the normal manner (as
@c long as the buffer-switching keys have not been rebound). You could
@c probably do all the rest of your editing inside the recursive edit,
@c visiting files and all. But this could have surprising effects (such as
@c stack overflow) from time to time. So remember to exit or abort the
@c recursive edit when you no longer need it.
$B:F5"JT=8$NCf$GJT=8$7$F$$$k%F%-%9%H$O(B
$B%H%C%W%l%Y%k$GJT=8$7$F$$$k%F%-%9%H$HF1$8$G$"$k$H$O8B$j$^$;$s!#(B
$B:F5"JT=8$NL\E*$K$h$C$FJQ$o$C$F$-$^$9!#(B
$B:F5"JT=8$r5/F0$9$k%3%^%s%I$,$^$:JL$N%P%C%U%!$K@Z$jBX$($k$b$N$J$i!"(B
$B$=$N%P%C%U%!$r:F5"E*$KJT=8$9$k$3$H$K$J$k$G$7$g$&!#(B
$B$$$:$l$K$;$h!":F5"JT=8$NFbB&$G$b(B
$B!J%P%C%U%!$r@Z$jBX$($k%-!<$,:FDj5A$5$l$F$$$J$$8B$j!K(B
$BDL>o$I$*$j%P%C%U%!$r@Z$jBX$($k$3$H$,$G$-$^$9!#(B
$B;D$j$NJT=8:n6H$r$9$Y$F:F5"JT=8$NFbB&$G$d$C$F$7$^$$!"(B
$BJL$N%U%!%$%k$rK,Ld$7$?$j$b$G$-$^$9!#(B
$B$7$+$7$=$N$h$&$J$3$H$r$9$k$H!"(B
$B$H$-$I$-!J%9%?%C%/%*!<%P!<%U%m!<$J$I$N!KDK$$L\$K9g$&2DG=@-$,$"$j$^$9!#(B
$B$G$9$+$i!":F5"JT=8$,ITMW$K$J$C$?$iK:$l$:$KC&=P$+%"%\!<%H$7$F$/$@$5$$!#(B
@c In general, we try to minimize the use of recursive editing levels in
@c GNU Emacs. This is because they constrain you to ``go back'' in a
@c particular order---from the innermost level toward the top level. When
@c possible, we present different activities in separate buffers so that
@c you can switch between them as you please. Some commands switch to a
@c new major mode which provides a command to switch back. These
@c approaches give you more flexibility to go back to unfinished tasks in
@c the order you choose.
$B0lHL$K!"(BGNU Emacs$B$G$O:F5"JT=8%l%Y%k$r:G>.8B$KM^$($k$h$&$KEX$a$F$$$^$9!#(B
$B$H$$$&$N$O!":F5"JT=8$G$OFCDj$N=g!"$D$^$j!"(B
$B:GFbB&%l%Y%k$+$i%H%C%W%l%Y%k$K8~$+$&=g$GLa$k$h$&$K6/$$$i$l$k$+$i$G$9!#(B
$B$3$N$?$a!"JL$N:n6H$OJL$N%P%C%U%!$G$9$k$h$&$K$7$F!"(B
$B%f!<%6!<$,$=$l$i$N4V$r<+M3$K9T$-Mh$G$-$k$h$&$K$7$F$$$^$9!#(B
$B$?$H$($P!"$"$k%3%^%s%I$O?7$7$$%a%8%c!<%b!<%I$K@Z$jBX$($^$9$,!"(B
$B$b$H$N%b!<%I$KLa$k%3%^%s%I$rMQ0U$7$F$*$-$^$9!#(B
$B$3$N$h$&$K$7$?$[$&$,!"$d$j$+$1$N:n6H$KLa$k=gHV$r<+M3$KA*$Y!"(B
$B=@Fp@-$rDs6!$G$-$^$9!#(B
@node Emulation, Dissociated Press, Recursive Edit, Top
@c @section Emulation
@section $B%(%_%e%l!<%7%g%s(B
@c @cindex emulating other editors
@c @cindex other editors
@cindex $BB>$N%(%G%#%?$N%(%_%e%l!<%7%g%s(B
@cindex $BB>$N%(%G%#%?(B
@cindex EDT
@cindex vi
@c GNU Emacs can be programmed to emulate (more or less) most other
@c editors. Standard facilities can emulate these:
GNU Emacs$B$O!"B>$N$[$H$s$I$N%(%G%#%?$N!JDxEY$N:9$O$"$j$^$9$,!K(B
$B%(%_%e%l!<%H!J??;w$r!K$9$k$h$&$K%W%m%0%i%`$G$-$^$9!#(B
$BI8=`$N5!G=$G$O!"0J2<$N$b$N$r%(%_%e%l!<%H$G$-$^$9!#(B
@table @asis
@c @item EDT (DEC VMS editor)
@item EDT$B!J(BDEC$B$N(BVMS$B%(%G%#%?!K(B
@findex edt-emulation-on
@findex edt-emulation-off
@c Turn on EDT emulation with @kbd{M-x edt-emulation-on}. @kbd{M-x
@c edt-emulation-off} restores normal Emacs command bindings.
@kbd{M-x edt-emulation-on}$B$G(BEDT$B%(%_%e%l!<%7%g%s$KF~$k!#(B
@kbd{M-x edt-emulation-off}$B$GDL>o$N(BEmacs$B$N%P%$%s%G%#%s%0$KLa$k!#(B
@c Most of the EDT emulation commands are keypad keys, and most standard
@c Emacs key bindings are still available. The EDT emulation rebindings
@c are done in the global keymap, so there is no problem switching
@c buffers or major modes while in EDT emulation.
EDT$B%(%_%e%l!<%7%g%s%3%^%s%I$NBgItJ,$O%-!<%Q%C%I$N%-!<$G$"$j!"(B
$BBgItJ,$N(BEmacs$B$N%-!<%P%$%s%G%#%s%0$O$=$N$^$^;H$($k!#(B
EDT$B%(%_%e%l!<%7%g%s$N%P%$%s%G%#%s%0JQ99$O%0%m!<%P%k%-!<%^%C%W$KBP$7$F9T$o$l!"(B
EDT$B%(%_%e%l!<%7%g%s$N>uBV$G%P%C%U%!$d%a%8%c!<%b!<%I$r@Z$jBX$($F$bLdBj$J$$!#(B
@c @item vi (Berkeley editor)
@item vi $B!J%P!<%/%l!<(B $B%(%G%#%?!K(B
@findex viper-mode
@c Viper is the newest emulator for vi. It implements several levels of
@c emulation; level 1 is closest to vi itself, while level 5 departs
@c somewhat from strict emulation to take advantage of the capabilities of
@c Emacs. To invoke Viper, type @kbd{M-x viper-mode}; it will guide you
@c the rest of the way and ask for the emulation level. @inforef{Top,
@c Viper, viper}.
viper$B$O:G?7$N(Bvi$B%(%_%e%l!<%?$G$"$k!#(B
viper$B$G$OJ#?t%l%Y%k$N%(%_%e%l!<%7%g%s$r<BAu$7$F$$$k!#(B
$B%l%Y%k(B1$B$,$b$C$H$b(Bvi$B$K6a$/!"%l%Y%k(B5$B$O(Bvi$B$H$$$/$i$+0c$&$H$3$m$b$"$k$,!"(B
$B$=$N$+$o$j(BEmacs$B$N5!G=$b3h$+$;$k$h$&$K$J$C$F$$$k!#(B
viper$B$r5/F0$9$k$K$O!"(B@kbd{M-x viper-mode}$B$HBG$D!#(B
$B$9$k$H!";H$$J}$N%,%$%I$rI=<($7!"(B
$B$I$N%l%Y%k$N%(%_%e%l!<%7%g%s$K$9$k$+$r?R$M$F$/$k!#(B
@inforef{Top, Viper, viper}$B!#(B
@c @item vi (another emulator)
@item vi $B!J$b$&(B1$B$D$N%(%_%e%l!<%?!K(B
@findex vi-mode
@c @kbd{M-x vi-mode} enters a major mode that replaces the previously
@c established major mode. All of the vi commands that, in real vi, enter
@c ``input'' mode are programmed instead to return to the previous major
@c mode. Thus, ordinary Emacs serves as vi's ``input'' mode.
@kbd{M-x vi-mode}$B$O$=$l$^$G$N%a%8%c!<%b!<%I$K$+$o$C$F(B
vi$B%a%8%c!<%b!<%I$KF~$k!#(B
vi$B$N!XF~NO!Y%b!<%I$KF~$k%3%^%s%I$O$9$Y$F!"(B
$B$=$l$^$G$N%a%8%c!<%b!<%I$KLa$kF0:n$K$J$C$F$$$k!#(B
$B$D$^$j!"(Bvi$B$N!XF~NO!Y%b!<%I$H$7$FIaDL$N(BEmacs$B$,;H$($k$N$G$"$k!#(B
@c Because vi emulation works through major modes, it does not work
@c to switch buffers during emulation. Return to normal Emacs first.
vi$B%(%_%e%l!<%7%g%s$O%a%8%c!<%b!<%I$H$7$FF0$/$N$G!"(B
$B%(%_%e%l!<%7%g%sCf$K%P%C%U%!$r@Z$jBX$($k$3$H$O$G$-$J$$!#(B
$B%P%C%U%!$r@Z$jBX$($?$1$l$P!"$^$:DL>o$N(BEmacs$B$KLa$k!#(B
@c If you plan to use vi emulation much, you probably want to bind a key
@c to the @code{vi-mode} command.
vi$B%(%_%e%l!<%7%g%s$rB?MQ$9$k$D$b$j$J$i!"(B
@code{vi-mode}$B%3%^%s%I$K%-!<$r%P%$%s%I$7$?$[$&$,$h$$$@$m$&!#(B
@c @item vi (alternate emulator)
@item vi $B!J$^$?JL$N%(%_%e%l!<%?!K(B
@findex vip-mode
@c @kbd{M-x vip-mode} invokes another vi emulator, said to resemble real vi
@c more thoroughly than @kbd{M-x vi-mode}. ``Input'' mode in this emulator
@c is changed from ordinary Emacs so you can use @key{ESC} to go back to
@c emulated vi command mode. To get from emulated vi command mode back to
@c ordinary Emacs, type @kbd{C-z}.
@kbd{M-x vip-mode}$B$O!"(B@kbd{M-x vi-mode}$B$h$j$b$C$H(B
vi$B$K9s;w$7$F$$$k$H$$$o$l$kJL$N(Bvi$B%(%_%e%l!<%?$r5/F0$9$k!#(B
$B$3$N%(%_%e%l!<%?$G$O!XF~NO!Y%b!<%I$bDL>o$N(BEmacs$B$H$OJQ$o$C$F$$$F!"(B
@key{ESC}$B$G(Bvi$B%3%^%s%I%b!<%I$KLa$k!#(B
vi$B%3%^%s%I%b!<%I$N%(%_%e%l!<%7%g%s$+$iDL>o$N(BEmacs$B$KLa$k$K$O(B@kbd{C-z}$B$HBG$D!#(B
@c This emulation does not work through major modes, and it is possible
@c to switch buffers in various ways within the emulator. It is not
@c so necessary to assign a key to the command @code{vip-mode} as
@c it is with @code{vi-mode} because terminating insert mode does
@c not use it.
$B$3$N%(%_%e%l!<%?$O%a%8%c!<%b!<%I$H$7$FF0$/$N$G$O$J$$$N$G!"(B
$B%(%_%e%l!<%?$rF0$+$7$?$^$^$5$^$6$^$JJ}K!$G%P%C%U%!$r@Z$jBX$($k$3$H$,$G$-$k!#(B
@code{vi-mode}$B$N$h$&$K%3%^%s%I(B@code{vi-mode}$B$G(B
$BF~NO%b!<%I$r=*N;$9$k$N$G$O$J$$$N$G!"(B
@code{vip-mode}$B$K%-!<$r3d$jEv$F$kI,MW$O$J$$!#(B
@c @inforef{Top, VIP, vip}, for full information.
$B$h$j>\$7$/$O(B@inforef{Top, VIP, vip}$B!#(B
@end table
@node Dissociated Press, Amusements, Emulation, Top
@c @section Dissociated Press
@section $B$^$<$3$<?7J9!J(BDissociated Press$B!K(B
@findex dissociated-press
@c @kbd{M-x dissociated-press} is a command for scrambling a file of text
@c either word by word or character by character. Starting from a buffer of
@c straight English, it produces extremely amusing output. The input comes
@c from the current Emacs buffer. Dissociated Press writes its output in a
@c buffer named @samp{*Dissociation*}, and redisplays that buffer after every
@c couple of lines (approximately) so you can read the output as it comes out.
@kbd{M-x dissociated-press}$B$O%F%-%9%H$r!"C18lC10L!"$^$?$O!"J8;zC10L$G(B
$B:.$<9g$o$;$k%3%^%s%I$G$9!#(B
$BIaDL$N1Q8l$r%P%C%U%!$KF~$l$?>uBV$G$3$l$r<B9T$9$k$H!"(B
$B$-$o$a$F$*$b$7$m$$7k2L$,@8@.$5$l$^$9!#(B
$BF~NO$O%+%l%s%H%P%C%U%!$+$i<h$j!"(B
$B=PNO$O(B@samp{*Dissociation*}$B$H$$$&%P%C%U%!$K=q$-9~$_$^$9(B
$B!J$*$h$=(B2$B!"(B3$B9T@8@.$9$k$4$H$K%P%C%U%!$,:FI=<($5$l$k$N$G!"(B
$B@8@.FbMF$r=g<!FI$a$^$9!K!#(B
@c Dissociated Press asks every so often whether to continue generating
@c output. Answer @kbd{n} to stop it. You can also stop at any time by
@c typing @kbd{C-g}. The dissociation output remains in the
@c @samp{*Dissociation*} buffer for you to copy elsewhere if you wish.
@kbd{M-x dissociated-press}$B$ODj4|E*$K$b$C$H=PNO$rB3$1$k$+$I$&$+J9$$$F$-$^$9!#(B
@kbd{n}$B$HEz$($k$H@8@.$r$d$a$^$9!#(B
$B$^$?!"(B@kbd{C-g}$B$rBG$F$P$$$D$G$b;_$a$i$l$^$9!#(B
$B=PNO$O%P%C%U%!(B@samp{*Dissociation*}$B$K;D$C$F$$$^$9$+$i!"(B
$BI,MW$J$i$I$3$X$G$b%3%T!<$G$-$^$9!#(B
@c @cindex presidentagon
@c Dissociated Press operates by jumping at random from one point in the
@c buffer to another. In order to produce plausible output rather than
@c gibberish, it insists on a certain amount of overlap between the end of
@c one run of consecutive words or characters and the start of the next.
@c That is, if it has just printed out `president' and then decides to jump
@c to a different point in the file, it might spot the `ent' in `pentagon'
@c and continue from there, producing `presidentagon'.@footnote{This
@c dissociword actually appeared during the Vietnam War, when it was very
@c appropriate.} Long sample texts produce the best results.
@kbd{M-x dissociated-press}$B$O%P%C%U%!Cf$N$"$k2U=j$+$i%i%s%@%`$K(B
$BJL$N2U=j$K%8%c%s%W$9$k$3$H$r7+$jJV$7$F$$$-$^$9!#(B
$B$?$@$N%4%_$G$O$J$/$*$b$7$m$$=PNO$,F@$i$l$k$h$&$K!"(B
$B$"$k0lO"$NC18lNs$+$i$D$.$N0lO"$NC18lNs$K0\$k:]$K!"(B
$B$=$l$i$N$"$$$@$K0lDj$N=EJ#$,$"$k$h$&$K$7$^$9!#(B
$B$D$^$j!"$?$H$($P(Bpresident$B$H=PNO$7$?$H$3$m$GJL$N>l=j$K%8%c%s%W$9$k$3$H$K(B
$B7h$a$?$i!":G8e$K$"$C$?(Bent$B$HF1$8J8;zNs$N$"$kC18l!"(B
$B$?$H$($P(Bpentagon$B$N$H$3$m$KHt$s$G$=$3$+$iB3$1$k$N$G!"(B
$B7k2L$H$7$F(Bpregidentagon
@footnote{$B$3$N9g@.8l$O!"(B
$B%Y%H%J%`@oAhCf$K$^$5$K$=$l$K$T$C$?$j$N0UL#$G<B:]$K;H$o$l$?$3$H$,$"$k!#(B}
$B$H$$$&$N$,@8@.$5$l$k$o$1$G$9!#(B
$B85%F%-%9%H$,D9$$$H$?$$$X$s$*$b$7$m$$7k2L$rF@$i$l$^$9!#(B
@c @cindex againformation
@c A positive argument to @kbd{M-x dissociated-press} tells it to operate
@c character by character, and specifies the number of overlap characters. A
@c negative argument tells it to operate word by word and specifies the number
@c of overlap words. In this mode, whole words are treated as the elements to
@c be permuted, rather than characters. No argument is equivalent to an
@c argument of two. For your againformation, the output goes only into the
@c buffer @samp{*Dissociation*}. The buffer you start with is not changed.
@kbd{M-x dissociated-press}$B$K@5$N?t0z?t$rEO$9$H(B
$BJ8;zC10L$GF0:n$7!"$=$N?tCM$O=EJ#$9$kJ8;z?t$r;XDj$7$^$9!#(B
$B$^$?!"Ii$N?t0z?t$rEO$9$HC18lC10L$GF0:n$7!"$=$N?tCM!J$N@dBPCM!K$G=EJ#$9$k(B
$BC18l?t$r;XDj$7$^$9!#(B
$B0z?t$r;XDj$7$J$$$H!V(B2$B!W$r;XDj$7$?$N$HF1$8$K$J$j$^$9!#(B
$B7+$jJV$7$^$9$,!"=PNO$O$D$M$K%P%C%U%!(B@samp{*Dissociation*}$B$K8=$l$^$9!#(B
$B$b$H$N%P%C%U%!$OJQ99$5$l$^$;$s!#(B
@c @cindex Markov chain
@cindex $B%^%k%3%UO":?(B
@c @cindex ignoriginal
@c @cindex techniquitous
@c Dissociated Press produces nearly the same results as a Markov chain
@c based on a frequency table constructed from the sample text. It is,
@c however, an independent, ignoriginal invention. Dissociated Press
@c techniquitously copies several consecutive characters from the sample
@c between random choices, whereas a Markov chain would choose randomly for
@c each word or character. This makes for more plausible sounding results,
@c and runs faster.
@kbd{M-x dissociated-press}$B$O!"F~NO%F%-%9%H$+$iIQEYI=$r:n$C$F(B
$B%^%k%3%UO":?$rE,MQ$7$?$N$K6a$$7k2L$r$b$?$i$7$^$9$,!"(B
$B$=$l<+BN$O$-$o$a$F%*%j%8%J%k$JH/L@$G$9!#(B
$B$H$$$&$N$O!"%^%k%3%UO":?$G$OC1$KMp?t$K4p$E$$$FJ8;z$d8l$rA*$V$@$1$J$N$KBP$7!"(B
$B$3$N%3%^%s%I$G$OMp?t$K4p$E$$$FO"B3$7$?J8;z$d8l$r%3%T!<$7$F$/$k$+$i$G$9!#(B
$B$3$N$?$a!"$h$j9bB.$J<B9T$,2DG=$G$9$7!"FI$s$G$*$b$7$m$$7k2L$,F@$i$l$^$9!#(B
@c @cindex outragedy
@c @cindex buggestion
@c @cindex properbose
@c @cindex mustatement
@c @cindex developediment
@c @cindex userenced
@c It is a mustatement that too much use of Dissociated Press can be a
@c developediment to your real work. Sometimes to the point of outragedy.
@c And keep dissociwords out of your documentation, if you want it to be well
@c userenced and properbose. Have fun. Your buggestions are welcome.
@kbd{M-x dissociated-press}$B$N;H$$$9$.$O;E;v$K:9$7;Y$(!"(B
$B>l9g$K$h$C$F$O=EBg$J>c37$H$J$j$^$9$+$iCm0U$7$^$7$g$&!#(B
$B$^$?!"%f!<%6!<$K<u$1F~$l$F$b$i$&$?$a$K$b!"(B
$B%^%K%e%"%k$K$3$N%3%^%s%I$N=PNO$rMxMQ$9$k$N$O$d$a$?$[$&$,$h$$$G$9!#(B
$B$G$b!"$;$$$<$$3Z$7$s$G!"$h$+$C$?$i%P%0$NDs0F$b$h$m$7$/!#(B
@footnote{$B!ZLuCm![(B $B$3$NCJMn<+BN!"(B@kbd{M-x dissociated-press}$B$G@8@.$7$?$h$&$J(B
$B$b$N$J$N$G!"86J8$r7G:\$7$F$*$/!#(B @*
It is a mustatement that too much use of Dissociated Press can be a
developediment to your real work. Sometimes to the point of outragedy.
And keep dissociwords out of your documentation, if you want it to be well
userenced and properbose. Have fun. Your buggestions are welcome.}
@node Amusements, Customization, Dissociated Press, Top
@c @section Other Amusements
@section $B$=$NB>$N8d3Z(B
@c @cindex boredom
@cindex $BB`6~$7$?$i(B
@findex hanoi
@findex yow
@findex gomoku
@findex mpuz
@c @cindex tower of Hanoi
@cindex $B%O%N%$$NEc(B
@c If you are a little bit bored, you can try @kbd{M-x hanoi}. If you are
@c considerably bored, give it a numeric argument. If you are very very
@c bored, try an argument of 9. Sit back and watch.
$BB`6~$J$H$-$O!"(B@kbd{M-x hanoi}$B$r;n$7$F$/$@$5$$!#(B
$B$R$I$/B`6~$J$i!"?t0z?t$r;XDj$7$F$/$@$5$$!#(B
$B$b$N$9$4$/!"$R$I$/B`6~$J$i!"!V(B9$B!W$r;XDj$9$k$H$h$$$G$7$g$&!#(B
$B$^$"$d$C$F$_$F$/$@$5$$!#(B
@c @cindex Go Moku
@cindex $B8^L\(B
@c If you want a little more personal involvement, try @kbd{M-x gomoku},
@c which plays the game Go Moku with you.
$B$b$&>/$7@Q6KE*$K2?$+$7$?$$$J$i!"(B@kbd{M-x gomoku}$B$r;n$7$F$/$@$5$$!#(B
$B$3$l$O8^L\JB$Y$N%W%m%0%i%`$G$9!#(B
@findex blackbox
@findex mpuz
@c @cindex puzzles
@cindex $B%Q%:%k(B
@c @kbd{M-x blackbox} and @kbd{M-x mpuz} are two kinds of puzzles.
@c @code{blackbox} challenges you to determine the location of objects
@c inside a box by tomography. @code{mpuz} displays a multiplication
@c puzzle with letters standing for digits in a code that you must
@c guess---to guess a value, type a letter and then the digit you think it
@c stands for.
@kbd{M-x blackbox}$B$H(B@kbd{M-x mpuz}$B$O(B2$B<oN`$N%Q%:%k$G$9!#(B
@code{blackbox}$B$OH"$NCf$NJ*$N0LCV$rEv$F$k%2!<%`$G$9!#(B
@code{mpuz}$B$O3]$1;;$NJ$LL;;$G!"1Q;z$KBP1~$7$F$$$k?t;z$rEv$F$k%2!<%`$G$9!#(B
$B1Q;z$rBG$C$F$+$i$=$N1Q;z$KBP1~$7$F$$$k$H;W$&?t;z$rBG$A9~$_$^$9!#(B
@findex dunnet
@c @kbd{M-x dunnet} runs an adventure-style exploration game, which is
@c a bigger sort of puzzle.
@kbd{M-x dunnet}$B$O%"%I%Y%s%A%c!<Iw$NC58!%2!<%`$G!"(B
$BBg$-$J%Q%:%k$@$H;W$($P$h$$$G$7$g$&!#(B
@c When you are frustrated, try the famous Eliza program. Just do
@c @kbd{M-x doctor}. End each input by typing @key{RET} twice.
$B$$$i$$$i$9$k$H$-$O!"M-L>$J(BEliza$B%W%m%0%i%`$r;n$7$F$_$F$/$@$5$$!#(B
@kbd{M-x doctor}$B$HBG$D$@$1$G$9!#(B
1$B$D$NF~NO$N=*$o$j$K$O(B@key{RET}$B$r(B2$B2sBG$A$^$9!#(B
@cindex Zippy
@c When you are feeling strange, type @kbd{M-x yow}.
$B4qL/$J46$8$,$9$k$H$-$O!"(B@kbd{M-x yow}$B$HBG$C$F$_$F$/$@$5$$!#(B
|