1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180
|
@c =============================================================
@c = $B85(B $BK](B $BLu(B: $BNkLZ1Y;R!wDEED=NBg3X(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 =============================================================
@c This is part of the Emacs manual.
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Files, Buffers, Fixit, Top
@c @chapter File Handling
@c @cindex files
@chapter $B%U%!%$%k$N07$$J}(B
@cindex $B%U%!%$%k(B
@c The operating system stores data permanently in named @dfn{files}. So
@c most of the text you edit with Emacs comes from a file and is ultimately
@c stored in a file.
$B%*%Z%l!<%F%#%s%0%7%9%F%`$O!"(B
$B%G!<%?$r;XDj$7$?(B@dfn{$B%U%!%$%k(B}$B!J(Bfile$B!K$K915WE*$KJ]B8$7$^$9!#(B
$B$G$9$+$i!"(BEmacs$B$GJT=8$9$k%F%-%9%H$NB?$/$O%U%!%$%k$+$i<h$j9~$_!"(B
$B:G=*E*$K$O%U%!%$%k$K3JG<$5$l$^$9!#(B
@c To edit a file, you must tell Emacs to read the file and prepare a
@c buffer containing a copy of the file's text. This is called
@c @dfn{visiting} the file. Editing commands apply directly to text in the
@c buffer; that is, to the copy inside Emacs. Your changes appear in the
@c file itself only when you @dfn{save} the buffer back into the file.
$B%U%!%$%k$rJT=8$9$k$K$O!"(B
Emacs$B$KBP$7$F%U%!%$%k$rFI$`$h$&$K;X<($7$F!"(B
$B%U%!%$%k$NFbMF$N%3%T!<$rF~$l$?%P%C%U%!$rMQ0U$5$;$kI,MW$,$"$j$^$9!#(B
$B$3$l$r!"%U%!%$%k$r(B@dfn{$BK,Ld$9$k!?K,$l$k(B}$B!J(Bvisiting$B!K$H$$$$$^$9!#(B
$BJT=8%3%^%s%I$O%P%C%U%!Fb$N%F%-%9%H$KD>@\:nMQ$7$^$9!#(B
$B$D$^$j!"(BEmacs$BFb$K$"$k%3%T!<$rA`:n$7$^$9!#(B
$B%P%C%U%!$r%U%!%$%k$K(B@dfn{$BJ]B8(B}$B!J(Bsave$B!K$7$?>l9g$K8B$j!"(B
$BJQ99$O%U%!%$%k$=$N$b$N$KH?1G$5$l$^$9!#(B
@c In addition to visiting and saving files, Emacs can delete, copy,
@c rename, and append to files, keep multiple versions of them, and operate
@c on file directories.
$B%U%!%$%k$rK,Ld$7$?$jJ]B8$7$?$j$9$k$3$H$K2C$($F!"(B
Emacs$B$O!"%U%!%$%k$r!":o=|$7$?$j!"%3%T!<$7$?$j!"L>A0$rJQ99$7$?$j!"(B
$BJL$N%U%!%$%k$XDI2C$7$?$j!"J#?t$NHG$rJ];}$7$?$j!"(B
$B%U%!%$%k%G%#%l%/%H%j$rA`:n$7$?$j$G$-$^$9!#(B
@menu
* File Names:: How to type and edit file-name arguments.
* Visiting:: Visiting a file prepares Emacs to edit the file.
* Saving:: Saving makes your changes permanent.
* Reverting:: Reverting cancels all the changes not saved.
* Auto Save:: Auto Save periodically protects against loss of data.
* File Aliases:: Handling multiple names for one file.
* Version Control:: Version control systems (RCS, CVS and SCCS).
* Directories:: Creating, deleting, and listing file directories.
* Comparing Files:: Finding where two files differ.
* Misc File Ops:: Other things you can do on files.
* Compressed Files:: Accessing compressed files.
* Remote Files:: Accessing files on other sites.
* Quoted File Names:: Quoting special characters in file names.
@end menu
@node File Names
@c @section File Names
@c @cindex file names
@section $B%U%!%$%kL>(B
@cindex $B%U%!%$%kL>(B
@c Most Emacs commands that operate on a file require you to specify the
@c file name. (Saving and reverting are exceptions; the buffer knows which
@c file name to use for them.) You enter the file name using the
@c minibuffer (@pxref{Minibuffer}). @dfn{Completion} is available, to make
@c it easier to specify long file names. @xref{Completion}.
$B%U%!%$%k$rA`:n$9$k$[$H$s$I$N(BEmacs$B%3%^%s%I$K$O!"(B
$B%U%!%$%kL>$r;XDj$9$kI,MW$,$"$j$^$9!#(B
$B!JJ]B8$HI|85$NA`:n$r=|$/!#(B
$B%P%C%U%!$O$3$l$i$NA`:n$KBP$7$F;H$&%U%!%$%kL>$r5-O?$7$F$$$k!#!K(B
$B%U%!%$%kL>$O!"%_%K%P%C%U%!$r;H$C$FF~NO$7$^$9!J(B@pxref{Minibuffer}$B!K!#(B
$BD9$$%U%!%$%kL>$N;XDj$r4JC1$K$9$kJd40$b;H$($^$9!#(B
@xref{Completion}$B!#(B
@c For most operations, there is a @dfn{default file name} which is used
@c if you type just @key{RET} to enter an empty argument. Normally the
@c default file name is the name of the file visited in the current buffer;
@c this makes it easy to operate on that file with any of the Emacs file
@c commands.
$BB?$/$NA`:n$K$O!"(B@dfn{$B%G%U%)%k%H%U%!%$%kL>(B}$B$,$"$j!"(B
@key{RET}$B$@$1$rBG$C$F6u$N0z?t$r;XDj$7$?>l9g$K;H$o$l$^$9!#(B
$BDL>o!"%G%U%)%k%H%U%!%$%kL>$O!"(B
$B%+%l%s%H%P%C%U%!$GK,Ld$7$?%U%!%$%k$NL>A0$G$9!#(B
$B$3$&$9$k$3$H$G!"(B
Emacs$B$N%U%!%$%k%3%^%s%I$GEv3:%U%!%$%k$rA`:n$9$k$N$,4JC1$K$J$j$^$9!#(B
@vindex default-directory
@c Each buffer has a default directory, normally the same as the
@c directory of the file visited in that buffer. When you enter a file
@c name without a directory, the default directory is used. If you specify
@c a directory in a relative fashion, with a name that does not start with
@c a slash, it is interpreted with respect to the default directory. The
@c default directory is kept in the variable @code{default-directory},
@c which has a separate value in every buffer.
$B3F%P%C%U%!$K$O%G%U%)%k%H%G%#%l%/%H%j$,$"$j$^$9!#(B
$BDL>o$O!"$=$N%P%C%U%!$NK,Ld@h$N%U%!%$%k$N%G%#%l%/%H%j$HF1$8$G$9!#(B
$B%G%#%l%/%H%j$r;XDj$7$J$$$G%U%!%$%kL>$rF~NO$9$k$H!"(B
$B%G%U%)%k%H%G%#%l%/%H%j$r;H$$$^$9!#(B
$B%9%i%C%7%e!J(B@samp{/}$B!K$G;O$^$i$J$$AjBPE*$J%G%#%l%/%H%j$r;XDj$9$k$H!"(B
$B%G%U%)%k%H%G%#%l%/%H%jAjBP$K2r<a$7$^$9!#(B
$B%G%U%)%k%H%G%#%l%/%H%j$OJQ?t(B@code{default-directory}$B$KJ];}$5$l$F$$$F!"(B
$B%P%C%U%!$4$H$KJL!9$NCM$r;}$A$^$9!#(B
@c For example, if the default file name is @file{/u/rms/gnu/gnu.tasks} then
@c the default directory is @file{/u/rms/gnu/}. If you type just @samp{foo},
@c which does not specify a directory, it is short for @file{/u/rms/gnu/foo}.
@c @samp{../.login} would stand for @file{/u/rms/.login}. @samp{new/foo}
@c would stand for the file name @file{/u/rms/gnu/new/foo}.
$B$?$H$($P!"%G%U%)%k%H%U%!%$%kL>$,(B@file{/u/rms/gnu/gnu.tasks}$B$J$i$P!"(B
$B%G%U%)%k%H%G%#%l%/%H%j$O(B@file{/u/rms/gnu/}$B$G$9!#(B
$B%G%#%l%/%H%j$r;XDj$7$J$$$G(B@samp{foo}$B$H$@$1BG$D$H!"(B
@file{/u/rms/gnu/foo}$B$r0UL#$7$^$9!#(B
@samp{../.login}$B$O!"(B@file{/u/rms/.login}$B$r0UL#$7$^$9!#(B
@samp{new/foo}$B$O!"%U%!%$%kL>(B@file{/u/rms/gnu/new/foo}$B$r0UL#$7$^$9!#(B
@findex cd
@findex pwd
@c The command @kbd{M-x pwd} prints the current buffer's default
@c directory, and the command @kbd{M-x cd} sets it (to a value read using
@c the minibuffer). A buffer's default directory changes only when the
@c @code{cd} command is used. A file-visiting buffer's default directory
@c is initialized to the directory of the file that is visited there. If
@c you create a buffer with @kbd{C-x b}, its default directory is copied
@c from that of the buffer that was current at the time.
$B%3%^%s%I(B@kbd{M-x pwd}$B$O!"%+%l%s%H%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$rI=<($7!"(B
$B%3%^%s%I(B@kbd{M-x cd}$B$O!"$=$l$r!J%_%K%P%C%U%!$GFI$s$@CM$K!K@_Dj$7$^$9!#(B
$B%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$O!"(B
@code{cd}$B%3%^%s%I$r;H$C$?$H$-$@$1JQ99$5$l$^$9!#(B
$B%U%!%$%k$rK,Ld$7$F$$$k%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$O!"(B
$BK,Ld$7$?%U%!%$%k$N%G%#%l%/%H%j$K=i4|2=$5$l$^$9!#(B
@kbd{C-x b}$B$G:n$C$?%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$O!"(B
$B$=$N;~E@$N%+%l%s%H%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$HF1$8$G$9!#(B
@vindex insert-default-directory
@c The default directory actually appears in the minibuffer when the
@c minibuffer becomes active to read a file name. This serves two
@c purposes: it @emph{shows} you what the default is, so that you can type
@c a relative file name and know with certainty what it will mean, and it
@c allows you to @emph{edit} the default to specify a different directory.
@c This insertion of the default directory is inhibited if the variable
@c @code{insert-default-directory} is set to @code{nil}.
$B%G%U%)%k%H%G%#%l%/%H%j$O!"%_%K%P%C%U%!$G%U%!%$%kL>$rFI$`$H$-$K!"(B
$B<B:]$K%_%K%P%C%U%!$KI=<($5$l$^$9!#(B
$B$3$l$K$O(B2$B$D$NL\E*$,$"$j$^$9!#(B
$B%G%U%)%k%H$,2?$G$"$k$+$r(B@emph{$B<($9(B}$B$3$H$G!"(B
$BAjBP%U%!%$%kL>$rBG$A9~$a$k$h$&$K$7!"$7$+$b!"(B
$B$=$N0UL#$r3N<B$KCN$k$3$H$,$G$-$k$h$&$K$7$^$9!#(B
$B$b$&(B1$B$D$O!"%G%U%)%k%H%G%#%l%/%H%j$r(B@emph{$BJT=8(B}$B$7$F!"(B
$BJL$N%G%#%l%/%H%j$r;XDj$G$-$k$h$&$K$7$^$9!#(B
$BJQ?t(B@code{insert-default-directory}$B$r(B@code{nil}$B$K@_Dj$9$k$H!"(B
$B%G%U%)%k%H%G%#%l%/%H%j$rA^F~$7$^$;$s!#(B
@c Note that it is legitimate to type an absolute file name after you
@c enter the minibuffer, ignoring the presence of the default directory
@c name as part of the text. The final minibuffer contents may look
@c invalid, but that is not so. For example, if the minibuffer starts out
@c with @samp{/usr/tmp/} and you add @samp{/x1/rms/foo}, you get
@c @samp{/usr/tmp//x1/rms/foo}; but Emacs ignores everything through the
@c first slash in the double slash; the result is @samp{/x1/rms/foo}.
@c @xref{Minibuffer File}.
$B%_%K%P%C%U%!$GF~NO$9$k$H$-!"(B
$B%F%-%9%H$N0lIt$H$7$FF~$C$F$$$k%G%U%)%k%H%G%#%l%/%H%j$rL5;k$7$F!"(B
$B@dBP%U%!%$%kL>$rBG$C$F$b2?$NLdBj$b$"$j$^$;$s!#(B
$B:G=*E*$J%_%K%P%C%U%!$NFbMF$OIT@5$J$h$&$K8+$($F$b!"(B
$B$=$&$G$O$"$j$^$;$s!#(B
$B$?$H$($P!"%_%K%P%C%U%!$K$O(B@samp{/usr/tmp/}$B$,F~$C$F$$$F(B
@samp{/x1/rms/foo}$B$rDI2C$9$k$H!"(B@samp{/usr/tmp//x1/rms/foo}$B$H$J$j$^$9!#(B
Emacs$B$OO"B3$7$?(B2$B8D$N%9%i%C%7%e$N;O$a$N%9%i%C%7%e$^$G$r$9$Y$FL5;k$9$k$N$G!"(B
$B7k2L$H$7$F(B@samp{/x1/rms/foo}$B$H$J$j$^$9!#(B
@xref{Minibuffer File}$B!#(B
@c @samp{$} in a file name is used to substitute environment variables.
@c For example, if you have used the shell command @samp{export
@c FOO=rms/hacks} to set up an environment variable named @code{FOO}, then
@c you can use @file{/u/$FOO/test.c} or @file{/u/$@{FOO@}/test.c} as an
@c abbreviation for @file{/u/rms/hacks/test.c}. The environment variable
@c name consists of all the alphanumeric characters after the @samp{$};
@c alternatively, it may be enclosed in braces after the @samp{$}. Note
@c that shell commands to set environment variables affect Emacs only if
@c done before Emacs is started.
$B%U%!%$%kL>$NCf$N(B@samp{$}$B$O4D6-JQ?t$GCV$-49$($i$l$^$9!#(B
$B$?$H$($P!"%7%'%k%3%^%s%I(B@samp{export FOO=rms/hacks}$B$G!"(B
$B4D6-JQ?t(B@code{FOO}$B$r@_Dj$7$F$"$k$H$7$^$9!#(B
$B$=$&$9$k$H!"(B@file{/u/rms/hacks/test.c}$B$NN,>N$H$7$F(B
@file{/u/$FOO/test.c}$B$d(B@file{/u/$@{FOO@}/test.c}$B$r;H$($^$9!#(B
$B4D6-JQ?t$NL>A0$O!"(B@samp{$}$B$N$&$7$m$K$"$k1Q?t;zA4It$G$9!#(B
$B$"$k$$$O!"(B@samp{$}$B$N$&$7$m$K$"$k3g8L$G0O$^$l$?$b$N$G$9!#(B
$B%7%'%k%3%^%s%I$G@_Dj$7$?4D6-JQ?t$,(BEmacs$B$K1F6A$r5Z$\$9$N$O!"(B
Emacs$B$r5/F0$9$k$^$($K@_Dj$7$?$b$N$K8B$j$^$9!#(B
@c To access a file with @samp{$} in its name, type @samp{$$}. This pair
@c is converted to a single @samp{$} at the same time as variable
@c substitution is performed for single @samp{$}. Alternatively, quote the
@c whole file name with @samp{/:} (@pxref{Quoted File Names}).
$BL>A0$NCf$K(B@samp{$}$B$,$"$k%U%!%$%k$r;2>H$9$k$K$O!"(B
@samp{$$}$B$HBG$A$^$9!#(B
1$B8D$N(B@samp{$}$B$KBP$7$FJQ?t$NCV$-49$($r9T$&$H$-$K!"(B
$B$3$N(B2$B8D$N(B@samp{$}$B$O(B1$B8D$N(B@samp{$}$B$KJQ49$5$l$^$9!#(B
$B$"$k$$$O!"%U%!%$%kL>A4BN$r(B@samp{/:}$B$G%/%)!<%H$7$^$9(B
$B!J(B@pxref{Quoted File Names}$B!K!#(B
@findex substitute-in-file-name
@c The Lisp function that performs the substitution is called
@c @code{substitute-in-file-name}. The substitution is performed only on
@c file names read as such using the minibuffer.
$B!JJQ?t$N!KCV$-49$($r9T$&(BLisp$B4X?t$O(B@code{substitute-in-file-name}$B$G$9!#(B
$BCV$-49$($O!"%_%K%P%C%U%!$GFI$s$@%U%!%$%kL>$@$1$KE,MQ$5$l$^$9!#(B
@c You can include non-ASCII characters in file names if you set the
@c variable @code{file-name-coding-system} to a non-@code{nil} value.
@c @xref{Specify Coding}.
$BJQ?t(B@code{file-name-coding-system}$B$K(B@code{nil}$B0J30$r@_Dj$9$k$H!"(B
$B%U%!%$%kL>$KHs(BASCII$B$r4^$a$k$3$H$,$G$-$^$9!#(B
@xref{Specify Coding}$B!#(B
@node Visiting
@c @section Visiting Files
@c @cindex visiting files
@section $B%U%!%$%k$rK,Ld$9$k(B
@cindex $B%U%!%$%k$rK,Ld$9$k(B
@c WideCommands
@table @kbd
@item C-x C-f
@c Visit a file (@code{find-file}).
$B%U%!%$%k$rK,Ld$9$k!J(B@code{find-file}$B!K!#(B
@item C-x C-r
@c Visit a file for viewing, without allowing changes to it
@c (@code{find-file-read-only}).
$B%U%!%$%k$rD/$a$k$?$a$KK,Ld$7!"JQ99$r5v$5$J$$(B
$B!J(B@code{find-file-read-only}$B!K!#(B
@item C-x C-v
@c Visit a different file instead of the one visited last
@c (@code{find-alternate-file}).
$B:G8e$KK,Ld$7$?%U%!%$%k$N$+$o$j$K!"JL$N%U%!%$%k$rK,Ld$9$k(B
$B!J(B@code{find-alternate-file}$B!K!#(B
@item C-x 4 f
@c Visit a file, in another window (@code{find-file-other-window}). Don't
@c alter what is displayed in the selected window.
$BJL$N%&%#%s%I%&$G%U%!%$%k$rK,Ld$9$k(B
$B!J(B@code{find-file-other-window}$B!K!#(B
$BA*Br$5$l$F$$$k%&%#%s%I%&$KI=<($5$l$F$$$kFbMF$OJQ2=$7$J$$!#(B
@item C-x 5 f
@c Visit a file, in a new frame (@code{find-file-other-frame}). Don't
@c alter what is displayed in the selected frame.
$B?7$?$J%U%l!<%`$G%U%!%$%k$rK,Ld$9$k(B
$B!J(B@code{find-file-other-frame}$B!K!#(B
$BA*Br$5$l$F$$$k%U%l!<%`$KI=<($5$l$F$$$kFbMF$OJQ2=$7$J$$!#(B
@item M-x find-file-literally
@c Visit a file with no conversion of the contents.
$B%U%!%$%k$NFbMF$r$$$C$5$$JQ49$;$:$KK,Ld$9$k!#(B
@end table
@c @cindex files, visiting and saving
@c @cindex visiting files
@c @cindex saving files
@cindex $B%U%!%$%k!"K,Ld$HJ]B8(B
@cindex $B%U%!%$%k$rK,Ld$9$k(B
@cindex $B%U%!%$%k$rJ]B8$9$k(B
@c @dfn{Visiting} a file means copying its contents into an Emacs buffer
@c so you can edit them. Emacs makes a new buffer for each file that you
@c visit. We say that this buffer is visiting the file that it was created
@c to hold. Emacs constructs the buffer name from the file name by
@c throwing away the directory, keeping just the name proper. For example,
@c a file named @file{/usr/rms/emacs.tex} would get a buffer named
@c @samp{emacs.tex}. If there is already a buffer with that name, a unique
@c name is constructed by appending @samp{<2>}, @samp{<3>}, or so on, using
@c the lowest number that makes a name that is not already in use.
$B%U%!%$%k$r(B@dfn{$BK,Ld$9$k!?K,$l$k(B}$B$H$O!"(B
$B%U%!%$%k$NFbMF$N%3%T!<$rJT=8$G$-$k$h$&$K(BEmacs$B%P%C%U%!$KF~$l$k$3$H$G$9!#(B
Emacs$B$O!"K,Ld$9$k3F%U%!%$%k$4$H$K?7$?$K%P%C%U%!$r:n$j$^$9!#(B
$B%P%C%U%!L>$O!"%G%#%l%/%H%jItJ,$r<h$j$5$C$?%U%!%$%kL>$+$i:n$j$^$9!#(B
$B$?$H$($P!"%U%!%$%kL>(B@file{/usr/rms/emacs.tex}$B$N(B
$B%P%C%U%!L>$O(B@samp{emacs.tex}$B$H$J$j$^$9!#(B
$B$=$NL>A0$N%P%C%U%!$,$9$G$KB8:_$9$k$J$i$P!"(B
$B$^$@;H$o$l$F$$$J$$L>A0$K$J$k$h$&$J$b$C$H$b>.$5$$?t$r;H$C$F!"(B
@samp{<2>}, @samp{<3>}$B$J$I$rIU2C$7$FM#0l$NL>A0$r:n$j$^$9!#(B
@c Each window's mode line shows the name of the buffer that is being displayed
@c in that window, so you can always tell what buffer you are editing.
$B3F%&%#%s%I%&$N%b!<%I9T$K$O%&%#%s%I%&Fb$KI=<($7$F$$$k(B
$B%P%C%U%!L>$,<($5$l$F$$$k$N$G!"(B
$BJT=8$7$F$$$k%P%C%U%!$,2?$+$$$D$G$b$o$+$j$^$9!#(B
@c The changes you make with editing commands are made in the Emacs
@c buffer. They do not take effect in the file that you visited, or any
@c place permanent, until you @dfn{save} the buffer. Saving the buffer
@c means that Emacs writes the current contents of the buffer into its
@c visited file. @xref{Saving}.
$BJT=8%3%^%s%I$K$h$kJQ99$O!"(BEmacs$B%P%C%U%!$KBP$7$F9T$o$l$^$9!#(B
$B%P%C%U%!$r(B@dfn{$BJ]B8(B}$B$9$k$^$G$O!"(B
$BJQ99$O!"K,Ld@h$N%U%!%$%k$dB>$N$I$s$J915WE*$J$b$N$K$b1F6A$7$^$;$s!#(B
$B%P%C%U%!$rJ]B8$9$k$H$O!"(B
$B%P%C%U%!$N8=:_$NFbMF$r$=$N%P%C%U%!$NK,Ld@h$N%U%!%$%k$K=q$-=P$9$3$H$G$9!#(B
@xref{Saving}$B!#(B
@c @cindex modified (buffer)
@cindex $BJQ99$5$l$?%P%C%U%!(B
@c If a buffer contains changes that have not been saved, we say the
@c buffer is @dfn{modified}. This is important because it implies that
@c some changes will be lost if the buffer is not saved. The mode line
@c displays two stars near the left margin to indicate that the buffer is
@c modified.
$B%P%C%U%!$KL$J]B8$NJQ99$,$"$k>l9g!"(B
$B%P%C%U%!$O(B@dfn{$BJQ99$5$l$F$$$k(B}$B$H$$$$$^$9!#(B
$B%P%C%U%!$rJ]B8$7$J$$$HJQ99FbMF$,<:$o$l$F$7$^$&$N$G!"(B
$B$3$l$O=EMW$J$3$H$G$9!#(B
$B%b!<%I9T$N:8C<6a$/$K(B2$B8D$N@10u$rI=<($7$F!"(B
$B%P%C%U%!$,JQ99$5$l$F$$$k$3$H$r<($7$^$9!#(B
@kindex C-x C-f
@findex find-file
@c To visit a file, use the command @kbd{C-x C-f} (@code{find-file}). Follow
@c the command with the name of the file you wish to visit, terminated by a
@c @key{RET}.
$B%U%!%$%k$rK,Ld$9$k$K$O!"%3%^%s%I(B@kbd{C-x C-f}$B!J(B@code{find-file}$B!K$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$K!"K,Ld$7$?$$%U%!%$%kL>$rB3$1$F(B@key{RET}$B$G=*$($^$9!#(B
@c The file name is read using the minibuffer (@pxref{Minibuffer}), with
@c defaulting and completion in the standard manner (@pxref{File Names}).
@c While in the minibuffer, you can abort @kbd{C-x C-f} by typing @kbd{C-g}.
$B%U%!%$%kL>$O%_%K%P%C%U%!!J(B@pxref{Minibuffer}$B!K$GFI$^$l!"(B
$B$3$N$H$-%G%U%)%k%H$dI8=`E*$JJ}K!$NJd40$r;H$($^$9!J(B@pxref{File Names}$B!K!#(B
$B%_%K%P%C%U%!Fb$G(B@kbd{C-g}$B$HBG$F$P!"(B@kbd{C-x C-f}$B$r%"%\!<%H$G$-$^$9!#(B
@c Your confirmation that @kbd{C-x C-f} has completed successfully is the
@c appearance of new text on the screen and a new buffer name in the mode
@c line. If the specified file does not exist and could not be created, or
@c cannot be read, then you get an error, with an error message displayed
@c in the echo area.
@kbd{C-x C-f}$B$,@5$7$/40N;$7$?$3$H$O!"2hLL>e$K?7$?$K8=$l$k%F%-%9%H$H(B
$B%b!<%I9T$K8=$l$k?7$?$J%P%C%U%!L>$G3NG'$G$-$^$9!#(B
$B;XDj$7$?%U%!%$%k$,B8:_$;$::n@.$b$G$-$J$$>l9g$dFI$a$J$$>l9g$K$O!"(B
$B%(%3!<NN0h$K%(%i!<%a%C%;!<%8$,I=<($5$l$^$9!#(B
@c If you visit a file that is already in Emacs, @kbd{C-x C-f} does not make
@c another copy. It selects the existing buffer containing that file.
@c However, before doing so, it checks that the file itself has not changed
@c since you visited or saved it last. If the file has changed, a warning
@c message is printed. @xref{Interlocking,,Simultaneous Editing}.
$B$9$G$KK,Ld$7$F$$$k%U%!%$%k$r:FEYK,Ld$9$k$H!"(B
@kbd{C-x C-f}$B$OJL$N%3%T!<$r:n$i$:$K!"(B
$B$=$N%U%!%$%k$rF~$l$?4{B8$N%P%C%U%!$rA*Br$7$^$9!#(B
$B$7$+$7!"$=$&$9$k$^$($K!"K,Ld$7$F$+$i!"$"$k$$$O!"J]B8$7$F$+$i0J9_$K(B
$B%U%!%$%k$,JQ99$5$l$?$+$I$&$+8!::$7$^$9!#(B
$B%U%!%$%k$,JQ99$5$l$F$$$k$H7Y9p%a%C%;!<%8$rI=<($7$^$9!#(B
@xref{Interlocking}$B!#(B
@c @cindex creating files
@cindex $B%U%!%$%k$N?75,:n@.(B
@c What if you want to create a new file? Just visit it. Emacs prints
@c @samp{(New File)} in the echo area, but in other respects behaves as if
@c you had visited an existing empty file. If you make any changes and
@c save them, the file is created.
$B?7$?$K%U%!%$%k$r:n$j$?$$$H$-$K$O$I$&$9$k$N$G$7$g$&!)(B@code{ }
$BC1$KK,Ld$9$l$P$h$$$N$G$9!#(B
Emacs$B$O%(%3!<NN0h$K(B@samp{(New File)}$B$HI=<($7$^$9$,!"(B
$B$=$l0J30$K4X$7$F$O!"$"$?$+$b6u$N%U%!%$%k$,B8:_$9$k$+$N$h$&$K$U$k$^$$$^$9!#(B
$BJQ99$7$F$+$iJ]B8$9$l$P!"%U%!%$%k$r:n@.$G$-$^$9!#(B
@c Emacs recognizes from the contents of a file which convention it uses
@c to separate lines---newline (used on GNU/Linux and on Unix),
@c carriage-return linefeed (used on Microsoft systems), or just
@c carriage-return (used on the Macintosh)---and automatically converts the
@c contents to the normal Emacs convention, which is that the newline
@c character separates lines. This is a part of the general feature of
@c coding system conversion (@pxref{Coding Systems}), and makes it possible
@c to edit files imported from various different operating systems with
@c equal convenience. If you change the text and save the file, Emacs
@c performs the inverse conversion, changing newlines back into
@c carriage-return linefeed or just carriage-return if appropriate.
Emacs$B$O%U%!%$%k$NFbMF$+$i!"9T6h@Z$j$NJ}K!!"(B
$B$9$J$o$A!"!J(BGNU/Linux$B$d(BUNIX$B$G;H$o$l$k!K2~9T!"(B
$B!J(BMicrosoft$B%7%9%F%`$G;H$o$l$k!KI|5"2~9T!"(B
$B!J(BMachintosh$B$G;H$o$l$k!KI|5"$N$_$rG'<1$7$^$9!#(B
$B$5$i$K!"(BEmacs$B$NDL>o$NJ}K!!"$D$^$j!"2~9TJ8;z$G9T$r6h@Z$k$h$&$K(B
$BFbMF$r<+F0E*$KJQ49$7$^$9!#(B
$B$3$l$O!"%3!<%G%#%s%0%7%9%F%`JQ49!J(B@pxref{Coding Systems}$B!K$N(B
$B0lHLE*$J5!G=$N0lIt$G$"$j!"(B
$B$5$^$6$^$N0[$J$k%*%Z%l!<%F%#%s%0%7%9%F%`$+$i;}$C$F$-$?(B
$B%U%!%$%k$rF10l$NJ}K!$GJT=8$G$-$k$h$&$K$7$^$9!#(B
$B%F%-%9%H$rJQ99$7$F%U%!%$%k$KJ]B8$9$k$H!"(B
Emacs$B$O5UJQ49$r9T$$!"I,MW$J$i$P!"2~9T$r(B
$BI|5"2~9T$dI|5"$N$_$KLa$7$^$9!#(B
@vindex find-file-run-dired
@c If the file you specify is actually a directory, @kbd{C-x C-f} invokes
@c Dired, the Emacs directory browser, so that you can ``edit'' the contents
@c of the directory (@pxref{Dired}). Dired is a convenient way to delete,
@c look at, or operate on the files in the directory. However, if the
@c variable @code{find-file-run-dired} is @code{nil}, then it is an error
@c to try to visit a directory.
$B;XDj$7$?%U%!%$%k$,<B:]$K$O%G%#%l%/%H%j$J$i$P!"(B
@kbd{C-x C-f}$B$O(BEmacs$B$N%G%#%l%/%H%j%V%i%&%6$G$"$k(Bdired$B$r5/F0$9$k$N$G!"(B
$B%G%#%l%/%H%j$NFbMF$r!XJT=8!Y$G$-$^$9!J(B@pxref{Dired}$B!K!#(B
dired$B$O!"%G%#%l%/%H%jFb$N%U%!%$%k$r!">C5n$7$?$j!"D/$a$?$j!"(B
$BA`:n$9$k$N$KJXMx$G$9!#(B
$B$7$+$7!"JQ?t(B @code{find-file-run-dired}$B$,(B@code{nil}$B$J$i$P!"(B
$B%G%#%l%/%H%j$rK,Ld$7$h$&$H$9$k$H%(%i!<$K$J$j$^$9!#(B
@c If the file name you specify contains wildcard characters, Emacs
@c visits all the files that match it. @xref{Quoted File Names}, if you
@c want to visit a file whose name actually contains wildcard characters.
$B;XDj$7$?%U%!%$%kL>$K%o%$%k%I%+!<%IJ8;z$,4^$^$l$F$$$k$H!"(B
Emacs$B$O0lCW$9$k$9$Y$F$N%U%!%$%k$rK,Ld$7$^$9!#(B
$B%o%$%k%I%+!<%IJ8;z$=$N$b$N$r4^$`L>A0$N%U%!%$%k$rK,Ld$9$k$K$O!"(B
@xref{Quoted File Names}$B!#(B
@c If you visit a file that the operating system won't let you modify,
@c Emacs makes the buffer read-only, so that you won't go ahead and make
@c changes that you'll have trouble saving afterward. You can make the
@c buffer writable with @kbd{C-x C-q} (@code{vc-toggle-read-only}).
@c @xref{Misc Buffer}.
$B%*%Z%l!<%F%#%s%0%7%9%F%`$,JQ99$r5v$5$J$$%U%!%$%k$rK,Ld$9$k$H!"(B
Emacs$B$O%P%C%U%!$rFI$_=P$7@lMQ$K@_Dj$9$k$N$G!"(B
$B=$@5$G$-$J$+$C$?$j!"=$@5$G$-$F$b$"$H$GJ]B8$K<j4V<h$j$^$9!#(B
@kbd{C-x C-q}$B!J(B@code{vc-toggle-read-only}$B!K$G!"(B
$B%P%C%U%!$r=q$-9~$_2DG=$K$G$-$^$9!#(B
@xref{Misc Buffer}$B!#(B
@kindex C-x C-r
@findex find-file-read-only
@c Occasionally you might want to visit a file as read-only in order to
@c protect yourself from entering changes accidentally; do so by visiting
@c the file with the command @kbd{C-x C-r} (@code{find-file-read-only}).
$B$H$-$K$O!"<+J,$G$^$A$,$C$FJQ99$7$J$$$h$&$K!"(B
$B%U%!%$%k$rFI$_=P$7@lMQ$GK,Ld$7$?$$>l9g$,$"$j$^$9!#(B
$B$=$&$$$&>l9g$K$O!"%3%^%s%I(B@kbd{C-x C-r}$B!J(B@code{find-file-read-only}$B!K$G(B
$B%U%!%$%k$rK,Ld$7$^$9!#(B
@kindex C-x C-v
@findex find-alternate-file
@c If you visit a nonexistent file unintentionally (because you typed the
@c wrong file name), use the @kbd{C-x C-v} command
@c (@code{find-alternate-file}) to visit the file you really wanted.
@c @kbd{C-x C-v} is similar to @kbd{C-x C-f}, but it kills the current
@c buffer (after first offering to save it if it is modified). When it
@c reads the file name to visit, it inserts the entire default file name in
@c the buffer, with point just after the directory part; this is convenient
@c if you made a slight error in typing the name.
$B!J%U%!%$%kL>$r$^$A$,$C$FBG$C$?$j$7$F!K(B
$BB8:_$7$J$$%U%!%$%k$r0U?^$;$:$KK,Ld$7$F$7$^$C$?$H$-$K$O!"(B
@kbd{C-x C-v}$B%3%^%s%I!J(B@code{find-alternate-file}$B!K$r;H$C$F(B
$BK\Ev$NL\E*$N%U%!%$%k$rK,Ld$7$^$9!#(B
@kbd{C-x C-v}$B$O(B@kbd{C-x C-f}$B$HF1MM$G$9$,!"(B
$B!J%P%C%U%!$,JQ99$5$l$F$$$l$P$^$:J]B8$9$k$+$I$&$+J9$$$F$+$i!K(B
$B%+%l%s%H%P%C%U%!$r>C5n$7$^$9!#(B
$BK,Ld$9$k%U%!%$%kL>$rFI$`$H$-$K$O!"(B
$B%_%K%P%C%U%!$K%G%U%)%k%H%U%!%$%kL>A4BN$rA^F~$7!"(B
$B%G%#%l%/%H%jItJ,$ND>8e$K%]%$%s%H$rCV$-$^$9!#(B
$B$3$l$O!"%U%!%$%kL>$r$[$s$N>/$7$^$A$,$C$FF~NO$7$?$H$-$KJXMx$G$9!#(B
@c If you find a file which exists but cannot be read, @kbd{C-x C-f}
@c signals an error.
$BB8:_$9$k$N$KFI$a$J$$%U%!%$%k$rK,Ld$9$k$H!"(B
@kbd{C-x C-f}$B$O%(%i!<$rDLCN$7$^$9!#(B
@kindex C-x 4 f
@findex find-file-other-window
@c @kbd{C-x 4 f} (@code{find-file-other-window}) is like @kbd{C-x C-f}
@c except that the buffer containing the specified file is selected in another
@c window. The window that was selected before @kbd{C-x 4 f} continues to
@c show the same buffer it was already showing. If this command is used when
@c only one window is being displayed, that window is split in two, with one
@c window showing the same buffer as before, and the other one showing the
@c newly requested file. @xref{Windows}.
@kbd{C-x 4 f}$B!J(B@code{find-file-other-window}$B!K$O!"(B
$BJL$N%&%#%s%I%&$G!";XDj$7$?%U%!%$%k$rF~$l$?%P%C%U%!$rA*Br$9$k$3$H$r=|$1$P!"(B
@kbd{C-x C-f}$B$HF1$8$G$9!#(B
@kbd{C-x 4 f}$B$r<B9T$9$k$^$($KA*Br$5$l$F$$$?%&%#%s%I%&$O!"(B
$BF1$8%P%C%U%!$rI=<($7$?$^$^$G$9!#(B
$B%&%#%s%I%&$r(B1$B$D$@$1I=<($7$F$$$k$H$-$K$3$N%3%^%s%I$r;H$&$H!"(B
$B$=$N%&%#%s%I%&$r(B2$B$D$KJ,$1$F!"0lJ}$N%&%#%s%I%&$K$O$^$($HF1MM$KF1$8%P%C%U%!$r(B
$BI=<($7$^$9$,!"$b$&0lJ}$K$O?7$?$K;X<($7$?%U%!%$%k$rI=<($7$^$9!#(B
@xref{Windows}$B!#(B
@kindex C-x 5 f
@findex find-file-other-frame
@c @kbd{C-x 5 f} (@code{find-file-other-frame}) is similar, but opens a
@c new frame, or makes visible any existing frame showing the file you
@c seek. This feature is available only when you are using a window
@c system. @xref{Frames}.
@kbd{C-x 5 f}$B!J(B@code{find-file-other-frame}$B!K$bF1MM$G$9$,!"(B
$B?7$?$J%U%l!<%`$r3+$/$+!"(B
$BA\$7$F$$$k%U%!%$%k$rI=<($7$F$$$k4{B8$N%U%l!<%`$r8+$($k$h$&$K$7$^$9!#(B
$B%&%#%s%I%&%7%9%F%`$r;H$C$F$$$k$H$-$@$1!"(B
$B$3$N5!G=$rMxMQ$G$-$^$9!#(B
@xref{Frames}$B!#(B
@findex find-file-literally
@c If you wish to edit a file as a sequence of characters with no special
@c encoding or conversion, use the @kbd{M-x find-file-literally} command.
@c It visits a file, like @kbd{C-x C-f}, but does not do format conversion
@c (@pxref{Formatted Text}), character code conversion (@pxref{Coding
@c Systems}), or automatic uncompression (@pxref{Compressed Files}).
@c If you already have visited the same file in the usual (non-literal)
@c manner, this command asks you whether to visit it literally instead.
$BFCJL$JId9f2=$dJQ49$r$;$:$K%U%!%$%k$rJ8;z$NNs$H$7$FJT=8$7$?$$$H$-$K$O!"(B
@kbd{M-x find-file-literally}$B%3%^%s%I$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"(B@kbd{C-x C-f}$B$N$h$&$K%U%!%$%k$rK,Ld$7$^$9$,!"(B
$B7A<0JQ49!J(B@pxref{Formatted Text}$B!K!"J8;z%3!<%IJQ49!J(B@pxref{Coding Systems}$B!K!"(B
$B!J05=L$r!K<+F0E83+!J(B@pxref{Compressed Files}$B!K$H$$$C$?$3$H$r$7$^$;$s!#(B
$B!J$=$N$^$^$NJ8;z$NNs$H$7$F$G$O$J$/!KIaDL$NJ}K!$GF1$8%U%!%$%k$r(B
$B$9$G$KK,Ld$7$F$$$k>l9g$K$O!"$3$N%3%^%s%I$O!"(B
$B$=$N$^$^$NJ8;z$NNs$H$7$FK,Ld$9$k$+$I$&$+J9$$$F$-$^$9!#(B
@vindex find-file-hooks
@vindex find-file-not-found-hooks
@c Two special hook variables allow extensions to modify the operation of
@c visiting files. Visiting a file that does not exist runs the functions
@c in the list @code{find-file-not-found-hooks}; this variable holds a list
@c of functions, and the functions are called one by one until one of them
@c returns non-@code{nil}. Any visiting of a file, whether extant or not,
@c expects @code{find-file-hooks} to contain a list of functions and calls
@c them all, one by one. In both cases the functions receive no
@c arguments. Of these two variables, @code{find-file-not-found-hooks}
@c takes effect first. These variables are @emph{not} normal hooks, and
@c their names end in @samp{-hooks} rather than @samp{-hook} to indicate
@c that fact. @xref{Hooks}.
2$B$D$NFCJL$J%U%C%/JQ?t$G!"%U%!%$%k$rK,Ld$9$kA`:n$r=$@5$7$F3HD%$G$-$^$9!#(B
$BB8:_$7$J$$%U%!%$%k$rK,Ld$9$k$H!"(B
@code{find-file-not-found-hooks}$B$N%j%9%HFb$N4X?t72$r<B9T$7$^$9!#(B
$B$3$NJQ?t$O4X?t$N%j%9%H$rJ];}$7$F$$$F!"(B
$B8F$S=P$7$?4X?t$NCf$N$I$l$+$,(B@code{nil}$B0J30$rJV$9$^$G(B1$B$D(B1$B$D=g$K8F$S=P$7$^$9!#(B
$B%U%!%$%k$,B8:_$9$k$+$I$&$+$K4X$o$i$:!"(B
$B$I$s$J%U%!%$%k$rK,Ld$9$k$H$-$G$b(B
@code{find-file-hooks}$B$K$O4X?t$N%j%9%H$,F~$C$F$$$k$H2>Dj$5$l!"(B
$B$=$l$i$N(B1$B$D(B1$B$D$r=g$K$9$Y$F8F$S=P$7$^$9!#(B
$B$$$:$l$N>l9g$G$b!"4X?t$O0z?t$r<u$1<h$j$^$;$s!#(B
2$B$D$NJQ?t$N$&$A!"@h$K(B@code{find-file-not-found-hooks}$B$r;H$$$^$9!#(B
$B$3$l$i$NJQ?t$O%N!<%^%k%U%C%/$G$O$"$j$^(B@emph{$B$;$s(B}$B!#(B
$B$3$l$i$NL>A0$,(B@samp{-hook}$B$G$O$J$/$F(B@samp{-hooks}$B$G=*$C$F$$$k$3$H$G!"(B
$B$=$N;v<B$rI=$7$F$$$^$9!#(B
@xref{Hooks}$B!#(B
@c There are several ways to specify automatically the major mode for
@c editing the file (@pxref{Choosing Modes}), and to specify local
@c variables defined for that file (@pxref{File Variables}).
$BJT=8$9$k%U%!%$%k$KBP$7$F<+F0E*$K%a%8%c!<%b!<%I!J(B@pxref{Choosing Modes}$B!K$r(B
$B@_Dj$7!"$=$N%U%!%$%k$KBP$7$FFCJL$J%m!<%+%kJQ?t!J(B@pxref{File Variables}$B!K$r(B
$BDj5A$9$kJ}K!$,$$$/$D$+$"$j$^$9!#(B
@node Saving
@c @section Saving Files
@section $B%U%!%$%k$rJ]B8$9$k(B
@c @dfn{Saving} a buffer in Emacs means writing its contents back into the file
@c that was visited in the buffer.
Emacs$B$K$*$$$F%P%C%U%!$r(B@dfn{$BJ]B8(B}$B$9$k$H$O!"(B
$B%P%C%U%!$NFbMF$r$=$N%P%C%U%!$NK,Ld@h$N%U%!%$%k$X=q$-La$9$3$H$G$9!#(B
@table @kbd
@item C-x C-s
@c Save the current buffer in its visited file (@code{save-buffer}).
$B%+%l%s%H%P%C%U%!$rK,Ld@h$N%U%!%$%k$KJ]B8$9$k!J(B@code{save-buffer}$B!K!#(B
@item C-x s
@c Save any or all buffers in their visited files (@code{save-some-buffers}).
$BG$0U$N%P%C%U%!$+$9$Y$F$N%P%C%U%!$r$=$l$>$l$NK,Ld@h$N%U%!%$%k$KJ]B8$9$k(B
$B!J(B@code{save-some-buffers}$B!K!#(B
@item M-~
@c Forget that the current buffer has been changed (@code{not-modified}).
$B%+%l%s%H%P%C%U%!$rJQ99$7$F$$$J$$$3$H$K$9$k!J(B@code{not-modified}$B!K!#(B
@item C-x C-w
@c Save the current buffer in a specified file (@code{write-file}).
$B%+%l%s%H%P%C%U%!$r;XDj$7$?%U%!%$%k$KJ]B8$9$k!J(B@code{write-file}$B!K!#(B
@item M-x set-visited-file-name
@c Change file the name under which the current buffer will be saved.
$B%+%l%s%H%P%C%U%!$rJ]B8$9$k%U%!%$%k$NL>A0$rJQ99$9$k!#(B
@end table
@kindex C-x C-s
@findex save-buffer
@c When you wish to save the file and make your changes permanent, type
@c @kbd{C-x C-s} (@code{save-buffer}). After saving is finished, @kbd{C-x C-s}
@c displays a message like this:
$B%U%!%$%k$rJ]B8$7$FJQ99$r915WE*$J$b$N$H$9$k$K$O!"(B
@kbd{C-x C-s}$B!J(B@code{save-buffer}$B!K$HBG$A$^$9!#(B
$BJ]B8$r40N;$9$k$H(B@kbd{C-x C-s}$B$O$D$.$N$h$&$J%a%C%;!<%8$rI=<($7$^$9!#(B
@example
Wrote /u/rms/gnu/gnu.tasks
@end example
@noindent
@c If the selected buffer is not modified (no changes have been made in it
@c since the buffer was created or last saved), saving is not really done,
@c because it would have no effect. Instead, @kbd{C-x C-s} displays a message
@c like this in the echo area:
$BA*Br$5$l$F$$$k%P%C%U%!$,JQ99$5$l$F$$$J$1$l$P(B
$B!J%P%C%U%!$r:n$C$F0J9_!"$"$k$$$O!":G8e$KJ]B8$7$F0J9_$K!"JQ99$5$l$F$$$J$$!K!"(B
$BJ]B8$7$F$b2?$b$J$i$J$$$N$G<B:]$K$OJ]B8$7$^$;$s!#(B
$B$+$o$j$K!"(B@kbd{C-x C-s}$B$O$D$.$N$h$&$J%a%C%;!<%8$r%(%3!<NN0h$KI=<($7$^$9!#(B
@example
(No changes need to be saved)
@end example
@kindex C-x s
@findex save-some-buffers
@c The command @kbd{C-x s} (@code{save-some-buffers}) offers to save any
@c or all modified buffers. It asks you what to do with each buffer. The
@c possible responses are analogous to those of @code{query-replace}:
$B%3%^%s%I(B@kbd{C-x s}$B!J(B@code{save-some-buffers}$B!K$O!"(B
$BJQ99$5$l$?G$0U$N%P%C%U%!$d$9$Y$F$N%P%C%U%!$rJ]B8$G$-$k$h$&$K$7$^$9!#(B
$B3F%P%C%U%!$K$D$$$F!"2?$r$9$k$+J9$$$F$-$^$9!#(B
$B$3$N$H$-A*$Y$kJVEz$O!"(B@code{query-replace}$B$KBP$9$k$b$N$K;w$F$$$^$9!#(B
@table @kbd
@item y
@c Save this buffer and ask about the rest of the buffers.
$B$3$N%P%C%U%!$rJ]B8$7!";D$j$N%P%C%U%!$K$D$$$F$b<ALd$9$k!#(B
@item n
@c Don't save this buffer, but ask about the rest of the buffers.
$B$3$N%P%C%U%!$rJ]B8$7$J$$$,!";D$j$N%P%C%U%!$K$D$$$F$O<ALd$9$k!#(B
@item !
@c Save this buffer and all the rest with no more questions.
@c @c following generates acceptable underfull hbox
$B$3$N%P%C%U%!$rJ]B8$7!"(B
$B;D$j$N$9$Y$F$N%P%C%U%!$K$D$$$F$b<ALd$;$:$KJ]B8$9$k!#(B
@item @key{RET}
@c Terminate @code{save-some-buffers} without any more saving.
$B2?$bJ]B8$;$:$K(B@code{save-some-buffers}$B$r=*N;$9$k!#(B
@item .
@c Save this buffer, then exit @code{save-some-buffers} without even asking
@c about other buffers.
$B$3$N%P%C%U%!$rJ]B8$7!"B>$N%P%C%U%!$K$D$$$F$O2?$bJ9$+$:$K(B
@code{save-some-buffers}$B$r=*$($k!#(B
@item C-r
@c View the buffer that you are currently being asked about. When you exit
@c View mode, you get back to @code{save-some-buffers}, which asks the
@c question again.
$B<ALdBP>]$N%P%C%U%!$r1\Mw$9$k!#(B
$B1\Mw!J(Bview$B!K%b!<%I$+$iH4$1$k$H!"(B@code{save-some-buffers}$B$KLa$j$U$?$?$S<ALd$9$k!#(B
@item C-h
@c Display a help message about these options.
$B$3$l$i$N%*%W%7%g%s$K$D$$$F$N%X%k%W%a%C%;!<%8$rI=<($9$k!#(B
@end table
@c @kbd{C-x C-c}, the key sequence to exit Emacs, invokes
@c @code{save-some-buffers} and therefore asks the same questions.
Emacs$B$+$iH4$1$k%-!<Ns(B@kbd{C-x C-c}$B$O!"(B
@code{save-some-buffers}$B$r5/F0$9$k$N$G!"F1$8<ALd$r$7$F$-$^$9!#(B
@kindex M-~
@findex not-modified
@c If you have changed a buffer but you do not want to save the changes,
@c you should take some action to prevent it. Otherwise, each time you use
@c @kbd{C-x s} or @kbd{C-x C-c}, you are liable to save this buffer by
@c mistake. One thing you can do is type @kbd{M-~} (@code{not-modified}),
@c which clears out the indication that the buffer is modified. If you do
@c this, none of the save commands will believe that the buffer needs to be
@c saved. (@samp{~} is often used as a mathematical symbol for `not'; thus
@c @kbd{M-~} is `not', metafied.) You could also use
@c @code{set-visited-file-name} (see below) to mark the buffer as visiting
@c a different file name, one which is not in use for anything important.
@c Alternatively, you can cancel all the changes made since the file was
@c visited or saved, by reading the text from the file again. This is
@c called @dfn{reverting}. @xref{Reverting}. You could also undo all the
@c changes by repeating the undo command @kbd{C-x u} until you have undone
@c all the changes; but reverting is easier.
$B%P%C%U%!$rJQ99$7$?$1$l$I$bJQ99$rJ]B8$7$?$/$J$$$J$i$P!"(B
$B$=$l$rHr$1$k$?$a$N=hCV$r$9$Y$-$G$7$g$&!#(B
$B$=$&$7$J$$$H!"(B@kbd{C-x s}$B$d(B@kbd{C-x C-c}$B$r;H$&$?$S$K!"(B
$B$^$A$,$C$F%P%C%U%!$rJ]B8$7$F$7$^$$$,$A$G$9!#(B
1$B$D$NJ}K!$O!"(B@kbd{M-~}$B!J(B@code{not-modified}$B!K$HBG$D$3$H$G$9!#(B
$B$3$l$O!"%P%C%U%!$,JQ99$5$l$F$$$k$3$H$r<($9%U%i%0$r>C$7$^$9!#(B
$B$3$&$7$F$*$/$H!"J]B8%3%^%s%I$O%P%C%U%!$rJ]B8$9$kI,MW$,$J$$$H7kO@$7$^$9!#(B
$B!J(B@samp{~}$B$O!VH]Dj!W!J(Bnot$B!K$r0UL#$9$k?t3X5-9f$H$7$F$7$P$7$P;H$o$l$k!#(B
$B$h$C$F(B@kbd{M-~}$B$O!"%a%?IU$-!VH]Dj!W!#!K(B
@code{set-visited-file-name}$B!J2<5-;2>H!K$r;H$C$F!"(B
$BJL$N%U%!%$%k$rK,Ld$7$F$$$k%P%C%U%!$G$"$k;]$N0u$rIU$1$k$3$H$b$G$-$^$9!#(B
$B$3$N$H$-%U%!%$%kL>$K$O!"=EMW$G$J$$;H$C$F$$$J$$$b$N$r;XDj$7$^$9!#(B
$B$"$k$$$O!"%U%!%$%k$+$i%F%-%9%H$r:FEYFI$_D>$7$F!"(B
$B%U%!%$%k$rK,Ld$7$?$jJ]B8$7$?$j$7$?0J9_$N$9$Y$F$NJQ99$r<h$j>C$7$^$9!#(B
$B$3$l$r(B@dfn{$BI|85(B}$B!J(Breverting$B!K$H$$$$$^$9!#(B
@xref{Reverting}$B!#(B
$B$9$Y$F$NJQ99$,$b$H$KLa$k$^$G%"%s%I%%%3%^%s%I(B@kbd{C-x u}$B$r7+$jJV$7;H$C$F!"(B
$BJQ99$7$J$+$C$?$3$H$K$b$G$-$^$9!#(B
$B$7$+$7!"I|85$N$[$&$,4JC1$G$9!#(B
@findex set-visited-file-name
@c @kbd{M-x set-visited-file-name} alters the name of the file that the
@c current buffer is visiting. It reads the new file name using the
@c minibuffer. Then it specifies the visited file name and changes the
@c buffer name correspondingly (as long as the new name is not in use).
@c @code{set-visited-file-name} does not save the buffer in the newly
@c visited file; it just alters the records inside Emacs in case you do
@c save later. It also marks the buffer as ``modified'' so that @kbd{C-x
@c C-s} in that buffer @emph{will} save.
@kbd{M-x set-visited-file-name}$B$O!"(B
$B%+%l%s%H%P%C%U%!$GK,Ld$7$F$$$k%U%!%$%k$NL>A0$rJQ99$7$^$9!#(B
$B$3$N%3%^%s%I$O!"%_%K%P%C%U%!$G?7$?$J%U%!%$%kL>$rFI$_<h$j$^$9!#(B
$B$=$7$F!"K,Ld@h%U%!%$%kL>$r@_Dj$7D>$7!"(B
$B$=$l$K=>$C$F!J?7$7$$L>A0$,;H$o$l$F$$$J$1$l$P!K(B
$B%P%C%U%!L>$bJQ99$7$^$9!#(B
@code{set-visited-file-name}$B$O!"(B
$B?7$?$K;XDj$7$?K,Ld@h$N%U%!%$%k$X$O%P%C%U%!$rJ]B8$7$^$;$s!#(B
$B$"$H$GJ]B8$9$k>l9g$KHw$($F!"(BEmacs$BFbIt$N5-O?$rJQ99$9$k$@$1$G$9!#(B
$B$^$?!"%P%C%U%!$K$O!XJQ99$5$l$?!Y;]$N0u$rIU$1!"(B
@kbd{C-x C-s}$B$,$=$N%P%C%U%!$rJ]B8(B@emph{$B$7$h$&$H$9$k(B}$B$h$&$K$7$^$9!#(B
@kindex C-x C-w
@findex write-file
@c If you wish to mark the buffer as visiting a different file and save it
@c right away, use @kbd{C-x C-w} (@code{write-file}). It is precisely
@c equivalent to @code{set-visited-file-name} followed by @kbd{C-x C-s}.
@c @kbd{C-x C-s} used on a buffer that is not visiting a file has the
@c same effect as @kbd{C-x C-w}; that is, it reads a file name, marks the
@c buffer as visiting that file, and saves it there. The default file name in
@c a buffer that is not visiting a file is made by combining the buffer name
@c with the buffer's default directory.
$BJL$N%U%!%$%k$rK,Ld$7$F$$$k$H$$$&;]$N0u$r%P%C%U%!$KIU$1$F!"(B
$B$?$@$A$KJ]B8$7$?$$>l9g$K$O!"(B@kbd{C-x C-w}$B!J(B@code{write-file}$B!K$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"(B@code{set-visited-file-name}$B$KB3$1$F(B@kbd{C-x C-s}$B$r(B
$B<B9T$9$k$N$HEy2A$G$9!#(B
$B%U%!%$%k$rK,Ld$7$F$$$J$$%P%C%U%!$KBP$7$F(B@kbd{C-x C-s}$B$r;H$&$3$H$O!"(B
@kbd{C-x C-w}$B$HF1$88z2L$,$"$j$^$9!#(B
$B$D$^$j!"%U%!%$%kL>$rFI$_<h$j!"(B
$B%P%C%U%!$K$O$=$N%U%!%$%k$rK,Ld$7$F$$$k$H$$$&0u$rIU$1!"(B
$B%P%C%U%!$r$=$N%U%!%$%k$KJ]B8$7$^$9!#(B
$B%U%!%$%k$rK,Ld$7$F$$$J$$%P%C%U%!$N%G%U%)%k%H$N%U%!%$%kL>$O!"(B
$B%P%C%U%!$N%G%U%)%k%H%G%#%l%/%H%j$H%P%C%U%!L>$rAH$_9g$o$;$F:n$j$^$9!#(B
@c If the new file name implies a major mode, then @kbd{C-x C-w} switches
@c to that major mode, in most cases. The command
@c @code{set-visited-file-name} also does this. @xref{Choosing Modes}.
$B?7$7$$%U%!%$%kL>$,%a%8%c!<%b!<%I$r<(:6$9$k$b$N$G$"$l$P!"(B
@kbd{C-x C-w}$B$O!"B?$/$N>l9g!"$=$N%a%8%c!<%b!<%I$K@Z$jBX$($^$9!#(B
$B%3%^%s%I(B@code{set-visited-file-name}$B$b$=$N$h$&$K$7$^$9!#(B
@xref{Choosing Modes}$B!#(B
@c If Emacs is about to save a file and sees that the date of the latest
@c version on disk does not match what Emacs last read or wrote, Emacs
@c notifies you of this fact, because it probably indicates a problem caused
@c by simultaneous editing and requires your immediate attention.
@c @xref{Interlocking,, Simultaneous Editing}.
Emacs$B$,%U%!%$%k$rJ]B8$7$h$&$H$9$k$H$-$K!"(B
$B%G%#%9%/>e$N:G?7HG$NF|IU$,(BEmacs$B$,:G8e$KFI$_=q$-$7$?$b$N$H9g$o$J$+$C$?$i!"(B
Emacs$B$O$=$N$3$H$rDLCN$7$^$9!#(B
$B$H$$$&$N$O!"F1;~$KJT=8$7$?$?$a$K0z$-5/$3$5$l$?LdBj$G$"$k2DG=@-$,$"$k$N$G!"(B
$B%f!<%6!<$K$?$@$A$KCN$i$;$kI,MW$,$"$k$+$i$G$9!#(B
@xref{Interlocking}$B!#(B
@vindex require-final-newline
@c If the variable @code{require-final-newline} is non-@code{nil}, Emacs
@c puts a newline at the end of any file that doesn't already end in one,
@c every time a file is saved or written. The default is @code{nil}.
$BJQ?t(B@code{require-final-newline}$B$,(B@code{nil}$B0J30$@$H!"(B
Emacs$B$O%U%!%$%k$rJ]B8$9$k$?$S$K!"(B
$B%U%!%$%k$NKvHx$K2~9T$,$J$1$l$P2~9T$rA^F~$7$^$9!#(B
$B%G%U%)%k%H$O(B@code{nil}$B$G$9!#(B
@menu
* Backup:: How Emacs saves the old version of your file.
* Interlocking:: How Emacs protects against simultaneous editing
of one file by two users.
@end menu
@node Backup
@c @subsection Backup Files
@c @cindex backup file
@subsection $B%P%C%/%"%C%W%U%!%$%k(B
@cindex $B%P%C%/%"%C%W%U%!%$%k(B
@vindex make-backup-files
@vindex vc-make-backup-files
@vindex backup-enable-predicate
@c On most operating systems, rewriting a file automatically destroys all
@c record of what the file used to contain. Thus, saving a file from Emacs
@c throws away the old contents of the file---or it would, except that
@c Emacs carefully copies the old contents to another file, called the
@c @dfn{backup} file, before actually saving.
$BB?$/$N%*%Z%l!<%F%#%s%0%7%9%F%`$G$O!"(B
$B%U%!%$%k$r=q$-49$($k$H%U%!%$%k$KF~$C$F$$$?$=$l$^$G$N5-O?$O(B
$B<+F0E*$KGK4~$5$l$^$9!#(B
$B$7$?$,$C$F!"(BEmacs$B$G%U%!%$%k$rJ]B8$9$k$H!"%U%!%$%k$N8E$$FbMF$O<N$F$i$l$^$9!#(B
$B$7$+$7!"<B:]$KJ]B8$9$k$^$($K!"8E$$FbMF$r(B@dfn{$B%P%C%/%"%C%W(B}$B%U%!%$%k(B
$B$H8F$P$l$kJL$N%U%!%$%k$K(BEmacs$B$,Cm0U?<$/%3%T!<$9$l$P!"(B
$B8E$$FbMF$OGK4~$5$l$^$;$s!#(B
@c For most files, the variable @code{make-backup-files} determines
@c whether to make backup files. On most operating systems, its default
@c value is @code{t}, so that Emacs does write backup files.
$B$[$H$s$I$N%U%!%$%k$G$O!"(B
$B%P%C%/%"%C%W%U%!%$%k$r:n$k$+$I$&$+$O(B
$BJQ?t(B@code{make-backup-files}$B$G7h$^$j$^$9!#(B
$BB?$/$N%*%Z%l!<%F%#%s%0%7%9%F%`$G$O!"$3$NJQ?t$N%G%U%)%k%HCM$O(B@code{t}$B$G$"$j!"(B
Emacs$B$O%P%C%/%"%C%W%U%!%$%k$r:n$j$^$9!#(B
@c For files managed by a version control system (@pxref{Version
@c Control}), the variable @code{vc-make-backup-files} determines whether
@c to make backup files. By default, it is @code{nil}, since backup files
@c are redundant when you store all the previous versions in a version
@c control system. @xref{VC Workfile Handling}.
$BHG4IM}%7%9%F%`!J(B@pxref{Version Control}$B!K$,4IM}$9$k%U%!%$%k$KBP$7$F$O!"(B
$B%P%C%/%"%C%W%U%!%$%k$r:n$k$+$I$&$+$O(B
$BJQ?t(B@code{vc-make-backup-files}$B$G7h$^$j$^$9!#(B
$B%G%U%)%k%H$O(B@code{nil}$B$G$9!#(B
$B$H$$$&$N$O!"$9$Y$F$N8E$$HG$rHG4IM}%7%9%F%`$KJ]4I$7$F$"$k$N$G!"(B
$B%P%C%/%"%C%W%U%!%$%k$O>iD9$@$+$i$G$9!#(B
@xref{VC Workfile Handling}$B!#(B
@c The default value of the @code{backup-enable-predicate} variable
@c prevents backup files being written for files in @file{/tmp}.
$BJQ?t(B@code{backup-enable-predicate}$B$N%G%U%)%k%HCM$O!"(B
@file{/tmp}$B$K$"$k%U%!%$%k$N%P%C%/%"%C%W%U%!%$%k$r(B
$B:n$i$J$$$h$&$K$7$^$9!#(B
@c At your option, Emacs can keep either a single backup file or a series of
@c numbered backup files for each file that you edit.
Emacs$B$G$O!"C10l$N%P%C%/%"%C%W%U%!%$%k$rJ];}$9$k$3$H$b!"(B
$BJT=8$7$?3F%U%!%$%k$4$H$K0lO"$NHV9fIU$-%P%C%/%"%C%W%U%!%$%k$r(B
$BJ];}$9$k$3$H$b$G$-$^$9!#(B
@c Emacs makes a backup for a file only the first time the file is saved
@c from one buffer. No matter how many times you save a file, its backup file
@c continues to contain the contents from before the file was visited.
@c Normally this means that the backup file contains the contents from before
@c the current editing session; however, if you kill the buffer and then visit
@c the file again, a new backup file will be made by the next save.
Emacs$B$,%U%!%$%k$N%P%C%/%"%C%W%U%!%$%k$r:n$k$N$O!"(B
$B%P%C%U%!$+$i$=$N%U%!%$%k$X:G=i$KJ]B8$7$?$H$-$@$1$G$9!#(B
$B$?$H$(2?EY%U%!%$%k$rJ]B8$7$?$H$7$F$b!"(B
$B$=$N%P%C%/%"%C%W%U%!%$%k$O!"%U%!%$%k$rK,Ld$9$k0JA0$NFbMF$rJ];}$7B3$1$^$9!#(B
$BDL>o$3$l$O!":#$NJT=8%;%C%7%g%s$r;O$a$k0JA0$NFbMF$r(B
$B%P%C%/%"%C%W%U%!%$%k$,J];}$7$F$$$k$3$H$r0UL#$7$^$9!#(B
$B$7$+$7$J$,$i!"%P%C%U%!$r>C5n$7$F$+$i:FEY%U%!%$%k$rK,Ld$9$k$H!"(B
$B$=$l0J9_$KJ]B8$9$k$H$-$K$O?7$?$K%P%C%/%"%C%W%U%!%$%k$r:n$j$^$9!#(B
@c You can also explicitly request making another backup file from a
@c buffer even though it has already been saved at least once. If you save
@c the buffer with @kbd{C-u C-x C-s}, the version thus saved will be made
@c into a backup file if you save the buffer again. @kbd{C-u C-u C-x C-s}
@c saves the buffer, but first makes the previous file contents into a new
@c backup file. @kbd{C-u C-u C-u C-x C-s} does both things: it makes a
@c backup from the previous contents, and arranges to make another from the
@c newly saved contents, if you save again.
$B>/$J$/$H$b0lEY$OJ]B8$7$?$H$7$F$b!"(B
$B%P%C%U%!$+$i$b$&(B1$B$D%P%C%/%"%C%W%U%!%$%k$r:n$k$h$&$KL@<(E*$K(B
$B;X<($9$k$3$H$b$G$-$^$9!#(B
@kbd{C-u C-x C-s}$B$G%P%C%U%!$rJ]B8$9$k$H!"(B
$B$3$N$H$-J]B8$7$?HG$O!"%P%C%U%!$r:FEYJ]B8$9$k$H$-$K$O(B
$B%P%C%/%"%C%W%U%!%$%k$K$J$j$^$9!#(B
@kbd{C-u C-u C-x C-s}$B$b%P%C%U%!$rJ]B8$7$^$9$,!"(B
$B$^$:%U%!%$%k$N8E$$FbMF$r%P%C%/%"%C%W%U%!%$%k$K$7$^$9!#(B
@kbd{C-u C-u C-u C-x C-s} $B$O$=$NN>J}$r9T$$$^$9!#(B
$B%U%!%$%k$N0JA0$NFbMF$+$i%P%C%/%"%C%W%U%!%$%k$r:n$j!"(B
$B$5$i$K!"%P%C%U%!$r:FEYJ]B8$9$k$H$3$N$H$-J]B8$7$?HG$+$i(B
$B$b$&(B1$B$D%P%C%/%"%C%W%U%!%$%k$r:n$k$h$&$K=`Hw$7$^$9!#(B
@menu
* Names: Backup Names. How backup files are named;
choosing single or numbered backup files.
* Deletion: Backup Deletion. Emacs deletes excess numbered backups.
* Copying: Backup Copying. Backups can be made by copying or renaming.
@end menu
@node Backup Names
@c @subsubsection Single or Numbered Backups
@subsubsection $BC10l%P%C%/%"%C%W%U%!%$%k$HHV9fIU$-%P%C%/%"%C%W%U%!%$%k(B
@c If you choose to have a single backup file (this is the default),
@c the backup file's name is constructed by appending @samp{~} to the
@c file name being edited; thus, the backup file for @file{eval.c} would
@c be @file{eval.c~}.
$BC10l%P%C%/%"%C%W%U%!%$%k$r:n$k$3$H$rA*Br$9$k$H!J%G%U%)%k%H!K!"(B
$B%P%C%/%"%C%W%U%!%$%k$NL>A0$O!"(B
$BJT=8$7$F$$$k%U%!%$%k$NL>A0$K(B@samp{~}$B$rIU2C$7$?$b$N$K$J$j$^$9!#(B
$B$7$?$,$C$F!"(B@file{eval.c}$B$N%P%C%/%"%C%W%U%!%$%k$O(B@file{eval.c~}$B$H$J$j$^$9!#(B
@c If you choose to have a series of numbered backup files, backup file
@c names are made by appending @samp{.~}, the number, and another @samp{~} to
@c the original file name. Thus, the backup files of @file{eval.c} would be
@c called @file{eval.c.~1~}, @file{eval.c.~2~}, and so on, through names
@c like @file{eval.c.~259~} and beyond.
$BHV9fIU$-$N0lO"$N%P%C%/%"%C%W%U%!%$%k$r:n$k$3$H$rA*Br$9$k$H!"(B
$B%P%C%/%"%C%W%U%!%$%k$NL>A0$O!"$b$H$N%U%!%$%kL>$K(B
@samp{.~}$B$H?t;z$H$b$&(B1$B$D(B@samp{~}$B$rIU2C$7$?$b$N$K$J$j$^$9!#(B
$B$7$?$,$C$F!"(B@file{eval.c}$B$N%P%C%/%"%C%W%U%!%$%k$O!"(B
@file{eval.c.~1~}$B!"(B@file{eval.c.~2~}$B!"!D!"(B@file{eval.c.~259~}$B$H$$$&$h$&$K(B
$B$I$3$^$G$bB3$-$^$9!#(B
@c If protection stops you from writing backup files under the usual names,
@c the backup file is written as @file{%backup%~} in your home directory.
@c Only one such file can exist, so only the most recently made such backup is
@c available.
$BJ]8n5!9=$N$?$a$K(B
$BIaDL$NL>A0$G%P%C%/%"%C%W%U%!%$%k$r=q$1$J$/$J$k$H!"(B
$B%f!<%6!<$N%[!<%`%G%#%l%/%H%j$N(B@file{%backup%~}$B$K(B
$B%P%C%/%"%C%W%U%!%$%k$r=q$-$^$9!#(B
$B$=$N%U%!%$%k$O$?$C$?(B1$B$D$7$+B8:_$G$-$J$$$N$G!"(B
$B:G?7$N%P%C%/%"%C%W$K$7$+MxMQ$G$-$^$;$s!#(B
@vindex version-control
@c The choice of single backup or numbered backups is controlled by the
@c variable @code{version-control}. Its possible values are
$BC10l%P%C%/%"%C%W$+HV9fIU$-%P%C%/%"%C%W$+$NA*Br$O!"(B
$BJQ?t(B@code{version-control}$B$G@)8f$5$l$^$9!#(B
$B$3$NJQ?t$K@_Dj$G$-$kCM$O$D$.$N$H$*$j$G$9!#(B
@table @code
@item t
@c Make numbered backups.
$BHV9fIU$-%P%C%/%"%C%W$r:n$k!#(B
@item nil
@c Make numbered backups for files that have numbered backups already.
@c Otherwise, make single backups.
$B%U%!%$%k$KBP$7$FHV9fIU$-%P%C%/%"%C%W%U%!%$%k$,$9$G$K$"$k$J$i$P(B
$BHV9fIU$-%P%C%/%"%C%W$r:n$k!#(B
$B$5$b$J$1$l$P!"C10l%P%C%/%"%C%W$r:n$k!#(B
@item never
@c Do not in any case make numbered backups; always make single backups.
$B$I$s$J>l9g$K$bHV9fIU$-%P%C%/%"%C%W$r:n$i$J$$!#(B
$B$D$M$KC10l%P%C%/%"%C%W$r:n$k!#(B
@end table
@noindent
@c You can set @code{version-control} locally in an individual buffer to
@c control the making of backups for that buffer's file. For example,
@c Rmail mode locally sets @code{version-control} to @code{never} to make sure
@c that there is only one backup for an Rmail file. @xref{Locals}.
$B3F%P%C%U%!$G$O%m!<%+%k$K(B@code{version-control}$B$r@_Dj$G$-$k$N$G!"(B
$B$=$N%P%C%U%!$N%U%!%$%k$KBP$9$k%P%C%/%"%C%W$N:n@.J}K!$r@)8f$G$-$^$9!#(B
$B$?$H$($P!"(Brmail$B%b!<%I$G$O!"(B
rmail$B%U%!%$%k$N%P%C%/%"%C%W$r(B1$B8D$@$1$K8BDj$9$k$?$a$K!"(B
@code{version-control}$B$K$O%m!<%+%k$K(B@code{never}$B$r@_Dj$7$^$9!#(B
@xref{Locals}$B!#(B
@c @cindex @code{VERSION_CONTROL} environment variable
@cindex $B4D6-JQ?t(B@code{VERSION_CONTROL}
@cindex @code{VERSION_CONTROL}$B!J4D6-JQ?t!K(B
@c If you set the environment variable @code{VERSION_CONTROL}, to tell
@c various GNU utilities what to do with backup files, Emacs also obeys the
@c environment variable by setting the Lisp variable @code{version-control}
@c accordingly at startup. If the environment variable's value is @samp{t}
@c or @samp{numbered}, then @code{version-control} becomes @code{t}; if the
@c value is @samp{nil} or @samp{existing}, then @code{version-control}
@c becomes @code{nil}; if it is @samp{never} or @samp{simple}, then
@c @code{version-control} becomes @code{never}.
$B4D6-JQ?t(B@code{VERSION_CONTROL}$B$r@_Dj$9$k$H!"(B
$B$5$^$6$^$J(BGNU$B%f!<%F%#%j%F%#$K(B
$B$I$N$h$&$K%P%C%/%"%C%W%U%!%$%k$r07$&$+;X<($G$-$^$9!#(B
Emacs$B$b4D6-JQ?t$K=>$C$FF0:n$7!"(B
$B3+;O;~$K$=$l$K0lCW$9$k$h$&$K(BLisp$BJQ?t(B@code{version-control}$B$r@_Dj$7$^$9!#(B
$B4D6-JQ?t$NCM$,(B@samp{t}$B$+(B@samp{numbered}$B$J$i!"(B
@code{version-control}$B$O(B@code{t}$B$K$J$j$^$9!#(B
$B4D6-JQ?t$NCM$,(B@samp{nil}$B$+(B@samp{existing}$B$J$i!"(B
@code{version-control}$B$O(B@code{nil}$B$K$J$j$^$9!#(B
$B4D6-JQ?t$NCM$,(B@samp{never}$B$+(B@samp{simple}$B$J$i!"(B
@code{version-control}$B$O(B@code{never}$B$K$J$j$^$9!#(B
@node Backup Deletion
@c @subsubsection Automatic Deletion of Backups
@subsubsection $B%P%C%/%"%C%W$N<+F0:o=|(B
@c To prevent unlimited consumption of disk space, Emacs can delete numbered
@c backup versions automatically. Generally Emacs keeps the first few backups
@c and the latest few backups, deleting any in between. This happens every
@c time a new backup is made.
$B%G%#%9%/MFNL$rL58B$KO2Hq$9$k$3$H$rHr$1$k$?$a$K!"(B
Emacs$B$OHV9fIU$-%P%C%/%"%C%W$NHG$r<+F0E*$K:o=|$G$-$^$9!#(B
$B0lHL$K$O!"(BEmacs$B$O;O$a$N?t8D$H:G?7$N?t8D$N%P%C%/%"%C%W$r;D$7$F!"(B
$B$=$N$"$$$@$N$b$N$r$9$Y$F:o=|$7$^$9!#(B
$B$3$l$O!"?7$?$K%P%C%/%"%C%W$r:n$k$4$H$K9T$o$l$^$9!#(B
@vindex kept-old-versions
@vindex kept-new-versions
@c The two variables @code{kept-old-versions} and
@c @code{kept-new-versions} control this deletion. Their values are,
@c respectively the number of oldest (lowest-numbered) backups to keep and
@c the number of newest (highest-numbered) ones to keep, each time a new
@c backup is made. Recall that these values are used just after a new
@c backup version is made; that newly made backup is included in the count
@c in @code{kept-new-versions}. By default, both variables are 2.
2$B$D$NJQ?t(B@code{kept-old-versions}$B$H(B@code{kept-new-versions}$B$O!"(B
$B$3$N$h$&$J:o=|$r@)8f$7$^$9!#(B
$B$=$l$i$NCM$O!"$=$l$>$l!"?7$?$K%P%C%/%"%C%W$r:n$k$H$-$K!"(B
$BJ];}$9$Y$-:G8E!JHV9f$,:G>.!K$N%P%C%/%"%C%W$N8D?t!"(B
$BJ];}$9$Y$-:G?7!JHV9f$,:GBg!K$N%P%C%/%"%C%W$N8D?t$G$9!#(B
$B$=$l$i$NCM$O!"%P%C%/%"%C%W$N?7HG$r:n$C$?D>8e$K;H$o$l$k$3$H$K(B
$BCm0U$7$F$/$@$5$$!#(B
$B?7$?$K:n$C$?%P%C%/%"%C%W$b!"(B@code{kept-new-versions}$B$N?t$K4^$^$l$^$9!#(B
$B%G%U%)%k%H$G$O!"$I$A$i$NJQ?t$b(B2$B$G$9!#(B
@vindex delete-old-versions
@c If @code{delete-old-versions} is non-@code{nil}, the excess
@c middle versions are deleted without a murmur. If it is @code{nil}, the
@c default, then you are asked whether the excess middle versions should
@c really be deleted.
@code{delete-old-versions}$B$,(B@code{nil}$B0J30$J$i$P!"(B
$B2?$b$$$o$:$KM>J,$JCf4V$NHG$r:o=|$7$^$9!#(B
$B%G%U%)%k%HCM$G$"$k(B@code{nil}$B$J$i$P!"(B
$BM>J,$JCf4V$NHG$r:o=|$9$k$+$I$&$+$rJ9$$$F$-$^$9!#(B
@c Dired's @kbd{.} (Period) command can also be used to delete old versions.
@c @xref{Dired Deletion}.
dired$B$N(B@kbd{.}$B!J%T%j%*%I!K%3%^%s%I$b8E$$HG$r:o=|$9$k$?$a$K;H$($^$9!#(B
@xref{Dired Deletion}$B!#(B
@node Backup Copying
@c @subsubsection Copying vs.@: Renaming
@subsubsection $B%3%T!<$H2~L>(B
@c Backup files can be made by copying the old file or by renaming it. This
@c makes a difference when the old file has multiple names. If the old file
@c is renamed into the backup file, then the alternate names become names for
@c the backup file. If the old file is copied instead, then the alternate
@c names remain names for the file that you are editing, and the contents
@c accessed by those names will be the new contents.
$B%P%C%/%"%C%W%U%!%$%k$O!"8E$$%U%!%$%k$r%3%T!<$9$k!"$"$k$$$O!"(B
$B$=$l$r2~L>$9$k$3$H$G:n$j$^$9!#(B
$B8E$$%U%!%$%k$KJ#?t$NL>A0$,$"$k$H!"$3$l$K$O0c$$$,=P$F$-$^$9!#(B
$B8E$$%U%!%$%k$r2~L>$7$F%P%C%/%"%C%W%U%!%$%k$K$9$k$H!"(B
$B!J8E$$%U%!%$%k$N!KJL$NL>A0$b%P%C%/%"%C%W%U%!%$%k$r;X$7$^$9!#(B
$B8E$$%U%!%$%k$r%3%T!<$7$?>l9g$K$O!"(B
$B!J8E$$%U%!%$%k$N!KJL$NL>A0$OJT=8$7$F$$$k%U%!%$%k$r;X$7B3$1!"(B
$B$=$NL>A0$G;2>H$5$l$kFbMF$b?7$7$$FbMF$K$J$j$^$9!#(B
@c The method of making a backup file may also affect the file's owner
@c and group. If copying is used, these do not change. If renaming is used,
@c you become the file's owner, and the file's group becomes the default
@c (different operating systems have different defaults for the group).
$B%P%C%/%"%C%W%U%!%$%k$r:n$kJ}K!$O!"(B
$B85%U%!%$%k$N=jM-<T$H%0%k!<%W$K$b1F6A$7$^$9!#(B
$B%3%T!<$9$k$J$i$P!"2?$bJQ99$5$l$^$;$s!#(B
$B2~L>$9$k$H!"%U%!%$%k$N=jM-<T$O$"$J$?$K$J$j!"(B
$B%U%!%$%k$N%0%k!<%W$O%G%U%)%k%H$K$J$j$^$9(B
$B!J%*%Z%l!<%F%#%s%0%7%9%F%`$4$H$K%0%k!<%W$N%G%U%)%k%H$O0[$J$k!K!#(B
@c Having the owner change is usually a good idea, because then the owner
@c always shows who last edited the file. Also, the owners of the backups
@c show who produced those versions. Occasionally there is a file whose
@c owner should not change; it is a good idea for such files to contain
@c local variable lists to set @code{backup-by-copying-when-mismatch}
@c locally (@pxref{File Variables}).
$B=jM-<T$rJQ99$9$k$3$H$O!"B?$/$N>l9g!"$h$$$3$H$G$9!#(B
$B$H$$$&$N$O!"=jM-<T$,$D$M$K:G8e$K%U%!%$%k$rJT=8$7$??M$rI=$9$+$i$G$9!#(B
$BF1MM$K!"%P%C%/%"%C%W$N=jM-<T$O$=$NHG$r:n$C$??M$rI=$7$^$9!#(B
$B$H$-$K$O!"%U%!%$%k$N=jM-<T$rJQ99$9$Y$-$G$J$$%U%!%$%k$,$"$j$^$9!#(B
$B$=$N$h$&$J%U%!%$%k$K$D$$$F$O!"(B
@code{backup-by-copying-when-mismatch}$B$r%m!<%+%k$K@_Dj$9$k(B
$B%m!<%+%kJQ?t%j%9%H$r%U%!%$%k$KF~$l$F$*$/$N$,$h$$$G$9!#(B
@vindex backup-by-copying
@vindex backup-by-copying-when-linked
@vindex backup-by-copying-when-mismatch
@c The choice of renaming or copying is controlled by three variables.
@c Renaming is the default choice. If the variable
@c @code{backup-by-copying} is non-@code{nil}, copying is used. Otherwise,
@c if the variable @code{backup-by-copying-when-linked} is non-@code{nil},
@c then copying is used for files that have multiple names, but renaming
@c may still be used when the file being edited has only one name. If the
@c variable @code{backup-by-copying-when-mismatch} is non-@code{nil}, then
@c copying is used if renaming would cause the file's owner or group to
@c change. @code{backup-by-copying-when-mismatch} is @code{t} by default
@c if you start Emacs as the superuser.
$B2~L>$9$k$+%3%T!<$9$k$+$O!"(B3$B$D$NJQ?t$G@)8f$5$l$^$9!#(B
$B%G%U%)%k%H$O!"2~L>$G$9!#(B
$BJQ?t(B@code{backup-by-copying}$B$,(B@code{nil}$B0J30$J$i$P%3%T!<$7$^$9!#(B
@code{nil}$B$N$H$-$K$O!"(B
$BJQ?t(B@code{backup-by-copying-when-linked}$B$,(B@code{nil}$B0J30$J$i$P!"(B
$BJ#?t$NL>A0$r;}$D%U%!%$%k$G$O%3%T!<$7!"(B
$BJT=8Cf$N%U%!%$%k$K$OL>A0$,(B1$B$D$@$1$J$i2~L>$7$^$9!#(B
$BJQ?t(B@code{backup-by-copying-when-mismatch}$B$,(B@code{nil}$B0J30$N$H$-$K$O!"(B
$B2~L>$9$k$H%U%!%$%k$N=jM-<T$d%0%k!<%W$,JQ99$5$l$k$H$-$K$O%3%T!<$7$^$9!#(B
$B%9!<%Q!<%f!<%6!<$G(BEmacs$B$r5/F0$9$k$H!"(B
@code{backup-by-copying-when-mismatch}$B$N%G%U%)%k%H$O(B@code{t}$B$G$9!#(B
@c When a file is managed with a version control system (@pxref{Version
@c Control}), Emacs does not normally make backups in the usual way for
@c that file. But check-in and check-out are similar in some ways to
@c making backups. One unfortunate similarity is that these operations
@c typically break hard links, disconnecting the file name you visited from
@c any alternate names for the same file. This has nothing to do with
@c Emacs---the version control system does it.
$B%U%!%$%k$rHG4IM}%7%9%F%`!J(B@pxref{Version Control}$B!K$G4IM}$7$F$$$k>l9g$K$O!"(B
$BDL>o(BEmacs$B$O$=$N%U%!%$%k$N%P%C%/%"%C%W$rDL>o$NJ}K!$G$O:n$j$^$;$s!#(B
$B%A%'%C%/%$%s$H%A%'%C%/%"%&%H$O!"(B
$B$"$k0UL#$G%P%C%/%"%C%W$r:n$k$3$H$K;w$F$$$^$9!#(B
$B;DG0$J$3$H$K!"(B
$B$3$l$i$NA`:n$OE57?E*$K$O%O!<%I%j%s%/$r@Z$k$H$$$&(B
$BN`;w@-$,$"$j$^$9!#(B
$B$D$^$j!"$"$k%U%!%$%k$NJL$NL>A0$r;H$C$F$$$?$H$9$k$H(B
$B$=$N%U%!%$%kL>$,$J$/$J$k$N$G$9!#(B
Emacs$B$K$G$-$k$3$H$O$"$j$^$;$s!#(B
$BHG4IM}%7%9%F%`$,=hM}$7$^$9!#(B
@node Interlocking
@c @subsection Protection against Simultaneous Editing
@subsection $BF1;~JT=8$KBP$9$kJ]8n(B
@c @cindex file dates
@c @cindex simultaneous editing
@cindex $B%U%!%$%k$NF|IU(B
@cindex $BF1;~JT=8(B
@c Simultaneous editing occurs when two users visit the same file, both
@c make changes, and then both save them. If nobody were informed that
@c this was happening, whichever user saved first would later find that his
@c changes were lost.
2$B?M$N%f!<%6!<$,F1$8%U%!%$%k$rK,Ld$7!"N><T$,$=$l$rJT=8$7!"(B
$BN><T$,$=$l$rJ]B8$9$k$H!"F1;~JT=8$,H/@8$7$^$9!#(B
$B$3$&$$$C$?$3$H$,5/$-$F$$$k$3$H$rC/$bCN$i$;$J$1$l$P!"(B
$B:G=i$KJ]B8$7$?%f!<%6!<$O!"$"$H$K$J$C$F<+J,$NJQ99$,<:$o$l$F$$$k$3$H$rCN$k$G$7$g$&!#(B
@c On some systems, Emacs notices immediately when the second user starts
@c to change the file, and issues an immediate warning. On all systems,
@c Emacs checks when you save the file, and warns if you are about to
@c overwrite another user's changes. You can prevent loss of the other
@c user's work by taking the proper corrective action instead of saving the
@c file.
$B$"$k<o$N%7%9%F%`$G$O!"(B2$B?ML\$N%f!<%6!<$,%U%!%$%k$rJQ99$7;O$a$?$3$H$r(B
Emacs$B$,$?$@$A$K8!CN$7$F7Y9p$rH/$7$^$9!#(B
$B$9$Y$F$N%7%9%F%`$G$O!"%U%!%$%k$rJ]B8$9$k$H$-$K(BEmacs$B$,8!::$7$F!"(B
$BB>?M$NJQ99$r>e=q$-$7$h$&$H$7$F$$$k$J$i$P7Y9p$7$^$9!#(B
$B%U%!%$%k$rJ]B8$9$k$+$o$j$KE,@Z$J=$@5A`:n$r9T$($P!"(B
$BB>?M$N:n6H7k2L$r<:$&$3$H$rHr$1$i$l$^$9!#(B
@findex ask-user-about-lock
@c @cindex locking files
@cindex $B%U%!%$%k$r%m%C%/$9$k(B
@c When you make the first modification in an Emacs buffer that is
@c visiting a file, Emacs records that the file is @dfn{locked} by you.
@c (It does this by creating a symbolic link in the same directory with a
@c different name.) Emacs removes the lock when you save the changes. The
@c idea is that the file is locked whenever an Emacs buffer visiting it has
@c unsaved changes.
$B%U%!%$%k$rK,Ld$7$F$$$k(BEmacs$B%P%C%U%!$G=i$a$F=$@5$r9T$&$H!"(B
Emacs$B$O$=$N%f!<%6!<$,%U%!%$%k$r(B@dfn{$B%m%C%/(B}$B$7$?$H5-O?$7$^$9!#(B
$B!JF1$8%G%#%l%/%H%jFb$K0[$J$kL>A0$N%7%s%\%j%C%/%j%s%/$r:n$k$3$H$G<B8=$9$k!#!K(B
$BJQ99$rJ]B8$9$k$H(BEmacs$B$O%m%C%/$r>C$7$^$9!#(B
$B$D$^$j!"%U%!%$%k$rK,Ld$7$F$$$k(BEmacs$B%P%C%U%!$KL$J]B8$NJQ99$,$"$k$H$-$K$O(B
$B%U%!%$%k$r%m%C%/$7$F$*$/$N$G$9!#(B
@c @cindex collision
@cindex $B>WFM(B
@c If you begin to modify the buffer while the visited file is locked by
@c someone else, this constitutes a @dfn{collision}. When Emacs detects a
@c collision, it asks you what to do, by calling the Lisp function
@c @code{ask-user-about-lock}. You can redefine this function for the sake
@c of customization. The standard definition of this function asks you a
@c question and accepts three possible answers:
$BB>?M$,%m%C%/$7$F$$$k%U%!%$%k$rK,Ld@h$H$9$k%P%C%U%!$r(B
$B=$@5$7;O$a$k$H(B@dfn{$B>WFM(B}$B$,5/$3$j$^$9!#(B
Emacs$B$,>WFM$r8!CN$9$k$H!"(BLisp$B4X?t(B@code{ask-user-about-lock}$B$r8F$S=P$7$F!"(B
$B$I$&$9$k$+$rJ9$$$F$-$^$9!#(B
$B$3$N4X?t$r%+%9%?%^%$%:$N$?$a$K:FDj5A$9$k$3$H$b$G$-$^$9!#(B
$B$3$N4X?t$NI8=`$NDj5A$G$O!"%f!<%6!<$K<ALd$r$7!"(B3$B$D$NJVEz$r<uM}$7$^$9!#(B
@table @kbd
@item s
@c Steal the lock. Whoever was already changing the file loses the lock,
@c and you gain the lock.
$B%m%C%/$r2#<h$j$9$k!#(B
$B%U%!%$%k$r$9$G$KJQ99$7$F$$$??M$O%m%C%/$r<:$$!"(B
$B$"$J$?$,%m%C%/$rF@$k!#(B
@item p
@c Proceed. Go ahead and edit the file despite its being locked by someone else.
$BB39T$9$k!#(B
$BC/$+$,%U%!%$%k$r%m%C%/$7$?$^$^$G$"$k$K$b$+$+$o$i$:!"(B
$B%U%!%$%k$rJT=8$9$k!#(B
@item q
@c Quit. This causes an error (@code{file-locked}) and the modification you
@c were trying to make in the buffer does not actually take place.
$BJ|4~$9$k!#(B
$B$3$l$O%(%i!<!J(B@code{file-locked}$B!K$r0z$-5/$3$7!"(B
$B%P%C%U%!Fb$G=$@5$7$h$&$H$7$?$3$H$O!"<B:]$K$O9T$o$l$J$$!#(B
@end table
@c Note that locking works on the basis of a file name; if a file has
@c multiple names, Emacs does not realize that the two names are the same file
@c and cannot prevent two users from editing it simultaneously under different
@c names. However, basing locking on names means that Emacs can interlock the
@c editing of new files that will not really exist until they are saved.
$B%m%C%/$O%U%!%$%kL>$K4p$E$$$FF0:n$9$k$3$H$KCm0U$7$F$/$@$5$$!#(B
$B%U%!%$%k$KJ#?t$NL>A0$,$"$k$H!"(BEmacs$B$K$O(B2$B$D$NL>A0$,F1$8%U%!%$%k$G(B
$B$"$k$3$H$O$o$+$i$J$$$N$G!"(B
2$B?M$N%f!<%6!<$,0[$J$kL>A0$GF1$8%U%!%$%k$rJT=8$9$k$3$H$OKI$2$^$;$s!#(B
$B$7$+$7!"L>A0$K4p$E$$$?%m%C%/$J$N$G!"(B
$BJ]B8$7$J$$8B$j<B:_$7$J$$?75,%U%!%$%k$NJT=8$r(BEmacs$B$O%$%s%?!<%m%C%/(B
@footnote{$B!ZLuCm![?J9TCf$NF0:n$,40N;$9$k$^$G$O!"(B
$B$D$.$NF0:n$r3+;O$5$;$J$$$h$&$K$9$k$3$H!#(B}
$B$G$-$^$9!#(B
@c Some systems are not configured to allow Emacs to make locks, and
@c there are cases where lock files cannot be written. In these cases,
@c Emacs cannot detect trouble in advance, but it still can detect the
@c collision when you try to save a file and overwrite someone else's
@c changes.
Emacs$B$,%m%C%/$r:n$l$k9=@.$K$J$C$F$$$J$$%7%9%F%`$b$"$j$^$9!#(B
$B$^$?!"%m%C%/%U%!%$%k$r=q$1$J$$>l9g$b$"$j$^$9!#(B
$B$3$&$$$C$?>u67$G$O!"(B
Emacs$B$,$"$i$+$8$a%H%i%V%k$r8!CN$9$k$3$H$O$G$-$^$;$s$,!"(B
$BB>?M$NJQ99$r>e=q$-$7$F%U%!%$%k$rJ]B8$7$h$&$H$7$?$H$-$K$O!"(B
$B>WFM$r8!CN$G$-$^$9!#(B
@c If Emacs or the operating system crashes, this may leave behind lock
@c files which are stale. So you may occasionally get warnings about
@c spurious collisions. When you determine that the collision is spurious,
@c just use @kbd{p} to tell Emacs to go ahead anyway.
Emacs$B$d%*%Z%l!<%F%#%s%0%7%9%F%`$,%/%i%C%7%e$9$k$H!"(B
$B8E$$%m%C%/%U%!%$%k$,;D$C$F$$$k$3$H$"$j$^$9!#(B
$B$=$N$?$a!"$H$-$I$-56$N>WFM$K$D$$$F$N7Y9p$r<u$1$H$k$3$H$,$"$k$+$b$7$l$^$;$s!#(B
$B56$N>WFM$G$"$k$H3N?.$G$-$l$P!"(B
Emacs$B$K$H$K$+$/B39T$9$k$h$&$K;X<($9$k(B@kbd{p}$B$r;H$$$^$9!#(B
@c Every time Emacs saves a buffer, it first checks the last-modification
@c date of the existing file on disk to verify that it has not changed since the
@c file was last visited or saved. If the date does not match, it implies
@c that changes were made in the file in some other way, and these changes are
@c about to be lost if Emacs actually does save. To prevent this, Emacs
@c prints a warning message and asks for confirmation before saving.
@c Occasionally you will know why the file was changed and know that it does
@c not matter; then you can answer @kbd{yes} and proceed. Otherwise, you should
@c cancel the save with @kbd{C-g} and investigate the situation.
Emacs$B$O!"%P%C%U%!$rJ]B8$9$k$?$S$K!"(B
$B%G%#%9%/>e$N%U%!%$%k$N:G=*JQ99F|;~$,:G8e$KK,Ld!?J]B8$7$?$H$-$+$i(B
$B99?7$5$l$F$$$J$$$3$H$r$^$:8!::$7$^$9!#(B
$BJQ99F|;~$,IT0lCW$J$i$P!"$J$s$i$+$NJ}K!$G$=$N%U%!%$%k$,JQ99$5$l$?$3$H$r<($7!"(B
Emacs$B$,K\Ev$KJ]B8$9$k$H$=$l$i$NJQ99$,<:$o$l$F$7$^$$$^$9!#(B
$B$3$l$rHr$1$k$?$a$K!"(BEmacs$B$O7Y9p$N%a%C%;!<%8$rI=<($7!"(B
$BJ]B8$9$k$^$($K3NG'$r5a$a$^$9!#(B
$B%U%!%$%k$,JQ99$5$l$?M}M3$r>5CN$7$F$$$F!"(B
$B$=$l$,LdBj$G$J$$$3$H$rCN$C$F$$$k$3$H$b$"$k$G$7$g$&!#(B
$B$=$&$J$i$P!"(B@kbd{yes}$B$HEz$($FB39T$G$-$^$9!#(B
$B$5$b$J$1$l$P!"(B@kbd{C-g}$B$GJ]B8$rCfCG$7$F!"$=$N;vBV$rD4::$9$k$Y$-$G$9!#(B
@c The first thing you should do when notified that simultaneous editing
@c has already taken place is to list the directory with @kbd{C-u C-x C-d}
@c (@pxref{Directories}). This shows the file's current author. You
@c should attempt to contact him to warn him not to continue editing.
@c Often the next step is to save the contents of your Emacs buffer under a
@c different name, and use @code{diff} to compare the two files.@refill
$BF1;~JT=8$,H/@8$7$?$3$H$rCN$i$5$l$?$H$-$K$^$:9T$&$Y$-$3$H$O!"(B
@kbd{C-u C-x C-d}$B!J(B@pxref{Directories}$B!K$G%G%#%l%/%H%j0lMw$r8+$k$3$H$G$9!#(B
$B$3$N%3%^%s%I$O!"%U%!%$%k$N8=:_$N=jM-<T$rI=<($7$^$9!#(B
$B$=$N?M$KO"Mm$7$F!"JT=8$rB3$1$J$$$h$&$K7Y9p$7$^$7$g$&!#(B
$B$=$N$D$.$NCJ3,$O!"JL$NL>A0$G(BEmacs$B%P%C%U%!$rJ]B8$7$F!"(B
@code{diff}$B$G(B2$B$D$N%U%!%$%k$rHf3S$9$k$3$H$G$7$g$&!#(B
@node Reverting
@c @section Reverting a Buffer
@section $B%P%C%U%!$rI|85$9$k(B
@findex revert-buffer
@c @cindex drastic changes
@cindex $BE0DlE*$JJQ99(B
@c If you have made extensive changes to a file and then change your mind
@c about them, you can get rid of them by reading in the previous version
@c of the file. To do this, use @kbd{M-x revert-buffer}, which operates on
@c the current buffer. Since reverting a buffer unintentionally could lose
@c a lot of work, you must confirm this command with @kbd{yes}.
$B9-HO0O$K%U%!%$%k$rJQ99$7$?$"$H$G5$$,JQ$o$C$?$H$-$K$O!"(B
$B$=$N$h$&$JJQ99$r<N$F$k$?$a$K%U%!%$%k$N$^$($NHG$rFI$_9~$_$^$9!#(B
$B$3$l$K$O!"%+%l%s%H%P%C%U%!$K:nMQ$9$k(B
@kbd{M-x revert-buffer}$B$r;H$$$^$9!#(B
$B0U?^$;$:$K%P%C%U%!$rI|85$9$k$3$H$O!"(B
$B$?$/$5$s$N:n6H7k2L$r<:$&$3$H$K$J$k$N$G!"(B
$B$3$N%3%^%s%I$K$O(B@kbd{yes}$B$G3NG'$rM?$($kI,MW$,$"$j$^$9!#(B
@c @code{revert-buffer} keeps point at the same distance (measured in
@c characters) from the beginning of the file. If the file was edited only
@c slightly, you will be at approximately the same piece of text after
@c reverting as before. If you have made drastic changes, the same value of
@c point in the old file may address a totally different piece of text.
@code{revert-buffer}$B$O!"%U%!%$%k$N@hF,$+$iF1$85wN%!JJ8;z?t!K$K(B
$B%]%$%s%H$rJ]$A$^$9!#(B
$B>/$7JT=8$7$?$@$1$J$i!"I|85A08e$N%]%$%s%H0LCV$O$@$$$?$$F1$8ItJ,$K$"$j$^$9!#(B
$BE0DlE*$KJQ99$7$F$7$^$C$?$H$-$K$O!"(B
$B8E$$%U%!%$%k$G$N%]%$%s%H0LCV$G$O(B
$B$^$C$?$/0[$J$k%F%-%9%HItJ,$K0LCVIU$1$k$G$7$g$&!#(B
@c Reverting marks the buffer as ``not modified'' until another change is
@c made.
$BI|85$9$k$H!"2~$a$FJQ99$9$k$^$G$O!"(B
$B$=$N%P%C%U%!$K$O!XJQ99$J$7!Y$N0u$,IU$-$^$9!#(B
@c Some kinds of buffers whose contents reflect data bases other than files,
@c such as Dired buffers, can also be reverted. For them, reverting means
@c recalculating their contents from the appropriate data base. Buffers
@c created explicitly with @kbd{C-x b} cannot be reverted; @code{revert-buffer}
@c reports an error when asked to do so.
dired$B%P%C%U%!$N$h$&$K!"%U%!%$%k0J30$N%G!<%?$rH?1G$9$k%P%C%U%!$G$b(B
$BI|85$G$-$k>l9g$,$"$j$^$9!#(B
$B$=$N>l9g!"I|85$H$O!"E,@Z$J%G!<%?$K4p$E$$$FFbMF$r7W;;$7D>$9$3$H$r0UL#$7$^$9!#(B
@kbd{C-x b}$B$GL@<(E*$K:n$C$?%P%C%U%!$rI|85$9$k$3$H$O$G$-$^$;$s!#(B
$B$=$&$$$C$?;X<($r$9$k$H!"(B@code{revert-buffer}$B$O%(%i!<$rJs9p$7$^$9!#(B
@vindex revert-without-query
@c When you edit a file that changes automatically and frequently---for
@c example, a log of output from a process that continues to run---it may be
@c useful for Emacs to revert the file without querying you, whenever you
@c visit the file again with @kbd{C-x C-f}.
$B<+F0E*$K$+$DIQHK$KJQ99$5$l$k%U%!%$%k!"(B
$B$?$H$($P!"<B9TCf$N%W%m%;%9$+$i=PNO$5$l$k%m%0!"(B
$B$rJT=8$9$k$H$-$K$O!"(B@kbd{C-x C-f}$B$G%U%!%$%k$r:FK,Ld$9$k$H(B
$B2?$bJ9$+$:$K%U%!%$%k$rI|85$G$-$k$HJXMx$G$9!#(B
@c To request this behavior, set the variable @code{revert-without-query}
@c to a list of regular expressions. When a file name matches one of these
@c regular expressions, @code{find-file} and @code{revert-buffer} will
@c revert it automatically if it has changed---provided the buffer itself
@c is not modified. (If you have edited the text, it would be wrong to
@c discard your changes.)
$B$3$&$$$C$?$U$k$^$$$r;X<($9$k$K$O!"(B
$BJQ?t(B@code{revert-without-query}$B$K@55,I=8=$N%j%9%H$r@_Dj$7$^$9!#(B
$B$3$l$i$N@55,I=8=$N(B1$B$D$K%U%!%$%kL>$,0lCW$9$k$H!"(B
@code{find-file}$B$H(B@code{revert-buffer}$B$O!"(B
$B%P%C%U%!$,JQ99$5$l$F$$$J$$8B$j!"(B
$B$=$N%U%!%$%k$,JQ99$5$l$F$$$F$bI|85$7$^$9!#(B
$B!J%F%-%9%H$rJT=8$7$F$7$^$C$?$H$-$K$O!"(B
$BJQ99$r<N$F$5$k$N$O$^$A$,$C$F$$$k!#!K(B
@node Auto Save
@c @section Auto-Saving: Protection Against Disasters
@c @cindex Auto Save mode
@c @cindex mode, Auto Save
@c @cindex crashes
@section $B<+F0J]B8!"ITN8$N;v8N$KBP$9$kHw$((B
@cindex $B<+F0J]B8!J(BAuto Save mode$B!K(B
@cindex $B%b!<%I!"(BAuto Save
@cindex $B%/%i%C%7%e(B
@c Emacs saves all the visited files from time to time (based on counting
@c your keystrokes) without being asked. This is called @dfn{auto-saving}.
@c It prevents you from losing more than a limited amount of work if the
@c system crashes.
Emacs$B$O!JBG80?t$K4p$E$$$F!KDj4|E*$K!"(B
$BK,Ld$7$F$$$k$9$Y$F$N%U%!%$%k$r2?$bJ9$+$:$KJ]B8$7$^$9!#(B
$B$3$l$r(B@dfn{$B<+F0J]B8(B}$B!J(Bauot-saving$B!K$H8F$S$^$9!#(B
$B$3$l$O!"%7%9%F%`$,%/%i%C%7%e$7$?$H$-$K(B
$B<:$C$F$7$^$&:n6H7k2L$r$"$kDxEY0J2<$K@)8B$7$^$9!#(B
@c When Emacs determines that it is time for auto-saving, each buffer is
@c considered, and is auto-saved if auto-saving is turned on for it and it
@c has been changed since the last time it was auto-saved. The message
@c @samp{Auto-saving...} is displayed in the echo area during auto-saving,
@c if any files are actually auto-saved. Errors occurring during
@c auto-saving are caught so that they do not interfere with the execution
@c of commands you have been typing.
$B<+F0J]B8$r<B;\$9$k;~4V$K$J$k$H(BEmacs$B$O3F%P%C%U%!$rD4$Y$F!"(B
$B$=$N%P%C%U%!$K<+F0J]B8$,;XDj$5$l$F$$$F!"$+$D!"(B
$B:G8e$K<+F0J]B8$7$?0J8e$KJQ99$5$l$F$$$k>l9g$O!"(B
$B$=$N%P%C%U%!$r<+F0J]B8$7$^$9!#(B
$B<B:]$K%U%!%$%k$r<+F0J]B8$9$k$H!"(B
$B%(%3!<NN0h$K%a%C%;!<%8(B@samp{Auto-saving...}$B$rI=<($7$^$9!#(B
$B<+F0J]B8$N:GCf$KH/@8$7$?%(%i!<$OJa3M$5$l$k$N$G!"(B
$BBG$A9~$s$@%3%^%s%I$N<B9T$K43>D$9$k$3$H$O$"$j$^$;$s!#(B
@menu
* Files: Auto Save Files. The file where auto-saved changes are
actually made until you save the file.
* Control: Auto Save Control. Controlling when and how often to auto-save.
* Recover:: Recovering text from auto-save files.
@end menu
@node Auto Save Files
@c @subsection Auto-Save Files
@subsection $B<+F0J]B8%U%!%$%k(B
@c Auto-saving does not normally save in the files that you visited, because
@c it can be very undesirable to save a program that is in an inconsistent
@c state when you have made half of a planned change. Instead, auto-saving
@c is done in a different file called the @dfn{auto-save file}, and the
@c visited file is changed only when you request saving explicitly (such as
@c with @kbd{C-x C-s}).
$B<+F0J]B8$O!"DL>o!"K,Ld@h$N%U%!%$%k$=$N$b$N$X$OJ]B8$7$^$;$s!#(B
$B$H$$$&$N$O!"M=Dj$NH>J,$rJQ99$7$?$@$1$G%W%m%0%i%`$K$^$@0l4S@-$,$J$$$N$K(B
$BJ]B8$7$F$7$^$&$N$OK>$^$7$/$J$$$+$i$G$9!#(B
$B$=$N$+$o$j$K(B@dfn{$B<+F0J]B8%U%!%$%k(B}$B$H8F$P$l$kJL$N%U%!%$%k$K<+F0J]B8$7!"(B
$B!J(B@kbd{C-x C-s}$B$J$I$G!KL@<(E*$KJ]B8$9$k$h$&;X<($5$l$?$H$-$@$1!"(B
$BK,Ld@h$N%U%!%$%k$KJ]B8$7$^$9!#(B
@c Normally, the auto-save file name is made by appending @samp{#} to the
@c front and rear of the visited file name. Thus, a buffer visiting file
@c @file{foo.c} is auto-saved in a file @file{#foo.c#}. Most buffers that
@c are not visiting files are auto-saved only if you request it explicitly;
@c when they are auto-saved, the auto-save file name is made by appending
@c @samp{#%} to the front and @samp{#} to the rear of buffer name. For
@c example, the @samp{*mail*} buffer in which you compose messages to be
@c sent is auto-saved in a file named @file{#%*mail*#}. Auto-save file
@c names are made this way unless you reprogram parts of Emacs to do
@c something different (the functions @code{make-auto-save-file-name} and
@c @code{auto-save-file-name-p}). The file name to be used for auto-saving
@c in a buffer is calculated when auto-saving is turned on in that buffer.
$BDL>o!"<+F0J]B8%U%!%$%k$NL>A0$O!"K,Ld@h$N%U%!%$%k$NL>A0$NA08e$K(B
@samp{#}$B$rIU2C$7$?$b$N$G$9!#(B
$B$7$?$,$C$F!"%U%!%$%k(B@file{foo.c}$B$rK,Ld$7$?%P%C%U%!$O!"(B
$B%U%!%$%k(B@file{#foo.c#}$B$K<+F0J]B8$5$l$^$9!#(B
$B%U%!%$%k$rK,Ld$7$F$$$J$$$[$H$s$I$N%P%C%U%!$O!"(B
$BL@<(E*$K;XDj$7$?$H$-$@$1<+F0J]B8$5$l$^$9!#(B
$B$=$l$i$N%P%C%U%!$N<+F0J]B8%U%!%$%k$NL>A0$O!"(B
$B%P%C%U%!L>$N$^$($K(B@samp{#%}$B!"$"$H$K(B@samp{#}$B$rIU$1$?$b$N$K$J$j$^$9!#(B
$B$?$H$($P!"Aw?.$9$k%a%C%;!<%8$r:n@.$9$k%P%C%U%!(B@samp{*mail*}$B$O!"(B
@file{#%*mail*#}$B$H$$$&%U%!%$%k$K<+F0J]B8$5$l$^$9!#(B
$B<+F0J]B8%U%!%$%k$NL>A0$O!"(BEmacs$B$N0lIt!J4X?t(B@code{make-auto-save-file-name}$B$H(B
@code{auto-save-file-name-p}$B!K$r%W%m%0%i%`$7D>$5$J$$8B$j!"(B
$B$3$NJ}K!$G:n$i$l$^$9!#(B
$B%P%C%U%!$N<+F0J]B8$K;H$&%U%!%$%kL>$O!"(B
$B$=$N%P%C%U%!$G<+F0J]B8$r%*%s$K$7$?$H$-$K7W;;$5$l$^$9!#(B
@c When you delete a substantial part of the text in a large buffer, auto
@c save turns off temporarily in that buffer. This is because if you
@c deleted the text unintentionally, you might find the auto-save file more
@c useful if it contains the deleted text. To reenable auto-saving after
@c this happens, save the buffer with @kbd{C-x C-s}, or use @kbd{C-u 1 M-x
@c auto-save}.
$BBg$-$J%P%C%U%!$GAjEvNL$N%F%-%9%H$r:o=|$7$?$H$-$K$O!"(B
$B$=$N%P%C%U%!$N<+F0J]B8$r0l;~E*$K$d$a$^$9!#(B
$B0U?^$;$:$K%F%-%9%H$r:o=|$7$F$7$^$C$?>l9g$K$O!"(B
$B<+F0J]B8%U%!%$%k$K:o=|$7$F$7$^$C$?%F%-%9%H$,;D$C$F$$$k$[$&$,!"(B
$B<+F0J]B8%U%!%$%k$H$7$F$h$jLr$KN)$D$+$i$G$9!#(B
$B$3$&$J$C$?$"$H$G<+F0J]B8$r$U$?$?$S%*%s$K$9$k$K$O!"(B
@kbd{C-x C-s}$B$G%P%C%U%!$rJ]B8$9$k$+!"(B
@kbd{C-u 1 M-x auto-save}$B$r;H$$$^$9!#(B
@vindex auto-save-visited-file-name
@c If you want auto-saving to be done in the visited file, set the variable
@c @code{auto-save-visited-file-name} to be non-@code{nil}. In this mode,
@c there is really no difference between auto-saving and explicit saving.
$BK,Ld@h$N%U%!%$%k$=$N$b$N$K<+F0J]B8$r9T$$$?$$>l9g$K$O!"(B
$BJQ?t(B@code{auto-save-visited-file-name}$B$K(B@code{nil}$B0J30$NCM$r@_Dj$7$^$9!#(B
$B$3$&$9$k$H!"<+F0J]B8$HL@<(E*$JJ]B8$K$O!"2?$N0c$$$b$"$j$^$;$s!#(B
@vindex delete-auto-save-files
@c A buffer's auto-save file is deleted when you save the buffer in its
@c visited file. To inhibit this, set the variable @code{delete-auto-save-files}
@c to @code{nil}. Changing the visited file name with @kbd{C-x C-w} or
@c @code{set-visited-file-name} renames any auto-save file to go with
@c the new visited name.
$BK,Ld@h$N%U%!%$%k$K%P%C%U%!$rJ]B8$9$k$H!"(B
$B%P%C%U%!$N<+F0J]B8%U%!%$%k$O:o=|$5$l$^$9!#(B
$B$3$l$r6X;_$9$k$K$O!"(B
$BJQ?t(B@code{delete-auto-save-files}$B$K(B@code{nil}$B$r@_Dj$7$^$9!#(B
@kbd{C-x C-w}$B$d(B@code{set-visited-file-name}$B$G(B
$BK,Ld@h%U%!%$%kL>$rJQ99$9$k$H!"(B
$B?7$?$JK,Ld@h%U%!%$%kL>$K9g$o$;$F<+F0J]B8%U%!%$%k$b2~L>$5$l$^$9!#(B
@node Auto Save Control
@c @subsection Controlling Auto-Saving
@subsection $B<+F0J]B8$N@)8f(B
@vindex auto-save-default
@findex auto-save-mode
@c Each time you visit a file, auto-saving is turned on for that file's
@c buffer if the variable @code{auto-save-default} is non-@code{nil} (but not
@c in batch mode; @pxref{Entering Emacs}). The default for this variable is
@c @code{t}, so auto-saving is the usual practice for file-visiting buffers.
@c Auto-saving can be turned on or off for any existing buffer with the
@c command @kbd{M-x auto-save-mode}. Like other minor mode commands, @kbd{M-x
@c auto-save-mode} turns auto-saving on with a positive argument, off with a
@c zero or negative argument; with no argument, it toggles.
$BJQ?t(B@code{auto-save-default}$B$,(B@code{nil}$B0J30$J$i$P!"(B
$B%U%!%$%k$rK,Ld$9$k$?$S$K$=$N%U%!%$%k$N%P%C%U%!$N<+F0J]B8$r%*%s$K$7$^$9(B
$B!J$?$@$7%P%C%A%b!<%I$r=|$/!#(B@pxref{Entering Emacs}$B!K!#(B
$B$3$NJQ?t$N%G%U%)%k%H$O(B@code{t}$B$J$N$G!"(B
$BDL>o!"%U%!%$%k$rK,Ld$7$?%P%C%U%!$O<+F0J]B8$5$l$^$9!#(B
$B%3%^%s%I(B@kbd{M-x auto-save-mode}$B$G!"(B
$B4{B8%P%C%U%!$N<+F0J]B8$r%*%s!?%*%U$G$-$^$9!#(B
$BB>$N%^%$%J%b!<%I$N%3%^%s%I$HF1$8$h$&$K!"(B
$B@5$N0z?t$r;XDj$9$k$H(B@kbd{M-x auto-save-mode}$B$O<+F0J]B8$r%*%s$K$7!"(B
0$B$+Ii$N0z?t$r;XDj$9$k$H<+F0J]B8$r%*%U$K$7!"(B
$B0z?t$r;XDj$7$J$$$H<+F0J]B8$N%*%s!?%*%U$r@Z$jBX$($^$9!#(B
@vindex auto-save-interval
@c Emacs does auto-saving periodically based on counting how many characters
@c you have typed since the last time auto-saving was done. The variable
@c @code{auto-save-interval} specifies how many characters there are between
@c auto-saves. By default, it is 300.
Emacs$B$O!":G8e$K<+F0J]B8$7$F$+$i2?J8;zBG80$7$?$+$K4p$E$$$F(B
$BDj4|E*$K<+F0J]B8$7$^$9!#(B
$BJQ?t(B@code{auto-save-interval}$B$K$O!"<+F0J]B8$N4V3V$rI=$9J8;z?t$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$O(B300$B$G$9!#(B
@vindex auto-save-timeout
@c Auto-saving also takes place when you stop typing for a while. The
@c variable @code{auto-save-timeout} says how many seconds Emacs should
@c wait before it does an auto save (and perhaps also a garbage
@c collection). (The actual time period is longer if the current buffer is
@c long; this is a heuristic which aims to keep out of your way when you
@c are editing long buffers, in which auto-save takes an appreciable amount
@c of time.) Auto-saving during idle periods accomplishes two things:
@c first, it makes sure all your work is saved if you go away from the
@c terminal for a while; second, it may avoid some auto-saving while you
@c are actually typing.
$B$7$P$i$/BG80$7$J$$$G$$$k$H$-$K$b<+F0J]B8$O9T$o$l$^$9!#(B
$BJQ?t(B@code{auto-save-timeout}$B$O!"<+F0J]B8!J$*$h$S%,%Y%C%8%3%l%/%7%g%s!K$r(B
$B9T$&$^$G$K(BEmacs$B$,BT$D$Y$-IC?t$rI=$7$^$9!#(B
$B!J%+%l%s%H%P%C%U%!$,Bg$-$$$H!"<B:]$N;~4V4V3V$bD9$/$J$k!#(B
$B$3$l$O!"Bg$-$J%P%C%U%!$N<+F0J]B8$K$O;~4V$,$+$+$k$N$G!"(B
$B$=$NJT=8Cf$O<YKb$K$J$i$J$$$h$&$K$9$k$?$a!#!K(B
$B%"%$%I%k$N$H$-$K$O!"<+F0J]B8$O$D$.$N(B2$B$D$N$3$H$rC#@.$7$^$9!#(B
1$B$D$O!"C<Kv$+$i$7$P$i$/N%$l$F$$$k$H$-$K!"(B
$B$9$Y$F$N:n6H7k2L$,J]B8$5$l$k$3$H$rJ]>Z$9$k$3$H!#(B
$B$b$&(B1$B$D$O!"<B:]$KBG80$7$F$$$k$H$-$N<+F0J]B8$r(B
$B$$$/$V$s$G$bHr$1$k$h$&$K$9$k$3$H$G$9!#(B
@c Emacs also does auto-saving whenever it gets a fatal error. This
@c includes killing the Emacs job with a shell command such as @samp{kill
@c %emacs}, or disconnecting a phone line or network connection.
$B=EBg$J%(%i!<$r<u$1<h$C$?$H$-$K$b!"(BEmacs$B$O<+F0J]B8$r9T$$$^$9!#(B
$B$3$l$K$O!"(B@samp{kill %emacs}$B$N$h$&$J%7%'%k%3%^%s%I$G(B
Emacs$B%8%g%V$r6/@)=*N;$7$?>l9g$d!"(B
$BEEOC2s@~$d%M%C%H%o!<%/@\B3$,ES@Z$l$?>l9g$r4^$_$^$9!#(B
@findex do-auto-save
@c You can request an auto-save explicitly with the command @kbd{M-x
@c do-auto-save}.
$B%3%^%s%I(B@kbd{M-x do-auto-save}$B$G!"<+F0J]B8$N<B;\$rL@<(E*$K;X<($G$-$^$9!#(B
@node Recover
@c @subsection Recovering Data from Auto-Saves
@subsection $B<+F0J]B8%U%!%$%k$+$i$N%G!<%?2sI|(B
@findex recover-file
@c You can use the contents of an auto-save file to recover from a loss
@c of data with the command @kbd{M-x recover-file @key{RET} @var{file}
@c @key{RET}}. This visits @var{file} and then (after your confirmation)
@c restores the contents from its auto-save file @file{#@var{file}#}.
@c You can then save with @kbd{C-x C-s} to put the recovered text into
@c @var{file} itself. For example, to recover file @file{foo.c} from its
@c auto-save file @file{#foo.c#}, do:@refill
$B%3%^%s%I(B@kbd{M-x recover-file @key{RET} @var{file} @key{RET}}$B$G!"(B
$B<+F0J]B8%U%!%$%k$NFbMF$+$iJ6<:%G!<%?$rI|5l$G$-$^$9!#(B
$B$3$N%3%^%s%I$O!"(B@var{file}$B$rK,Ld$7$F$+$i!"(B
$B!J3NG'$7$?$"$H$G!K$=$N<+F0J]B8%U%!%$%k(B@file{#@var{file}#}
$B$+$iFbMF$r2sI|$7$^$9!#(B
$B$=$N$"$H$K!"(B@kbd{C-x C-s}$B$G(B@var{file}$B$=$N$b$N$KI|5l$7$?%F%-%9%H$rJ]B8$7$^$9!#(B
$B$?$H$($P!"(B@file{foo.c}$B$N<+F0J]B8$N%U%!%$%k(B@file{#foo.c#}$B$+$i(B
@file{foo.c}$B$rI|5l$9$k$K$O$D$.$N$h$&$K$7$^$9!#(B
@example
M-x recover-file @key{RET} foo.c @key{RET}
yes @key{RET}
C-x C-s
@end example
@c Before asking for confirmation, @kbd{M-x recover-file} displays a
@c directory listing describing the specified file and the auto-save file,
@c so you can compare their sizes and dates. If the auto-save file
@c is older, @kbd{M-x recover-file} does not offer to read it.
@kbd{M-x recover-file}$B$O3NG'$9$k$^$($K!"(B
$B;XDj$7$?%U%!%$%k$H<+F0J]B8%U%!%$%k$,CV$+$l$?%G%#%l%/%H%j$N0lMw$rI=<($9$k$N$G!"(B
$B$=$l$i$N%5%$%:$dF|IU$rHf3S$G$-$^$9!#(B
$B<+F0J]B8%U%!%$%k$N$[$&$,8E$$$H!"(B
@kbd{M-x recover-file}$B$O$=$N%U%!%$%k$rFI$_9~$`$h$&$K$O(B
$BJ9$$$F$-$^$;$s!#(B
@findex recover-session
@c If Emacs or the computer crashes, you can recover all the files you
@c were editing from their auto save files with the command @kbd{M-x
@c recover-session}. This first shows you a list of recorded interrupted
@c sessions. Move point to the one you choose, and type @kbd{C-c C-c}.
Emacs$B$d%3%s%T%e!<%?$,%/%i%C%7%e$7$F$b!"(B
$B%3%^%s%I(B@kbd{M-x recover-session}$B$r;H$($P!"(B
$BJT=8Cf$@$C$?$9$Y$F$N%U%!%$%k$r<+F0J]B8%U%!%$%k$+$iI|5l$G$-$^$9!#(B
$B$3$N%3%^%s%I$O!"$^$:!"5-O?$5$l$F$$$kCfCG$5$l$?%;%C%7%g%s0lMw$rI=<($7$^$9!#(B
$B4uK>$9$k2U=j$X%]%$%s%H$r0\F0$7!"(B@kbd{C-c C-c}$B$HBG$A$^$9!#(B
@c Then @code{recover-session} asks about each of the files that were
@c being edited during that session, asking whether to recover that file.
@c If you answer @kbd{y}, it calls @code{recover-file}, which works in its
@c normal fashion. It shows the dates of the original file and its
@c auto-save file, and asks once again whether to recover that file.
$B$D$.$K!"(B @code{recover-session}$B$O$=$N%;%C%7%g%s$GJT=8Cf$@$C$?(B
$B3F%U%!%$%k$K$D$$$F$=$N%U%!%$%k$rI|5l$9$k$+J9$$$F$-$^$9!#(B
@kbd{y}$B$rEz$($k$H!"(B@code{recover-file}$B$r8F$S=P$7!"(B
$BIaDL$N$H$*$j$KF0:n$7$^$9!#(B
$B$b$H$N%U%!%$%k$H$=$N<+F0J]B8%U%!%$%k$NF|IU$rI=<($7!"(B
$B%U%!%$%k$rI|5l$9$k$+$I$&$+$r$b$&0lEYJ9$$$F$-$^$9!#(B
@c When @code{recover-session} is done, the files you've chosen to
@c recover are present in Emacs buffers. You should then save them. Only
@c this---saving them---updates the files themselves.
@code{recover-session}$B$,=*N;$9$k$H!"(B
$BI|5l$rA*$s$@%U%!%$%k$O(BEmacs$B%P%C%U%!$KF~$C$F$$$^$9!#(B
$B$3$l$i$N%P%C%U%!$rJ]B8$7$F$/$@$5$$!#(B
$B$3$&$9$k$3$H$G=i$a$F%U%!%$%k$KJ]B8$G$-$^$9!#(B
@vindex auto-save-list-file-prefix
@c Interrupted sessions are recorded for later recovery in files named
@c @file{~/.saves-@var{pid}-@var{hostname}}. The @samp{~/.saves} portion of
@c these names comes from the value of @code{auto-save-list-file-prefix}.
@c You can arrange to record sessions in a different place by setting that
@c variable in your @file{.emacs} file, but you'll have to redefine
@c @code{recover-session} as well to make it look in the new place. If you
@c set @code{auto-save-list-file-prefix} to @code{nil} in your
@c @file{.emacs} file, sessions are not recorded for recovery.
$BCfCG$5$l$?%;%C%7%g%s$O!"$"$H$GI|5l$9$k$?$a$K(B
@file{~/.saves-@var{pid}-@var{hostname}}$B$H$$$&%U%!%$%k$K5-O?$5$l$F$$$^$9!#(B
$B$3$l$i$NL>A0$N(B@samp{~/.saves}$B$NItJ,$O!"(B
@code{auto-save-list-file-prefix}$B$NCM$G$9!#(B
$B$3$NJQ?t$r8D?M$N(B@file{.emacs}$B%U%!%$%k$G@_Dj$9$l$P!"(B
$BJL$N>l=j$K%;%C%7%g%s5-O?$rCV$/$3$H$,$G$-$^$9!#(B
$B$7$+$7!"F1MM$K(B@code{recover-session}$B$b:FDj5A$7$F!"(B
$BJQ99$7$??7$7$$>l=j$rC5$9$h$&$K$9$kI,MW$,$"$j$^$9!#(B
$B8D?M$N(B@file{.emacs}$B%U%!%$%k$G(B@code{auto-save-list-file-prefix}$B$K(B
@code{nil}$B$r@_Dj$9$k$H!"I|5l$N$?$a$N%;%C%7%g%s$r5-O?$7$^$;$s!#(B
@node File Aliases
@c @section File Name Aliases
@section $B%U%!%$%kL>$NJLL>(B
@c Symbolic links and hard links both make it possible for several file
@c names to refer to the same file. Hard links are alternate names that
@c refer directly to the file; all the names are equally valid, and no one
@c of them is preferred. By contrast, a symbolic link is a kind of defined
@c alias: when @file{foo} is a symbolic link to @file{bar}, you can use
@c either name to refer to the file, but @file{bar} is the real name, while
@c @file{foo} is just an alias. More complex cases occur when symbolic
@c links point to directories.
$B%7%s%\%j%C%/%j%s%/$d%O!<%I%j%s%/$r;H$&$3$H$G!"(B
$BF1$8%U%!%$%k$r$$$/$D$+$N0[$J$k%U%!%$%kL>$G;X$9$3$H$,$G$-$^$9!#(B
$B%O!<%I%j%s%/$O!"%U%!%$%k$rD>@\$K;X$7$F$$$kJL$NL>A0$G$9!#(B
$B$9$Y$F$NL>A0$OEy$7$/M-8z$G!"$=$l$i$KM%Nt$O$"$j$^$;$s!#(B
$BBP>HE*$K!"%7%s%\%j%C%/%j%s%/$ODj5A$5$l$?JLL>$N0l<o$G$9!#(B
@file{foo}$B$,(B@file{bar}$B$X$N%7%s%\%j%C%/%j%s%/$G$"$k$H$-!"(B
$B$I$A$i$NL>A0$G$b%U%!%$%k$r;X$;$^$9$,!"(B
@file{bar}$B$,K\Ev$NL>A0$G$"$j!"(B@file{foo}$B$OJLL>$K$9$.$^$;$s!#(B
$B%7%s%\%j%C%/%j%s%/$,%G%#%l%/%H%j$r;X$7$F$$$k$H$-$K$O!"(B
$B$h$jJ#;($J>u67$K$J$j$^$9!#(B
@c If you visit two names for the same file, normally Emacs makes
@c two different buffers, but it warns you about the situation.
$BF10l$N%U%!%$%k$KBP$7$F(B2$B$D$NL>A0$GK,Ld$9$k$H!"(B
Emacs$B$ODL>o(B2$B$D$NJL!9$N%P%C%U%!$r:n@.$7$^$9$,!"(B
$B$=$N>u67$r7Y9p$7$^$9!#(B
@vindex find-file-existing-other-name
@c If you wish to avoid visiting the same file in two buffers under
@c different names, set the variable @code{find-file-existing-other-name}
@c to a non-@code{nil} value. Then @code{find-file} uses the existing
@c buffer visiting the file, no matter which of the file's names you
@c specify.
$BF10l$N%U%!%$%k$r0[$J$kL>A0$GJL!9$N%P%C%U%!$KK,Ld$9$k$3$H$rHr$1$?$$$J$i$P!"(B
$BJQ?t(B@code{find-file-existing-other-name}$B$K(B@code{nil}$B0J30$NCM$r@_Dj$7$^$9!#(B
$B$=$&$9$l$P!"$I$N%U%!%$%kL>$r;XDj$7$h$&$H$b!"(B
@code{find-file}$B$O%U%!%$%k$rK,Ld$7$F$$$k4{B8$N%P%C%U%!$r;H$$$^$9!#(B
@vindex find-file-visit-truename
@c @cindex truenames of files
@c @cindex file truenames
@cindex $B%U%!%$%k$N<BL>(B
@c If the variable @code{find-file-visit-truename} is non-@code{nil},
@c then the file name recorded for a buffer is the file's @dfn{truename}
@c (made by replacing all symbolic links with their target names), rather
@c than the name you specify. Setting @code{find-file-visit-truename} also
@c implies the effect of @code{find-file-existing-other-name}.
$BJQ?t(B@code{find-file-visit-truename}$B$,(B@code{nil}$B0J30$G$"$l$P!"(B
$B%P%C%U%!$K5-O?$9$k%U%!%$%kL>$O!"%f!<%6!<$,;XDj$7$?L>A0$G$O$J$/$F!"(B
$B%U%!%$%k$N!J$9$Y$F$N%7%s%\%j%C%/%j%s%/$r$=$N@h$NL>A0$KCV$-49$($FF@$i$l$k!K(B
@dfn{$B<BL>(B}$B$K$J$j$^$9!#(B
@code{find-file-visit-truename}$B$r@_Dj$9$k$H!"(B
@code{find-file-existing-other-name}$B$b0E$K@_Dj$5$l$^$9!#(B
@node Version Control
@c @section Version Control
@c @cindex version control
@section VC$B!JHG4IM}!"%P!<%8%g%s%3%s%H%m!<%k!K(B
@cindex $B%P!<%8%g%s%3%s%H%m!<%k(B
@cindex $BHG4IM}(B
@c @dfn{Version control systems} are packages that can record multiple
@c versions of a source file, usually storing the unchanged parts of the
@c file just once. Version control systems also record history information
@c such as the creation time of each version, who created it, and a
@c description of what was changed in that version.
@dfn{$BHG4IM}%7%9%F%`(B}$B$O!"(B
$B%U%!%$%k$NJQ99$5$l$F$$$J$$ItJ,$rDL>o$O0lEY$@$13JG<$7$F!"(B
$B%=!<%9%U%!%$%k$NJ#?t$NHG$r5-O?$G$-$k%Q%C%1!<%8$G$9!#(B
$BHG4IM}%7%9%F%`$O!"3FHG$N:n@.;~9o!":n@.<T!"(B
$B$=$NHG$NJQ99ItJ,$K4X$9$k5-=R$J$I$NMzNr>pJs$b5-O?$7$^$9!#(B
@c The Emacs version control interface is called VC. Its commands work
@c with three version control systems---RCS, CVS and SCCS. The GNU project
@c recommends RCS and CVS, which are free software and available from the
@c Free Software Foundation.
Emacs$B$NHG4IM}%Q%C%1!<%8$O(BVC$B$H8F$P$l$^$9!#(B
$B$3$N%3%^%s%I$O!"(B3$B$D$NHG4IM}%7%9%F%`!"(BRCS$B!"(BCVS$B!"(BSCCS$B$GF0:n$7$^$9!#(B
GNU$B%W%m%8%'%/%H$G$O!"%U%j!<%=%U%H%&%'%"$G$"$j(BFree Software Foundation$B$+$i(B
$BF~<j$G$-$k(BRCS$B$H(BCVS$B$r?d>)$7$^$9!#(B
@menu
* Introduction to VC:: How version control works in general.
* VC Mode Line:: How the mode line shows version control status.
* Basic VC Editing:: How to edit a file under version control.
* Old Versions:: Examining and comparing old versions.
* Secondary VC Commands:: The commands used a little less frequently.
* Branches:: Multiple lines of development.
* Snapshots:: Sets of file versions treated as a unit.
* Miscellaneous VC:: Various other commands and features of VC.
* Customizing VC:: Variables that change VC's behavior.
@end menu
@node Introduction to VC
@c @subsection Introduction to Version Control
@subsection VC$BF~Lg(B
@c VC allows you to use a version control system from within Emacs,
@c integrating the version control operations smoothly with editing. VC
@c provides a uniform interface to version control, so that regardless of
@c which version control system is in use, you can use it the same way.
VC$B$O(BEmacs$B$+$iHG4IM}%7%9%F%`$r;H$($k$h$&$K$7$F!"(B
$BJT=8:n6H$rHG4IM}A`:n$K3j$i$+$KE}9g$7$^$9!#(B
VC$B$OE}0l$5$l$?HG4IM}%$%s%?!<%U%'%$%9$rDs6!$9$k$N$G!"(B
$B$I$NHG4IM}%7%9%F%`$r;H$C$F$$$k$+$K4X$o$i$:!"(B
$BF1$8;H$$J}$,$G$-$^$9!#(B
@c This section provides a general overview of version control, and
@c describes the version control systems that VC supports. You can skip
@c this section if you are already familiar with the version control system
@c you want to use.
$BK\@a$G$O!"HG4IM}$r354Q$9$k$H$H$b$K!"(B
VC$B$,07$&HG4IM}%7%9%F%`$N35MW$r@bL@$7$^$9!#(B
$B;HMQ$9$kHG4IM}%7%9%F%`$K$9$G$K47$l$F$$$k$J$i$P!"K\@a$OFI$_Ht$P$7$F$/$@$5$$!#(B
@menu
* Version Systems:: Supported version control back-end systems.
* VC Concepts:: Words and concepts related to version control.
@end menu
@node Version Systems
@c @subsubsection Supported Version Control Systems
@subsubsection $BMxMQ2DG=$JHG4IM}%7%9%F%`(B
@cindex RCS
@c @cindex back end (version control)
@cindex $B%P%C%/%(%s%I!JHG4IM}!K(B
@c VC currently works with three different version control systems or
@c ``back ends'': RCS, CVS, and SCCS.
VC$B$G$O!"8=:_(B3$B$D$NHG4IM}%7%9%F%`!"(B
$B$D$^$j!"%P%C%/%(%s%I$GF0:n$7$^$9!#(B
RCS$B!"(BCVS$B!"(BSCCS$B$N(B3$B$D$G$9!#(B
@c RCS is a free version control system that is available from the Free
@c Software Foundation. It is perhaps the most mature of the supported
@c back ends, and the VC commands are conceptually closest to RCS. Almost
@c everything you can do with RCS can be done through VC.
RCS$B$O%U%j!<$NHG4IM}%7%9%F%`$G(BFree Software Foundation$B$+$iF~<j$,$G$-$^$9!#(B
RCS$B$O!"07$($k%P%C%/%(%s%I$NCf$G$O!"$?$V$s!"$b$C$H$b@.=O$7$?$b$N$G$9!#(B
VC$B%3%^%s%I72$O!"(BRCS$B$K35G0E*$K$b$C$H$b6a$$$b$N$G$9!#(B
RCS$B$G$G$-$k$[$H$s$I$N$3$H$O(BVC$B$+$i$b$G$-$^$9!#(B
@cindex CVS
@c CVS is built on top of RCS, and extends the features of RCS, allowing
@c for more sophisticated release management, and concurrent multi-user
@c development. VC supports basic editing operations under CVS, but for
@c some less common tasks you still need to call CVS from the command line.
@c Note also that before using CVS you must set up a repository, which is a
@c subject too complex to treat here.
CVS$B$O!"(BRCS$B$N>e$K:n$i$l$F(BRCS$B$N5!G=$r3HD%$7$F$$$F!"(B
$B$h$j@vN}$5$l$?%j%j!<%94IM}!"J#?t%f!<%6!<$NJB9T3+H/$r5v$7$F$$$^$9!#(B
CVS$B$N2<$G$O!"(BVC$B$N4pK\E*$JJT=8A`:n$r;H$($^$9$,!"(B
$B$"$^$j0lHLE*$G$J$$A`:n$K4X$7$F$O!"(B
$B%3%^%s%I9T$+$i(BCVS$B$r8F$VI,MW$,$"$j$^$9!#(B
CVS$B$r;H$&$K$OJ]4I8K!J%j%]%8%H%j!"(Brepository$B!K$r@_Dj$7$J$1$l$P$J$j$^$;$s$,!"(B
$B$3$3$G07$&$K$OJ#;($9$.$kOCBj$G$9!#(B
@cindex SCCS
@c SCCS is a proprietary but widely used version control system. In
@c terms of capabilities, it is the weakest of the three that VC
@c supports. VC compensates for certain features missing in SCCS
@c (snapshots, for example) by implementing them itself, but some other VC
@c features, such as multiple branches, are not available with SCCS. You
@c should use SCCS only if for some reason you cannot use RCS.
SCCS$B$O%U%j!<$G$O$"$j$^$;$s$,!"HG4IM}%7%9%F%`$H$7$F$O9-$/;H$o$l$F$$$^$9!#(B
$BG=NO$N4QE@$+$i$9$l$P!"(BVC$B$,07$($k(B3$B$D$N$&$A$G$b$C$H$b<e$$$G$9!#(B
SCCS$B$K7g$1$F$$$k5!G=!J$?$H$($P%9%J%C%W%7%g%C%H!K$O(BVC$B<+?H$G(B
$B<B8=$7$FJd$C$F$$$^$9$,!"(B
$BJ#?t$N;^J,$+$l$N$h$&$J(BVC$B$NB>$N$$$/$D$+$N5!G=$O(BSCCS$B$G$OMxMQ$G$-$^$;$s!#(B
RCS$B$r;H$($J$$M}M3$,$"$k$H$-$K8B$C$F(BSCCS$B$r;H$&$Y$-$G$9!#(B
@node VC Concepts
@c @subsubsection Concepts of Version Control
@subsubsection VC$B$N35G0(B
@c @cindex master file
@c @cindex registered file
@cindex $B%^%9%?%U%!%$%k(B
@cindex $BEPO?$5$l$?%U%!%$%k(B
@c When a file is under version control, we also say that it is
@c @dfn{registered} in the version control system. Each registered file
@c has a corresponding @dfn{master file} which represents the file's
@c present state plus its change history---enough to reconstruct the
@c current version or any earlier version. Usually the master file also
@c records a @dfn{log entry} for each version, describing in words what was
@c changed in that version.
$B%U%!%$%k$,HG4IM}$N4IM}2<$K$"$k$H$-!"(B
$B$=$N%U%!%$%k$OHG4IM}%7%9%F%`$K(B@dfn{$BEPO?$5$l(B}$B$F$$$k$H$$$$$^$9!#(B
$B3FEPO?$5$l$?%U%!%$%k$K$O!"(B
$B%U%!%$%k$N8=>u$H$=$NJQ99MzNr$r5-=R$7$?BP1~$9$k(B
@dfn{$B%^%9%?%U%!%$%k(B}$B$,B8:_$7$^$9!#(B
$B$3$N>pJs$O!"8=:_$NHG$d0JA0$NHG$r:F9=@.$9$k$N$K==J,$G$9!#(B
$BDL>o!"%^%9%?%U%!%$%k$K$O!"$=$l$>$l$NHG$K$D$$$F!"(B
$B$=$NHG$NJQ99E@$r8@MU$G5-=R$7$?(B@dfn{$B5-O?9`L\(B}$B$b5-O?$5$l$F$$$^$9!#(B
@c @cindex work file
@c @cindex checking out files
@cindex $B:n6H%U%!%$%k(B
@cindex $B%U%!%$%k$r%A%'%C%/%"%&%H$9$k(B
@c The file that is maintained under version control is sometimes called
@c the @dfn{work file} corresponding to its master file. You edit the work
@c file and make changes in it, as you would with an ordinary file. (With
@c SCCS and RCS, you must @dfn{lock} the file before you start to edit it.)
@c After you are done with a set of changes, you @dfn{check the file in},
@c which records the changes in the master file, along with a log entry for
@c them.
$BHG4IM}$N2<$G4IM}$5$l$F$$$k%U%!%$%k$r!"(B
$B$=$N%^%9%?%U%!%$%k$KBP1~$9$k(B@dfn{$B:n6H%U%!%$%k(B}$B$H8F$V$3$H$b$"$j$^$9!#(B
$BIaDL$N%U%!%$%k$HF1MM$K!":n6H%U%!%$%k$rJT=8$7$FJQ99$7$^$9!#(B
$B!J(BSCCS$B$d(BRCS$B$G$O!"%U%!%$%k$rJT=8$9$k$^$($K%U%!%$%k$r(B@dfn{$B%m%C%/(B}
@footnote{$B!ZLuCm![(BEmacs$B$,F1;~JT=8$rKI$0$?$a$N%m%C%/$H$OJL$N%m%C%/!#(B}
$B$9$kI,MW$,$"$k!#!K(B
$B0lO"$NJQ99$r=*$($?$i!"%U%!%$%k$r(B@dfn{$B%A%'%C%/%$%s(B}$B!"$D$^$j!"(B
$B5-O?9`L\$H$H$b$KJQ99$r%^%9%?%U%!%$%k$K5-O?$7$^$9!#(B
@c With CVS, there are usually multiple work files corresponding to a
@c single master file---often each user has his own copy. It is also
@c possible to use RCS in this way, but this is not the usual way to use
@c RCS.
CVS$B$G$O!"(B1$B$D$N%^%9%?%U%!%$%k$KBP1~$9$k:n6H%U%!%$%k$rJ#?t8D;}$F$^$9!#(B
$B$7$P$7$P!"3F%f!<%6!<$,(B1$B8D$:$D:n6H%U%!%$%k$r;}$F$^$9!#(B
RCS$B$G$b$3$N$h$&$K$G$-$^$9$,!"(BRCS$B$NDL>o$N;H$$J}$G$O$"$j$^$;$s!#(B
@c @cindex locking and version control
@cindex $B%m%C%/$HHG4IM}(B
@c A version control system typically has some mechanism to coordinate
@c between users who want to change the same file. One method is
@c @dfn{locking} (analogous to the locking that Emacs uses to detect
@c simultaneous editing of a file, but distinct from it). The other method
@c is to merge your changes with other people's changes when you check them
@c in.
$BE57?E*$JHG4IM}%7%9%F%`$K$O!"J#?t$N%f!<%6!<$,F1$8%U%!%$%k$r;H$&:]$N(B
$BD4Dd$r9T$&$?$a$N$J$s$i$+$N5!9=$,I,MW$G$9!#(B
1$B$D$NJ}K!$O!J(BEmacs$B$,F1;~JT=8$N8!=P$K;H$&%m%C%/$KN`;w$@$,!"$=$l$H$OJL$N!K(B
@dfn{$B%m%C%/(B}$B$r;H$&$3$H$G$9!#(B
$BJL$NJ}K!$O!"%U%!%$%k$r%A%'%C%/%$%s$9$k;~E@$G!"(B
$BB>?M$NJQ99J,$rJ;9g$9$k$3$H$G$9!#(B
@c With version control locking, work files are normally read-only so
@c that you cannot change them. You ask the version control system to make
@c a work file writable for you by locking it; only one user can do
@c this at any given time. When you check in your changes, that unlocks
@c the file, making the work file read-only again. This allows other users
@c to lock the file to make further changes. SCCS always uses locking, and
@c RCS normally does.
$B%m%C%/$r;H$&HG4IM}$N>l9g!":n6H%U%!%$%k$OJQ99$G$-$J$$$h$&$K(B
$BDL>o$OFI$_=P$7@lMQ$G$9!#(B
$BHG4IM}%7%9%F%`$KBP$7$F!"(B
$B=q$-9~$_2DG=$J:n6H%U%!%$%k$r:n$j!"$=$l$r%m%C%/$9$k$h$&$KMW5a$7$^$9!#(B
$B0lEY$K$O(B1$B?M$N%f!<%6!<$@$1$,$3$l$r$G$-$^$9!#(B
$B<+J,$NJQ99J,$r%A%'%C%/%$%s$9$k$H!"(B
$B%U%!%$%k$N%m%C%/$r30$7!":n6H%U%!%$%k$r$U$?$?$SFI$_=P$7@lMQ$K$7$^$9!#(B
$B$3$l$K$h$j!"B>$N%f!<%6!<$,$5$i$KJQ99$9$k$?$a$K(B
$B%U%!%$%k$r%m%C%/$G$-$k$h$&$K$J$j$^$9!#(B
SCCS$B$O$D$M$K%m%C%/$r;H$$$^$9$7!"(BRCS$B$bDL>o$O%m%C%/$r;H$$$^$9!#(B
@c The other alternative for RCS is to let each user modify the work file
@c at any time. In this mode, locking is not required, but it is
@c permitted; check-in is still the way to record a new version.
RCS$B$G$OJL$NJ}K!$b$"$C$F!"3F%f!<%6!<$,$$$D$G$b:n6H%U%!%$%k$rJQ99$G$-$^$9!#(B
$B$3$N%b!<%I$G$O%m%C%/$OI,MW$"$j$^$;$s$,!";H$&$3$H$b$G$-$^$9!#(B
$B?7HG$r5-O?$9$kJ}K!$O!"$d$O$j%A%'%C%/%$%s$G$9!#(B
@c CVS normally allows each user to modify his own copy of the work file
@c at any time, but requires merging with changes from other users at
@c check-in time. However, CVS can also be set up to require locking.
@c (@pxref{Backend Options}).
CVS$B$G$O!"DL>o!"3F%f!<%6!<$O$$$D$G$b3F<+$N:n6H%U%!%$%k$rJQ99$G$-$^$9$,!"(B
$B%A%'%C%/%$%s;~$KB>$N%f!<%6!<$NJQ99J,$rJ;9g$9$kI,MW$,$"$j$^$9!#(B
$B$7$+$7!"(BCVS$B$G$b%m%C%/$r;H$&$h$&$K$b$G$-$^$9(B
$B!J(B@pxref{Backend Options}$B!K!#(B
@node VC Mode Line
@c @subsection Version Control and the Mode Line
@subsection VC$B$H%b!<%I9T(B
@c When you visit a file that is under version control, Emacs indicates
@c this on the mode line. For example, @samp{RCS-1.3} says that RCS is
@c used for that file, and the current version is 1.3.
$BHG4IM}$N2<$K$"$k%U%!%$%k$rK,Ld$9$k$H!"(B
Emacs$B$O$=$N$3$H$r%b!<%I9T$K<($7$^$9!#(B
$B$?$H$($P!"(B@samp{RCS-1.3}$B$O!"$=$N%U%!%$%k$K$O(BRCS$B$,;H$o$l$F$$$F!"(B
$B8=:_$NHG$,(B1.3$B$G$"$k$3$H$rI=$7$^$9!#(B
@c The character between the back-end name and the version number
@c indicates the version control status of the file. @samp{-} means that
@c the work file is not locked (if locking is in use), or not modified (if
@c locking is not in use). @samp{:} indicates that the file is locked, or
@c that it is modified. If the file is locked by some other user (for
@c instance, @samp{jim}), that is displayed as @samp{RCS:jim:1.3}.
$B%P%C%/%(%s%I$NL>A0$HHGHV9f$N$"$$$@$NJ8;z$O!"%U%!%$%k$NHG4IM}>uBV$r<($7$^$9!#(B
@samp{-}$B$O!"!J%m%C%/$r;H$C$F$$$k$N$G$"$l$P!K(B
$B:n6H%U%!%$%k$,%m%C%/$5$l$F$$$J$$$3$H!"$"$k$$$O!"(B
$B!J%m%C%/$r;H$C$F$$$J$$$N$G$"$l$P!K%U%!%$%k$,JQ99$5$l$F$$$J$$$3$H$rI=$7$^$9!#(B
@samp{:}$B$OB>$N%f!<%6!<!J$?$H$($P!"(B@samp{jim}$B!K$,%m%C%/$7$F$$$k$3$H$rI=$7!"(B
@samp{RCS:jim:1.3}$B$N$h$&$KI=<($5$l$^$9!#(B
@node Basic VC Editing
@c @subsection Basic Editing under Version Control
@subsection VC$B2<$N4pK\E*$JJT=8(B
@c The principal VC command is an all-purpose command that performs
@c either locking or check-in, depending on the situation.
$B<gMW$J(BVC$B%3%^%s%I$O!">u67$K1~$8$F%m%C%/$+%A%'%C%/%$%s$r9T$&(B
$BHFMQ%3%^%s%I$G$9!#(B
@table @kbd
@item C-x C-q
@itemx C-x v v
@c Perform the next logical version control operation on this file.
$B$3$N%U%!%$%k$KBP$7$FO@M}E*$J$D$.$NHG4IM}A`:n$r<B;\$9$k!#(B
@end table
@findex vc-next-action
@findex vc-toggle-read-only
@kindex C-x v v
@c @kindex C-x C-q @r{(Version Control)}
@kindex C-x C-q @r{$B!J(BVC$B!"HG4IM}!K(B}
@c Strictly speaking, the command for this job is @code{vc-next-action},
@c bound to @kbd{C-x v v}. However, the normal meaning of @kbd{C-x C-q} is
@c to make a read-only buffer writable, or vice versa; we have extended it
@c to do the same job properly for files managed by version control, by
@c performing the appropriate version control operations. When you type
@c @kbd{C-x C-q} on a registered file, it acts like @kbd{C-x v v}.
$B@53N$K$$$($P!"$3$NA`:n$r9T$&%3%^%s%I$O(B@code{vc-next-action}$B$G$"$C$F!"(B
@kbd{C-x v v}$B$K%P%$%s%I$7$F$"$j$^$9!#(B
$B$7$+$7!"(B@kbd{C-x C-q}$B$NDL>o$N0UL#$O!"(B
$BFI$_=P$7@lMQ%P%C%U%!$r=q$-9~$_2DG=$K$9$k$+!"$"$k$$$O!"$=$N5U$r9T$$$^$9!#(B
$B$3$NA`:n$r!"E,@Z$JHG4IM}A`:n$r<B;\$9$k$3$H$G(B
$BHG4IM}2<$G4IM}$5$l$F$$$k%U%!%$%k$KBP$7$F$bF1$8$3$H$r(B
$B@5$7$/9T$&$h$&$K3HD%$7$?$N$G$9!#(B
$BEPO?$5$l$?%U%!%$%k$KBP$7$F(B@kbd{C-x C-q}$B$rBG$D$H!"(B
@kbd{C-x v v}$B$N$h$&$KF0:n$7$^$9!#(B
@c The precise action of this command depends on the state of the file,
@c and whether the version control system uses locking or not. SCCS and
@c RCS normally use locking; CVS normally does not use locking.
$B$3$N%3%^%s%I$N@53N$JF0:n$O!"%U%!%$%k$N>uBV$HHG4IM}%7%9%F%`!J%P%C%/%(%s%I!K(B
$B$,%m%C%/$r;H$&$+$I$&$+$K0MB8$7$^$9!#(B
SCCS$B$H(BRCS$B$ODL>o$O%m%C%/$r;H$$$^$9$,!"(BCVS$B$ODL>o$O%m%C%/$r;H$$$^$;$s!#(B
@menu
* VC with Locking:: RCS in its default mode, SCCS, and optionally CVS.
* Without Locking:: Without locking: default mode for CVS.
* Log Buffer:: Features available in log entry buffers.
@end menu
@node VC with Locking
@c @subsubsection Basic Version Control with Locking
@subsubsection $B%m%C%/;HMQ;~$N4pK\E*$JJT=8(B
@c If locking is used for the file (as with SCCS, and RCS in its default
@c mode), @kbd{C-x C-q} can either lock a file or check it in:
$B!J(BSCCS$B$N>l9g$H(BRCS$B$N%G%U%)%k%H$N>l9g!K%U%!%$%k$KBP$7$F%m%C%/$r;H$&>l9g!"(B
@kbd{C-x C-q}$B$O!"%U%!%$%k$r%m%C%/$9$k!"$"$k$$$O!"(B
$B%U%!%$%k$r%A%'%C%/%$%s$9$k$N$$$:$l$+$r9T$$$^$9!#(B
@itemize @bullet
@item
@c If the file is not locked, @kbd{C-x C-q} locks it, and
@c makes it writable so that you can change it.
$B%U%!%$%k$,%m%C%/$5$l$F$$$J$1$l$P!"(B
@kbd{C-x C-q}$B$O$=$l$r%m%C%/$7!"(B
$BJQ99$G$-$k$h$&$K=q$-9~$_2DG=$K$9$k!#(B
@item
@c If the file is locked by you, and contains changes, @kbd{C-x C-q} checks
@c in the changes. In order to do this, it first reads the log entry
@c for the new version. @xref{Log Buffer}.
$BF1$8%f!<%6!<$,%U%!%$%k$r%m%C%/$7$F$$$F!"$+$D!"JQ99$5$l$F$$$l$P!"(B
@kbd{C-x C-q}$B$O%A%'%C%/%$%s$r9T$&!#(B
$B$3$N$H$-!"?7HG$KBP$9$k5-O?9`L\$r$^$:FI$_<h$k!#(B
@pxref{Log Buffer}$B!#(B
@item
@c If the file is locked by you, but you have not changed it since you
@c locked it, @kbd{C-x C-q} releases the lock and makes the file read-only
@c again.
$BF1$8%f!<%6!<$,%U%!%$%k$r%m%C%/$7$F$$$k$,!"(B
$B%m%C%/$7$F$+$i$^$C$?$/JQ99$7$F$$$J$$$H$-$K$O!"(B
@kbd{C-x C-q}$B$O%m%C%/$r30$7$F%U%!%$%k$r$U$?$?$SFI$_=P$7@lMQ$K$9$k!#(B
@item
@c If the file is locked by some other user, @kbd{C-x C-q} asks you whether
@c you want to ``steal the lock'' from that user. If you say yes, the file
@c becomes locked by you, but a message is sent to the person who had
@c formerly locked the file, to inform him of what has happened.
$BB>$N%f!<%6!<$,%U%!%$%k$r%m%C%/$7$F$$$k>l9g!"(B
@kbd{C-x C-q}$B$O$=$N%f!<%6!<$+$i!X%m%C%/$r2#<h$j$9$k!Y$+$I$&$+J9$$$F$/$k!#(B
$B2#<h$j$9$k$h$&$KEz$($k$H!"%U%!%$%k$r%m%C%/$7D>$9$,!"(B
$B$^$($K%m%C%/$7$F$$$?%f!<%6!<$K$O%m%C%/$r2#<h$j$5$l$?$3$H$rEA$($k!#(B
@end itemize
@c These rules also apply when you use CVS in locking mode, except
@c that there is no such thing as stealing a lock.
$B0J>e$N5,B'$O!"(BCVS$B$G%m%C%/$r;HMQ$7$F$$$k>l9g$K$bE,MQ$G$-$^$9$,!"(B
$B!X%m%C%/$r2#<h$j$9$k!Y$3$H$O$"$j$^$;$s!#(B
@node Without Locking
@c @subsubsection Basic Version Control without Locking
@subsubsection $B%m%C%/Hs;HMQ;~$N4pK\E*$JJT=8(B
@c When there is no locking---the default for CVS---work files are always
@c writable; you do not need to do anything before you begin to edit a
@c file. The status indicator on the mode line is @samp{-} if the file is
@c unmodified; it flips to @samp{:} as soon as you save any changes in the
@c work file.
CVS$B$N%G%U%)%k%H$N$h$&$K!"%m%C%/$r;H$o$J$$$H$-$K$O!"(B
$B:n6H%U%!%$%k$O$$$D$G$b=q$-9~$_2DG=$G$9!#(B
$B%U%!%$%k$rJT=8$9$k$^$($K$9$Y$-$3$H$O2?$b$"$j$^$;$s!#(B
$B%b!<%I9T$N>uBVI=<($O!"%U%!%$%k$,JQ99$5$l$F$$$J$1$l$P(B@samp{-}$B$G$9!#(B
$B:n6H%U%!%$%k$KJQ99$rJ]B8$9$k$H$?$@$A$K(B@samp{:}$B$KJQ$o$j$^$9!#(B
@c Here is what @kbd{C-x C-q} does when using CVS:
$B0J2<$O!"(BCVS$B$r;H$C$F$$$k$H$-$N(B@kbd{C-x C-q}$B$NF0:n$G$9!#(B
@itemize @bullet
@item
@c If some other user has checked in changes into the master file,
@c Emacs asks you whether you want to merge those changes into your own
@c work file (@pxref{Merging}). You must do this before you can check in
@c your own changes.
$BB>$N%f!<%6!<$,JQ99J,$r%^%9%?%U%!%$%k$K%A%'%C%/%$%s$7$F$$$k$H!"(B
$B$=$l$i$r<+J,MQ$N:n6H%U%!%$%k$KJ;9g!J(B@pxref{Merging}$B!K$9$k$+$I$&$+J9$$$F$/$k!#(B
$B<+J,$NJQ99J,$r%A%'%C%/%$%s$9$k$^$($K$O!"$3$l$r9T$&I,MW$,$"$k!#(B
@item
@c If there are no new changes in the master file, but you have made
@c modifications in your work file, @kbd{C-x C-q} checks in your changes.
@c In order to do this, it first reads the log entry for the new version.
@c @xref{Log Buffer}.
$B%^%9%?%U%!%$%k$K?7$?$JJQ99$,$J$/$F$b!"(B
$B<+J,MQ$N:n6H%U%!%$%k$rJQ99$7$F$"$k>l9g$K$O!"(B
@kbd{C-x C-q}$B$O$=$NJQ99$r%A%'%C%/%$%s$9$k!#(B
$B$3$l$r9T$&$?$a$K!"?7HG$KBP$9$k5-O?9`L\$r$^$:FI$_<h$k!#(B
@pxref{Log Buffer}$B!#(B
@item
@c If the file is not modified, the @kbd{C-x C-q} does nothing.
$B%U%!%$%k$,JQ99$5$l$F$$$J$1$l$P!"(B@kbd{C-x C-q}$B$O2?$b$7$J$$!#(B
@end itemize
@c These rules also apply when you use RCS in the mode that does not
@c require locking, except that automatic merging of changes from the
@c master file is not implemented. Unfortunately, this means that nothing
@c informs you if another user has checked in changes in the same file
@c since you began editing it, and when this happens, his changes will be
@c effectively removed when you check in your version (though they will
@c remain in the master file, so they will not be entirely lost). You must
@c therefore verify the current version is unchanged, before you check in your
@c changes. We hope to eliminate this risk and provide automatic merging
@c with RCS in a future Emacs version.
$B0J>e$N5,B'$O!"(BRCS$B$N%m%C%/$r;H$o$J$$%b!<%I$K$bE,MQ$G$-$^$9$,!"(B
$B%^%9%?%U%!%$%k$+$i<+F0E*$KJQ99$rJ;9g$9$k5!G=$O<BAu$7$F$"$j$^$;$s!#(B
$B;DG0$J$3$H$K!"$"$J$?$,JT=8$r;O$a$?$"$H$K!"B>$N%f!<%6!<$,F1$8%U%!%$%k$KJQ99$r(B
$B%A%'%C%/%$%s$7$F$b2?$b7Y9p$5$l$J$$$N$G$9!#(B
$B$7$+$b!"$3$N$h$&$J;vBV$,H/@8$9$k$H!"$"$J$?$,<+J,$NHG$r%A%'%C%/%$%s$7$?$H$-$K!"(B
$B$=$N%f!<%6!<$NJQ99$O<B<AE*$K$O<h$j=|$+$l$F$7$^$$$^$9(B
$B!J$H$O$$$(!"%^%9%?%U%!%$%k$NCf$K$O;D$C$F$$$k$N$G!"(B
$B40A4$K$J$/$J$k$o$1$G$O$J$$!K!#(B
$B$7$?$,$C$F!"<+J,$NJQ99$r%A%'%C%/%$%s$9$k$^$($K$O!"(B
$B8=:_$NHG$,JQ99$5$l$F$$$J$$$3$H$r3NG'$9$kI,MW$,$"$j$^$9!#(B
Emacs$B$N>-Mh$NHG$G$O!"$3$N$h$&$J4m81@-$r<h$j=|$-!"(B
RCS$B$G$b<+F0J;9g$r9T$($k$h$&$K9M$($F$$$^$9!#(B
@c In addition, locking is possible with RCS even in this mode, although
@c it is not required; @kbd{C-x C-q} with an unmodified file locks the
@c file, just as it does with RCS in its normal (locking) mode.
$B$^$?!"$3$N%b!<%I$G$b(BRCS$B$N%m%C%/$r;H$($^$9$,!"I,?\$G$O$"$j$^$;$s!#(B
$B%U%!%$%k$rJQ99$7$F$$$J$$$H$-$K(B@kbd{C-x C-q}$B$r;H$&$H!"(B
RCS$B$NDL>o$N!J%m%C%/$r;H$&!K%b!<%I$N$h$&$K!"(B
$B%U%!%$%k$r%m%C%/$7$^$9!#(B
@node Log Buffer
@c @subsubsection Features of the Log Entry Buffer
@subsubsection $B5-O?9`L\MQ%P%C%U%!$N5!G=(B
@c When you check in changes, @kbd{C-x C-q} first reads a log entry. It
@c pops up a buffer called @samp{*VC-Log*} for you to enter the log entry.
@c When you are finished, type @kbd{C-c C-c} in the @samp{*VC-Log*} buffer.
@c That is when check-in really happens.
$BJQ99$r%A%'%C%/%$%s$9$k$H!"(B@kbd{C-x C-q}$B$O5-O?9`L\$r$^$:FI$_$^$9!#(B
$B5-O?9`L\$rF~NO$9$k$h$&$K!"(B@samp{*VC-Log*}$B$H$$$&%P%C%U%!$rN)$A>e$2$^$9!#(B
$BF~NO$7=*$($?$i!"(B@samp{*VC-Log*}$B$G(B@kbd{C-c C-c}$B$HBG$A$^$9!#(B
$B<B:]$K%A%'%C%/%$%s$r9T$&$H!"$3$N$h$&$K9T$o$l$^$9!#(B
@c To abort check-in, just @strong{don't} type @kbd{C-c C-c} in that
@c buffer. You can switch buffers and do other editing. As long as you
@c don't try to check in another file, the entry you were editing remains
@c in the @samp{*VC-Log*} buffer, and you can go back to that buffer at any
@c time to complete the check-in.
$B%A%'%C%/%$%s$r%"%\!<%H$9$k$K$O!"$=$N%P%C%U%!$G$O(B@kbd{C-c C-c}$B$r(B
$BBG$?(B@strong{$B$J$$(B}$B$G$/$@$5$$!#(B
$BJL$N%P%C%U%!$K@Z$jBX$($F!"JL$NJT=8$r$7$^$9!#(B
$BJL$N%U%!%$%k$r%A%'%C%/%$%s$7$h$&$H$7$J$$8B$j!"(B
$BF~NO$7$F$$$?5-O?9`L\$O(B@samp{*VC-Log*}$B%P%C%U%!$K;D$C$F$$$^$9$+$i!"(B
$B%A%'%C%/%$%s$r40N;$9$k$?$a!"$$$D$G$b$=$N%P%C%U%!$KLa$l$^$9!#(B
@c If you change several source files for the same reason, it is often
@c convenient to specify the same log entry for many of the files. To do
@c this, use the history of previous log entries. The commands @kbd{M-n},
@c @kbd{M-p}, @kbd{M-s} and @kbd{M-r} for doing this work just like the
@c minibuffer history commands (except that these versions are used outside
@c the minibuffer).
$BJ#?t$N%=!<%9%U%!%$%k$rF1$8M}M3$GJQ99$7$?$H$-$K$O!"(B
$BB?$/$N%U%!%$%k$KF1$85-O?9`L\$r;XDj$G$-$k$HJXMx$G$9!#(B
$B$3$&$9$k$K$O!"$^$($N5-O?9`L\$NMzNr$r;H$$$^$9!#(B
$B%3%^%s%I!"(B@kbd{M-n}$B!"(B@kbd{M-p}$B!"(B@kbd{M-s}$B!"(B@kbd{M-r}$B$O!"(B
$B%_%K%P%C%U%!$NMzNr%3%^%s%I$N$h$&$KF/$-$^$9(B
$B!J$?$@$7!"$3$l$i$N%3%^%s%I$O%_%K%P%C%U%!$N30It$G;H$&!K!#(B
@vindex vc-log-mode-hook
@c Each time you check in a file, the log entry buffer is put into VC Log
@c mode, which involves running two hooks: @code{text-mode-hook} and
@c @code{vc-log-mode-hook}. @xref{Hooks}.
$B%U%!%$%k$K%A%'%C%/%$%s$9$k$?$S$K!"(B
$B5-O?9`L\MQ%P%C%U%!$O(BVC$B5-O?!J(Bvc-log$B!K%b!<%I$K$J$j$^$9!#(B
$B$3$N%b!<%I$O(B2$B$D$N%U%C%/!"(B@code{text-mode-hook}$B$H(B@code{vc-log-mode-hook}$B$r(B
$B5/F0$7$^$9!#(B
@xref{Hooks}$B!#(B
@node Old Versions
@c @subsection Examining And Comparing Old Versions
@subsection $B5lHG$ND4::$HHf3S(B
@c One of the convenient features of version control is the ability
@c to examine any version of a file, or compare two versions.
$BHG4IM}$NJXMx$J5!G=$N(B1$B$D$O!"%U%!%$%k$NG$0U$NHG$rD4$Y$?$j!"(B
2$B$D$NHG$rHf3S$G$-$k$3$H$G$9!#(B
@table @kbd
@item C-x v ~ @var{version} @key{RET}
@c Examine version @var{version} of the visited file, in a buffer of its
@c own.
$BK,Ld$7$F$$$k%U%!%$%k$NHG(B@var{version}$B$r(B
$B$=$l@lMQ$N%P%C%U%!$GD4$Y$k!#(B
@item C-x v =
@c Compare the current buffer contents with the latest checked-in version
@c of the file.
$B%+%l%s%H%P%C%U%!$NFbMF$H%U%!%$%k$N%A%'%C%/%$%s$7$?:G?7HG$H$rHf3S$9$k!#(B
@item C-u C-x v = @var{file} @key{RET} @var{oldvers} @key{RET} @var{newvers} @key{RET}
@c Compare the specified two versions of @var{file}.
@var{file}$B$N;XDj$7$?(B2$B$D$NHG$rHf3S$9$k!#(B
@item C-x v g
@c Display the result of the CVS annotate command using colors.
$BI=<(?'$rJQ$($F(BCVS$B$NCm5-%3%^%s%I$N7k2L$rI=<($9$k!#(B
@end table
@findex vc-version-other-window
@kindex C-x v ~
@c To examine an old version in toto, visit the file and then type
@c @kbd{C-x v ~ @var{version} @key{RET}} (@code{vc-version-other-window}).
@c This puts the text of version @var{version} in a file named
@c @file{@var{filename}.~@var{version}~}, and visits it in its own buffer
@c in a separate window. (In RCS, you can also select an old version
@c and create a branch from it. @xref{Branches}.)
1$B$D$N5lHG$rD4$Y$k$K$O!"%U%!%$%k$rK,Ld$7$F(B@kbd{C-x v ~ @var{version} @key{RET}}
$B!J(B@code{vc-version-other-window}$B!K$HBG$A$^$9!#(B
$B$3$l$K$h$j!"%U%!%$%k$NHG(B@var{version}$B$N%F%-%9%H$r(B
@file{@var{filename}.~@var{version}~}$B$H$$$&L>A0$N%U%!%$%k$K<}$a!"(B
$BJL$N%&%#%s%I%&$N$=$l@lMQ$N%P%C%U%!$G$=$N%U%!%$%k$rK,Ld$7$^$9!#(B
$B!J(BRCS$B$G$O!"5lHG$rA*Br$7$F!"$=$l$+$i;^J,$+$l$r:n@.$G$-$k!#(B
@pxref{Branches}$B!#!K(B
@findex vc-diff
@kindex C-x v =
@c But usually it is more convenient to compare two versions of the file,
@c with the command @kbd{C-x v =} (@code{vc-diff}). Plain @kbd{C-x v =}
@c compares the current buffer contents (saving them in the file if
@c necessary) with the last checked-in version of the file. @kbd{C-u C-x v
@c =}, with a numeric argument, reads a file name and two version numbers,
@c then compares those versions of the specified file.
$B$7$+$7DL>o$O!"%3%^%s%I(B@kbd{C-x v =}$B!J(B@code{vc-diff}$B!K$G(B
$B%U%!%$%k$N(B2$B$D$NHG$rHf3S$7$?$[$&$,!"$b$C$HJXMx$G$9!#(B
$B0z?t$r;XDj$7$J$$(B@kbd{C-x v =}$B$G$O!"%+%l%s%H%U%!%$%k$NFbMF(B
$B!JI,MW$,$"$l$P%U%!%$%k$KJ]B8$9$k!K$H%U%!%$%k$N%A%'%C%/%$%s$7$F$"$k(B
$B:G?7HG$H$rHf3S$7$^$9!#(B
$B?t0z?t$r;XDj$7$?(B@kbd{C-u C-x v =}$B$G$O!"(B
$B%U%!%$%kL>$H(B2$B$D$NHGHV9f$rFI$_<h$C$F$+$i!"(B
$B;XDj$7$?%U%!%$%k$N(B2$B$D$NHG$rHf3S$7$^$9!#(B
@c If you supply a directory name instead of the name of a registered
@c file, this command compares the two specified versions of all registered
@c files in that directory and its subdirectories.
$BEPO?$7$?%U%!%$%k$N$+$o$j$K%G%#%l%/%H%jL>$r;XDj$9$k$H!"(B
$B$3$N%3%^%s%I$O!"$=$N%G%#%l%/%H%j$H$=$N2<$K$"$k%5%V%G%#%l%/%H%j$K(B
$BCV$+$l$F$$$k$9$Y$F$NEPO?$5$l$?%U%!%$%k$N;XDj$7$?(B2$B$D$NHG$rHf3S$7$^$9!#(B
@c You can specify a checked-in version by its number; an empty input
@c specifies the current contents of the work file (which may be different
@c from all the checked-in versions). You can also specify a snapshot name
@c (@pxref{Snapshots}) instead of one or both version numbers.
$B%A%'%C%/%$%s$7$F$"$kHG$O!"$=$NHV9f$G;XDj$7$^$9!#(B
$BF~NO$,6u$@$H!"!J%A%'%C%/%$%s$7$F$"$kHG$H$O0[$J$k$+$b$7$l$J$$!K:n6H%U%!%$%k$N(B
$B8=:_$NFbMF$r;XDj$7$^$9!#(B
$BHGHV9f$N$+$o$j$K!"%9%J%C%W%7%g%C%HL>!J(B@pxref{Snapshots}$B!K$r;XDj$9$k$3$H$b(B
$B$G$-$^$9!#(B
@c This command works by running the @code{diff} utility, getting the
@c options from the variable @code{diff-switches}. It displays the output
@c in a special buffer in another window. Unlike the @kbd{M-x diff}
@c command, @kbd{C-x v =} does not try to locate the changes in the old and
@c new versions. This is because normally one or both versions do not
@c exist as files when you compare them; they exist only in the records of
@c the master file. @xref{Comparing Files}, for more information about
@c @kbd{M-x diff}.
$B$3$N%3%^%s%I$O!"JQ?t(B@code{diff-switches}$B$G;XDj$5$l$k%*%W%7%g%s$rMQ$$$F!"(B
@code{diff}$B%W%m%0%i%`$r<B9T$7$FF0:n$7$^$9!#(B
$B$=$N=PNO$OJL$N%&%#%s%I%&$NFCJL$J%P%C%U%!$KI=<($5$l$^$9!#(B
@kbd{M-x diff}$B%3%^%s%I$H0c$C$F!"(B@kbd{C-x v =}$B$G$O?7HG$H5lHG$N(B
$BAj0c2U=j$K$O0\F0$G$-$^$;$s!#(B
$B$H$$$&$N$O!"DL>o!"0lJ}$NHG!"$"$k$$$O!"N>J}$NHG$O!"(B
$BHf3S$9$k$H$-$K$O%U%!%$%k$H$7$F$OB8:_$7$F$$$J$$$+$i$G$9!#(B
$B$=$l$i$O!"%^%9%?%U%!%$%k$N5-O?$NCf$KB8:_$9$k$@$1$G$9!#(B
@kbd{M-x diff}$B$K$D$$$F$h$j>\$7$/$O!"(B@xref{Comparing Files}$B!#(B
@findex vc-annotate
@kindex C-x v g
@c For CVS-controlled files, you can display the result of the CVS
@c annotate command, using colors to enhance the visual appearance. Use
@c the command @kbd{M-x vc-annotate} to do this. Red means new, blue means
@c old, and intermediate colors indicate intermediate ages. A prefix
@c argument @var{n} specifies a stretch factor for the time scale; it makes
@c each color cover a period @var{n} times as long.
CVS$B$G4IM}$7$F$$$k%U%!%$%k$K4X$7$F$O!"(B
$B0lL\$G$o$+$k$h$&$KJ#?t$NI=<(?'$r;H$C$F!"(BCVS$BCm5-%3%^%s%I$N7k2L$rI=<($G$-$^$9!#(B
$B$3$l$K$O!"(B@kbd{M-x vc-annotate}$B$r;H$$$^$9!#(B
$B@V$O?7HG!"@D$O5lHG!"$=$l$i$NCf4V?'$OCf4V$NHG$rI=$7$^$9!#(B
$B?t0z?t(B@var{n}$B$O!";~4V<\EY$r?-$P$7$^$9!#(B
$B$D$^$j!"$"$kI=<(?'$GI=$94|4V$r(B@var{n}$BG\$7$^$9!#(B
@node Secondary VC Commands
@c @subsection The Secondary Commands of VC
@subsection VC$B$NI{<!E*$J%3%^%s%I(B
@c This section explains the secondary commands of VC; those that you might
@c use once a day.
$BK\@a$G$O!"(BVC$B$NI{<!E*$J%3%^%s%I$r@bL@$7$^$9!#(B
1$BF|$K0lEY$/$i$$;H$&$h$&$J%3%^%s%I$G$9!#(B
@menu
* Registering:: Putting a file under version control.
* VC Status:: Viewing the VC status of files.
* VC Undo:: Cancelling changes before or after check-in.
* VC Dired Mode:: Listing files managed by version control.
* VC Dired Commands:: Commands to use in a VC Dired buffer.
@end menu
@node Registering
@c @subsubsection Registering a File for Version Control
@subsubsection VC$B$X$N%U%!%$%kEPO?(B
@kindex C-x v i
@findex vc-register
@c You can put any file under version control by simply visiting it, and
@c then typing @w{@kbd{C-x v i}} (@code{vc-register}).
$B%U%!%$%k$rK,Ld$7$F$+$i(B@w{@kbd{C-x v i}}$B!J(B@code{vc-register}$B!K$HBG$D$@$1$G!"(B
$B%U%!%$%k$rHG4IM}$N4IM}2<$KCV$1$^$9!#(B
@table @kbd
@item C-x v i
@c Register the visited file for version control.
$BK,Ld$7$?%U%!%$%k$rHG4IM}$KEPO?$9$k!#(B
@end table
@vindex vc-default-back-end
@c To register the file, Emacs must choose which version control system
@c to use for it. You can specify your choice explicitly by setting
@c @code{vc-default-back-end} to @code{RCS}, @code{CVS} or @code{SCCS}.
@c Otherwise, if there is a subdirectory named @file{RCS}, @file{SCCS}, or
@c @file{CVS}, Emacs uses the corresponding version control system. In the
@c absence of any specification, the default choice is RCS if RCS is
@c installed, otherwise SCCS.
$B%U%!%$%k$rEPO?$9$k$K$O!"(BEmacs$B$O$=$N%U%!%$%k$KBP$7$F$I$NHG4IM}%7%9%F%`$r(B
$B;H$&$+A*$VI,MW$,$"$j$^$9!#(B
@code{vc-default-back-end}$B$K!"(B@code{RCS}$B!"(B@code{CVS}$B!"(B@code{SCCS}$B$N(B
$B$$$:$l$+$r@_Dj$9$l$P!"L@<(E*$K;XDj$G$-$^$9!#(B
$B$"$k$$$O!"(B@file{RCS}$B!"(B@file{SCCS}$B!"(B@file{CVS}$B$H$$$&L>A0$N(B
$B%5%V%G%#%l%/%H%j$,$"$k$J$i!"(BEmacs$B$OBP1~$9$kHG4IM}%7%9%F%`$r;H$$$^$9!#(B
$B;XDj$,$^$C$?$/$J$1$l$P!"%G%U%)%k%H$G$O!"(B
RCS$B$,%$%s%9%H!<%k$5$l$F$$$l$P(BRCS$B!"$5$b$J$1$l$P(BSCCS$B$rA*$S$^$9!#(B
@c If locking is in use, @kbd{C-x v i} leaves the file unlocked and
@c read-only. Type @kbd{C-x C-q} if you wish to start editing it. After
@c registering a file with CVS, you must subsequently commit the initial
@c version by typing @kbd{C-x C-q}.
$B%m%C%/$r;HMQ$7$F$$$k>l9g$K$O!"(B@kbd{C-x v i}$B$O!"(B
$B%U%!%$%k$N%m%C%/$r2r=|$7FI$_=P$7@lMQ$K$7$^$9!#(B
$B%U%!%$%k$NJT=8$r;O$a$?$$>l9g$K$O!"(B@kbd{C-x C-q}$B$HBG$A$^$9!#(B
CVS$B$K%U%!%$%k$rEPO?$7$?$"$H$G$O!"(B
@kbd{C-x C-q}$B$HBG$C$F:G=i$NHG$r5-O?$9$kI,MW$,$"$j$^$9!#(B
@vindex vc-default-init-version
@c The initial version number for a newly registered file is 1.1, by
@c default. You can specify a different default by setting the variable
@c @code{vc-default-init-version}, or you can give @kbd{C-x v i} a numeric
@c argument; then it reads the initial version number for this particular
@c file using the minibuffer.
$B?7$7$/EPO?$5$l$?%U%!%$%k$N:G=i$NHGHV9f$O!"%G%U%)%k%H$G$O(B1.1$B$G$9!#(B
$B0[$J$k%G%U%)%k%H$r;XDj$9$k$K$O!"(B
$BJQ?t(B@code{vc-default-init-version}$B$K@_Dj$7$^$9!#(B
$B$"$k$$$O!"(B@kbd{C-x v i}$B$K?t0z?t$r;XDj$9$k$H!"(B
$B$=$N%U%!%$%k$@$1$K;H$&:G=i$NHGHV9f$r%_%K%P%C%U%!$GFI$_$^$9!#(B
@vindex vc-initial-comment
@c If @code{vc-initial-comment} is non-@code{nil}, @kbd{C-x v i} reads an
@c initial comment to describe the purpose of this source file. Reading
@c the initial comment works like reading a log entry (@pxref{Log Buffer}).
@code{vc-initial-comment}$B$,(B@code{nil}$B0J30$J$i$P!"(B
@kbd{C-x v i}$B$O$3$N%=!<%9%U%!%$%k$NL\E*$r5-$7$?=i4|%3%a%s%H$rFI$_$^$9!#(B
$B$3$l$O5-O?9`L\!J(B@pxref{Log Buffer}$B!K$rFI$`$N$HF1$8$h$&$KF0:n$7$^$9!#(B
@node VC Status
@c @subsubsection VC Status Commands
@subsubsection VC$B>uBVI=<(%3%^%s%I(B
@table @kbd
@item C-x v l
@c Display version control state and change history.
$BHG4IM}$N>uBV$HJQ99MzNr$rI=<($9$k!#(B
@end table
@kindex C-x v l
@findex vc-print-log
@c To view the detailed version control status and history of a file,
@c type @kbd{C-x v l} (@code{vc-print-log}). It displays the history of
@c changes to the current file, including the text of the log entries. The
@c output appears in a separate window.
$B%U%!%$%k$N>\$7$$HG4IM}>uBV$dMzNr$r8+$k$K$O!"(B
@kbd{C-x v l}$B!J(B@code{vc-print-log}$B!K$HBG$A$^$9!#(B
$B5-O?9`L\$r4^$a$F%+%l%s%H%U%!%$%k$NJQ99MzNr$rI=<($7$^$9!#(B
$B=PNO$OJL$N%&%#%s%I%&$KI=<($5$l$^$9!#(B
@node VC Undo
@c @subsubsection Undoing Version Control Actions
@subsubsection $BHG4IM}A`:n$N%"%s%I%%(B
@table @kbd
@item C-x v u
@c Revert the buffer and the file to the last checked-in version.
$B%P%C%U%!$H%U%!%$%k$r:G?7$N%A%'%C%/%$%s$7$F$"$kHG$KI|85$9$k!#(B
@item C-x v c
@c Remove the last-entered change from the master for the visited file.
@c This undoes your last check-in.
$BK,Ld@h%U%!%$%k$N%^%9%?%U%!%$%k$K:G8e$KF~$l$?JQ99$r<h$j=|$/!#(B
$B$D$^$j!":G8e$N%A%'%C%/%$%s$r%"%s%I%%$9$k!#(B
@end table
@kindex C-x v u
@findex vc-revert-buffer
@c If you want to discard your current set of changes and revert to the
@c last version checked in, use @kbd{C-x v u} (@code{vc-revert-buffer}).
@c This leaves the file unlocked; if locking is in use, you must first lock
@c the file again before you change it again. @kbd{C-x v u} requires
@c confirmation, unless it sees that you haven't made any changes since the
@c last checked-in version.
$B$3$l$^$G$N0lO"$NJQ99$rGK4~$7$F%A%'%C%/%$%s$7$F$"$k:G?7HG$XI|85$7$?$$$H$-$O!"(B
@kbd{C-x v u}$B!J(B@code{vc-revert-buffer}$B!K$r;H$$$^$9!#(B
$B%m%C%/$r;HMQ$7$F$$$k$H$-$K$O!"%U%!%$%k$N%m%C%/$r2r=|$9$k$N$G!"(B
$BJQ99$r;O$a$k$^$($K$^$:%U%!%$%k$r%m%C%/$7D>$9I,MW$,$"$j$^$9!#(B
$B%A%'%C%/%$%s$7$?:G?7HG$+$iJQ99$7$F$$$J$$$HH=CG$G$-$J$$8B$j!"(B
@kbd{C-x v u}$B$O3NG'$r5a$a$F$-$^$9!#(B
@c @kbd{C-x v u} is also the command to unlock a file if you lock it and
@c then decide not to change it.
@kbd{C-x v u}$B$O!"(B
$B%U%!%$%k$r%m%C%/$7$?$1$l$I$b$d$O$j%U%!%$%k$rJQ99$7$J$$$H7h$a$?$H$-$K!"(B
$B%m%C%/$r2r=|$9$k%3%^%s%I$G$b$"$j$^$9!#(B
@kindex C-x v c
@findex vc-cancel-version
@c To cancel a change that you already checked in, use @kbd{C-x v c}
@c (@code{vc-cancel-version}). This command discards all record of the
@c most recent checked-in version. @kbd{C-x v c} also offers to revert
@c your work file and buffer to the previous version (the one that precedes
@c the version that is deleted).
$B$9$G$K%A%'%C%/%$%s$7$F$7$^$C$?JQ99$r<h$j>C$9$K$O!"(B
@kbd{C-x v c}$B!J(B@code{vc-cancel-version}$B!K$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"%A%'%C%/%$%s$7$?:G?7HG$N$9$Y$F$N5-O?$r<N$F$5$j$^$9!#(B
$B$5$i$K!"(B@kbd{C-x v c}$B$O!":n6H%U%!%$%k$H%P%C%U%!$r(B
$B0JA0$NHG!J<N$F$?:G?7HG$N(B1$B$D$^$($NHG!K$KI|85$9$k$+$I$&$+(B
$BJ9$$$F$-$^$9!#(B
@c If you answer @kbd{no}, VC keeps your changes in the buffer, and locks
@c the file. The no-revert option is useful when you have checked in a
@c change and then discover a trivial error in it; you can cancel the
@c erroneous check-in, fix the error, and check the file in again.
@kbd{no}$B$HEz$($k$H!"(BVC$B$O%P%C%U%!$G$NJQ99$rJ];}$7$F(B
$B%U%!%$%k$b%m%C%/$7$?$^$^$K$7$^$9!#(B
$B%A%'%C%/%$%s$7$?JQ99$KL@$i$+$J$^$A$,$$$,$"$k$H$o$+$C$?$H$-$K!"(B
$B$3$N!VI|85$7$J$$!W$H$$$&A*Br;h$OJXMx$G$9!#(B
$B8m$j$r4^$s$@%A%'%C%/%$%s$r<h$j>C$7!"8m$j$rD{@5$7$F$+$i!"(B
$B2~$a$F%U%!%$%k$r%A%'%C%/%$%s$G$-$^$9!#(B
@c When @kbd{C-x v c} does not revert the buffer, it unexpands all
@c version control headers in the buffer instead (@pxref{Version Headers}).
@c This is because the buffer no longer corresponds to any existing
@c version. If you check it in again, the check-in process will expand the
@c headers properly for the new version number.
@kbd{C-x v c}$B$,%P%C%U%!$rI|85$7$J$$$H$-$K$O!"(B
$B$=$N$+$o$j$K!"%P%C%U%!Fb$N$9$Y$F$NHG4IM}%X%C%@$NE83+7A$r$b$H$N7A$KLa$7$^$9(B
$B!J(B@pxref{Version Headers}$B!K!#(B
$B$J$<$J$i!"%P%C%U%!$O$b$O$d4{B8$N$I$NHG$K$bBP1~$7$J$$$+$i$G$9!#(B
$B$U$?$?$S%A%'%C%/%$%s$9$k$H!"%A%'%C%/%$%s$N2aDx$G!"(B
$B?7$?$JHGHV9f$H$7$F@5$7$/%X%C%@$rE83+$7$^$9!#(B
@c However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header
@c automatically. If you use that header feature, you have to unexpand it
@c by hand---by deleting the entry for the version that you just canceled.
$B$7$+$7$J$,$i!"(BRCS$B$N(B@samp{@w{$}Log$}$B%X%C%@$r(B
$B<+F0E*$K$b$H$N7A$KLa$9$3$H$OIT2DG=$G$9!#(B
$B$3$N%X%C%@$N5!G=$r;H$&$J$i!"<h$j>C$7$?HG$KBP1~$9$k9`L\$r:o=|$9$k$3$H$G!"(B
$B$b$H$N7A$K<j$GLa$9I,MW$,$"$j$^$9!#(B
@c Be careful when invoking @kbd{C-x v c}, as it is easy to lose a lot of
@c work with it. To help you be careful, this command always requires
@c confirmation with @kbd{yes}. Note also that this command is disabled
@c under CVS, because canceling versions is very dangerous and discouraged
@c with CVS.
$BB?$/$N:n6H7k2L$r4JC1$K<:$C$F$7$^$&$N$G!"(B
@kbd{C-x v c}$B$r5/F0$9$k$H$-$K$O==J,Cm0U$7$F$/$@$5$$!#(B
@node VC Dired Mode
@c @subsubsection Dired under VC
@subsubsection VC$B2<$N(Bdired
@kindex C-x v d
@findex vc-directory
@c When you are working on a large program, it is often useful to find
@c out which files have changed within an entire directory tree, or to view
@c the status of all files under version control at once, and to perform
@c version control operations on collections of files. You can use the
@c command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
@c that includes only files relevant for version control.
$BBg$-$J%W%m%0%i%`$r07$C$F$$$k$H$-$O!"%G%#%l%/%H%j$NLZ9=B$A4BN$NCf$G(B
$B$I$N%U%!%$%k$,JQ99$5$l$?$N$+$rD4$Y$?$j!"(B
$BHG4IM}$N2<$KCV$+$l$F$$$k$9$Y$F$N%U%!%$%k$N>uBV$r0lEY$K8+$i$l$k$HJXMx$G$9!#(B
$B%3%^%s%I(B@kbd{C-x v d}$B!J(B@code{vc-directory}$B!K$r;H$($P!"(B
$BHG4IM}$K4XO"$7$?%U%!%$%k$@$1$r4^$s$@%G%#%l%/%H%j0lMw$r:n$l$^$9!#(B
@vindex vc-dired-terse-display
@c @kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
@c much like an ordinary Dired buffer (@pxref{Dired}); however, normally it
@c shows only the noteworthy files (those locked or not up-to-date). This
@c is called @dfn{terse display}. If you set the variable
@c @code{vc-dired-terse-display} to @code{nil}, then VC Dired shows all
@c relevant files---those managed under version control, plus all
@c subdirectories (@dfn{full display}). The command @kbd{v t} in a VC
@c Dired buffer toggles between terse display and full display (@pxref{VC
@c Dired Commands}).
@kbd{C-x v d}$B$O!"(BVC dired$B%b!<%I$r;H$&%P%C%U%!$r:n$j$^$9!#(B
$B$3$l$O!"IaDL$N(Bdired$B%P%C%U%!!J(B@pxref{Dired}$B!K$K$=$C$/$j$G$9$,!"(B
$B!J%m%C%/$5$l$F$$$?$j!"L$99?7$N!KCm0U$rJ'$&$Y$-%U%!%$%k$@$1$r(B
$BDL>o$OI=<($7$^$9!#(B
$B$3$l$r(B@dfn{$B4JAG$JI=<((B}$B$H8F$S$^$9!#(B
$BJQ?t(B@code{vc-dired-terse-display}$B$K(B@code{nil}$B$r@_Dj$9$k$H!"(B
VC dired$B$O!"4XO"$9$k$9$Y$F$N%U%!%$%k!"$D$^$j!"(B
$BHG4IM}$N2<$KCV$+$l$?%U%!%$%k$H$9$Y$F$N%5%V%G%#%l%/%H%j$rI=<($7$^$9(B
$B!J(B@dfn{$B40A4$JI=<((B}$B!K!#(B
VC dired$B%P%C%U%!$N%3%^%s%I(B@kbd{v t}$B$O!"(B
$B4JAG$JI=<($H40A4$JI=<($r@Z$jBX$($^$9!#(B
$B!J(B@pxref{VC Dired Commands}$B!#!K(B
@vindex vc-dired-recurse
@c By default, VC Dired produces a recursive listing of noteworthy or
@c relevant files at or below the given directory. You can change this by
@c setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
@c Dired shows only the files in the given directory.
$B%G%U%)%k%H$G$O!"(BVC dired$B$O!";XDj$7$?%G%#%l%/%H%j$d$=$l$h$j2<$KCV$+$l$?(B
$BCm0U$rJ'$&$Y$-%U%!%$%k$d4XO"$9$k%U%!%$%k$N:F5"E*$J0lMw$r:n$j$^$9!#(B
$B$3$NF0:n$rJQ$($k$K$O!"(B
$BJQ?t(B@code{vc-dired-recurse}$B$K(B@code{nil}$B$r@_Dj$7$^$9!#(B
$B$9$k$H!"(BVC dired$B$O!";XDj$7$?%G%#%l%/%H%j$K$"$k%U%!%$%k$@$1$rI=<($7$^$9!#(B
@c The line for an individual file shows the version control state in the
@c place of the hard link count, owner, group, and size of the file. If
@c the file is unmodified, in sync with the master file, the version
@c control state shown is blank. Otherwise it consists of text in
@c parentheses. Under RCS and SCCS, the name of the user locking the file
@c is shown; under CVS, an abbreviated version of the @samp{cvs status}
@c output is used. Here is an example using RCS:
$B3F%U%!%$%k$rI=$99T$K$O!"%O!<%I%j%s%/?t!"=jM-<T!"%0%k!<%W!"%U%!%$%k%5%$%:$N(B
$B$+$o$j$KHG4IM}>uBV$,$"$j$^$9!#(B
$B%U%!%$%k$,JQ99$5$l$F$$$J$1$l$P!"$D$^$j!"(B
$B%^%9%?%U%!%$%k$NFbMF$KF14|$7$F$$$k$J$i$P!"HG4IM}>uBV$O6u$G$9!#(B
$B$=$&$G$J$1$l$P!"3g8L$G3g$C$?%F%-%9%H$K$J$j$^$9!#(B
RCS$B$H(BSCCS$B$G$O!"%U%!%$%k$r%m%C%/$7$F$$$k%f!<%6!<$NL>A0$,<($5$l$^$9!#(B
CVS$B$G$O!"(Bcvs$B>uBV!J(B@samp{cvs status}$B!K$r4JN,2=$7$?$b$N$,<($5$l$^$9!#(B
$B$D$.$O!"(BRCS$B$r;H$C$F$$$k>l9g$NNc$G$9!#(B
@smallexample
@group
/home/jim/project:
-rw-r--r-- (jim) Apr 2 23:39 file1
-r--r--r-- Apr 5 20:21 file2
@end group
@end smallexample
@noindent
@c The files @samp{file1} and @samp{file2} are under version control,
@c @samp{file1} is locked by user jim, and @samp{file2} is unlocked.
$B%U%!%$%k!"(B@samp{file1}$B$H(B@samp{file2}$B$,!"HG4IM}$N2<$KCV$+$l$F$$$F!"(B
@samp{file1}$B$O%f!<%6!<(Bjim$B$,%m%C%/$7$F$$$F!"(B
@samp{file2}$B$O%m%C%/$5$l$F$$$^$;$s!#(B
@c Here is an example using CVS:
$B$D$.$O!"(BCVS$B$r;H$C$F$$$k>l9g$NNc$G$9!#(B
@smallexample
@group
/home/joe/develop:
-rw-r--r-- (modified) Aug 2 1997 file1.c
-rw-r--r-- Apr 4 20:09 file2.c
-rw-r--r-- (merge) Sep 13 1996 file3.c
@end group
@end smallexample
@c Here @samp{file1.c} is modified with respect to the repository, and
@c @samp{file2.c} is not. @samp{file3.c} is modified, but other changes
@c have also been checked in to the repository---you need to merge them
@c with the work file before you can check it in.
$BJ]4I8K$N$b$N$KHf$Y$F!"(B@samp{file1.c}$B$OJQ99$5$l$F$$$^$9$,!"(B
@samp{file2.c}$B$OJQ99$5$l$F$$$^$;$s!#(B
@samp{file3.c}$B$bJQ99$5$l$F$$$^$9$,!"(B
$BJ]4I8K$K$OB>$NJQ99$,%A%'%C%/%$%s$5$l$F$$$^$9!#(B
@samp{file3.c}$B$r%A%'%C%/%$%s$9$k$^$($K!"(B
$B$=$l$i$NJQ99$rJ;9g$9$kI,MW$,$"$j$^$9!#(B
@vindex vc-directory-exclusion-list
@c When VC Dired displays subdirectories (in the ``full'' display mode),
@c it omits some that should never contain any files under version control.
@c By default, this includes Version Control subdirectories such as
@c @samp{RCS} and @samp{CVS}; you can customize this by setting the
@c variable @code{vc-directory-exclusion-list}.
VC dired$B$G!J!X40A4$JI=<(!Y$N$H$-$K!K%5%V%G%#%l%/%H%j$rI=<($9$k$H$-$K$O!"(B
$BHG4IM}$N2<$K$O@dBP$KCV$+$l$J$$$b$N$O>JN,$7$^$9!#(B
$B%G%U%)%k%H$G$O!"(B@samp{RCS}$B$d(B@samp{CVS}$B$J$I$N(BVC$B$N%5%V%G%#%l%/%H%j$,4^$^$l$^$9!#(B
$B$3$l$O!"JQ?t(B@code{vc-directory-exclusion-list}$B$r@_Dj$7$F(B
$B%+%9%?%^%$%:$G$-$^$9!#(B
@c You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
@c ordinary Dired, that allows you to specify additional switches for the
@c @samp{ls} command.
$BIaDL$N(Bdired$B$N$h$&$K!"(B@kbd{C-u C-x v d}$B$HBG$F$P!"(B
@samp{ls}$B%W%m%0%i%`$KEO$9DI2C%*%W%7%g%s$r;XDj$7$F!"(B
VC dired$B$N=PNO=q<0$rHyD4@0$G$-$^$9!#(B
@node VC Dired Commands
@c @subsubsection VC Dired Commands
@subsubsection VC dired$B%3%^%s%I(B
@c All the usual Dired commands work normally in VC Dired mode, except
@c for @kbd{v}, which is redefined as the version control prefix. You can
@c invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
@c typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
@c to the file name on the current line.
VC dired$B%b!<%I$G$b!"DL>o$N(Bdired$B%3%^%s%I$O$9$Y$FIaDL$KF0:n$7$^$9$,!"(B
@kbd{v}$B$ONc30$G!"HG4IM}%W%l%U%#%C%/%9$H$7$F:FDj5A$7$F$"$j$^$9!#(B
@code{vc-diff}$B$d(B@code{vc-print-log}$B$N$h$&$J(BVC$B%3%^%s%I$O!"(B
@kbd{v =}$B$d(B@kbd{v l}$B$$$&$h$&$KBG$F$P5/F0$G$-$^$9!#(B
$B$3$l$i$N%3%^%s%I$NB?$/$O!"8=:_9T$N%U%!%$%k$K:nMQ$7$^$9!#(B
@c The command @kbd{v v} (@code{vc-next-action}) operates on all the
@c marked files, so that you can lock or check in several files at once.
@c If it operates on more than one file, it handles each file according to
@c its current state; thus, it might lock one file, but check in another
@c file. This could be confusing; it is up to you to avoid confusing
@c behavior by marking a set of files that are in a similar state.
$B%3%^%s%I(B@kbd{v v}$B!J(B@code{vc-next-action}$B!K$O!"(B
$B0u$rIU$1$?$9$Y$F$N%U%!%$%k$K:nMQ$9$k$N$G!"(B
$BJ#?t$N%U%!%$%k$r0lEY$K%m%C%/$7$?$j%A%'%C%/%$%s$7$?$j$G$-$^$9!#(B
$BJ#?t$N%U%!%$%k$K:nMQ$9$k>l9g!"3F%U%!%$%k$N8=>u$K1~$8$F8DJL$K07$$$^$9!#(B
$B$D$^$j!"$"$k%U%!%$%k$O%m%C%/$7$?$j!"JL$N%U%!%$%k$O%A%'%C%/%$%s$7$?$j$7$^$9!#(B
$B$3$l$O:.Mp$N860x$+$b$7$l$^$;$s!#(B
$BF1$8>uBV$N0lO"$N%U%!%$%k$K0u$rIU$1$F!"(B
$B:.Mp$rKI;_$9$k$N$O%f!<%6!<$N@UG$$G$9!#(B
@c If any files call for check-in, @kbd{v v} reads a single log entry,
@c then uses it for all the files being checked in. This is convenient for
@c registering or checking in several files at once, as part of the same
@c change.
$B%U%!%$%k$r%A%'%C%/%$%s$9$k$H$-$K$O!"(B
@kbd{v v}$B$O(B1$B$D$N5-O?9`L\$rFI$s$G!"$=$l$r%A%'%C%/%$%s$9$k$9$Y$F$N(B
$B%U%!%$%k$K;H$$$^$9!#(B
$B$3$l$O!"F1$8JQ99$KB0$9$k0lO"$N%U%!%$%k$r0lEY$K%A%'%C%/%$%s$9$k>l9g$K(B
$BJXMx$G$9!#(B
@findex vc-dired-toggle-terse-mode
@findex vc-dired-mark-locked
@c You can toggle between terse display (only locked files, or files not
@c up-to-date) and full display at any time by typing @kbd{v t}
@c @code{vc-dired-toggle-terse-mode}. There is also a special command
@c @kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
@c locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
@c t k} is another way to delete from the buffer all files except those
@c currently locked.
@kbd{v t}$B!J(B@code{vc-dired-toggle-terse-mode}$B!K$HBG$F$P$$$D$G$b!"(B
$B!J%m%C%/$5$l$F$$$?$j!"FbMF$,L$99?7$N$b$N$@$1$rI=<($9$k!K(B
$B4JAG$JI=<($H40A4$JI=<($H$r@Z$jBX$($i$l$^$9!#(B
$BFCJL$J%3%^%s%I(B@kbd{* l}$B!J(B@code{vc-dired-mark-locked}$B!K$b$"$j$^$9!#(B
$B$3$l$O8=:_%m%C%/$5$l$F$$$k!J(BCVS$B$N>l9g$K$O!"FbMF$,L$99?7$G$"$k!K(B
$B$9$Y$F$N%U%!%$%k$K0u$rIU$1$^$9!#(B
$B$D$^$j!"8=:_%m%C%/$5$l$$$k$b$N0J30$N$9$Y$F$N%U%!%$%k$r%P%C%U%!$+$i(B
$B:o=|$9$kJL$NJ}K!$O!"(B@kbd{* l t k}$B$HBG$D$3$H$G$9!#(B
@node Branches
@c @subsection Multiple Branches of a File
@c @cindex branch (version control)
@c @cindex trunk (version control)
@subsection $B%U%!%$%k$NJ#?t$N;^J,$+$l(B
@cindex $B;^!JHG4IM}!K(B
@cindex $B44!JHG4IM}!K(B
@c One use of version control is to maintain multiple ``current''
@c versions of a file. For example, you might have different versions of a
@c program in which you are gradually adding various unfinished new
@c features. Each such independent line of development is called a
@c @dfn{branch}. VC allows you to create branches, switch between
@c different branches, and merge changes from one branch to another.
@c Please note, however, that branches are only supported for RCS at the
@c moment.
$BHG4IM}$NMQES$N(B1$B$D$O!"%U%!%$%k$NJ#?t$N!X8=:_!YHG$r0];}$9$k$3$H$G$9!#(B
$B$?$H$($P!"$5$^$6$^$J40N;$7$F$$$J$$?7$7$$5!G=$r=y!9$KIU$12C$($F$$$k(B
$B%W%m%0%i%`$N0[$J$kHG$r;}$D$+$b$7$l$^$;$s!#(B
$B$=$&$$$C$?3+H/$NFHN)$7$?N.$l$r(B@dfn{$B;^(B}$B!J(Bbranch$B!K$H8F$S$^$9!#(B
VC$B$G$O!";^$r:n$C$?$j!"JL$N;^$X@Z$jBX$($?$j!"(B2$B$D$N;^$rJ;9g$7$?$j$G$-$^$9!#(B
$B$7$+$7!":#$N$H$3$m!"(BRCS$B$@$1$G;^$r;H$($k$3$H$KCm0U$7$F$/$@$5$$!#(B
@c A file's main line of development is usually called the @dfn{trunk}.
@c The versions on the trunk are normally numbered 1.1, 1.2, 1.3, etc. At
@c any such version, you can start an independent branch. A branch
@c starting at version 1.2 would have version number 1.2.1.1, and consecutive
@c versions on this branch would have numbers 1.2.1.2, 1.2.1.3, 1.2.1.4,
@c and so on. If there is a second branch also starting at version 1.2, it
@c would consist of versions 1.2.2.1, 1.2.2.2, 1.2.2.3, etc.
$B%U%!%$%k$N3+H/$N<gMW$JN.$l$r(B@dfn{$B44(B}$B!J(Btrunk$B!K$H8F$S$^$9!#(B
$B44$K$"$kHG$O!"IaDL!"(B1.1$B!"(B1.2$B!"(B1.3$B!"!D$HHV9f$,IU$1$i$l$^$9!#(B
$B$=$N$h$&$JHG$N$I$l$+$i$G$b!"FHN)$7$?;^$r;O$a$k$3$H$,$G$-$^$9!#(B
$BHG(B1.2$B$+$i;O$^$k;^$NHGHV9f$O(B1.2.1.1$B$H$J$j!"(B
$BF1$8;^$N8eB3$NHGHV9f$O(B1.2.1.2$B!"(B1.2.1.3$B!"(B1.2.1.4$B!"!D$H$J$j$^$9!#(B
$BHG(B1.2$B$+$i;O$^$kJL$N;^$,$"$l$P!"$=$l$i$NHGHV9f$O!"(B
1.2.2.1$B!"(B1.2.2.2$B!"(B1.2.2.3$B!"!D$H$J$j$^$9!#(B
@c @cindex head version
@cindex $B@hF,HG(B
@c If you omit the final component of a version number, that is called a
@c @dfn{branch number}. It refers to the highest existing version on that
@c branch---the @dfn{head version} of that branch. The branches in the
@c example above have branch numbers 1.2.1 and 1.2.2.
$BHGHV9f$N:G8e$NMWAG$r>JN,$7$?$b$N$r(B@dfn{$B;^HV9f(B}$B$H8F$S$^$9!#(B
$B$3$l$O!"$=$N;^$K$"$kHG$NCf$G$b$C$H$bBg$-$$HV9f$NHG!"(B@dfn{$B@hF,HG(B}$B$r;X$7$^$9!#(B
$B$^$($NNc$N;^$O!";^HV9f(B1.2.1$B$H(B1.2.2$B$G$9!#(B
@menu
* Switching Branches:: How to get to another existing branch.
* Creating Branches:: How to start a new branch.
* Merging:: Transferring changes between branches.
* Multi-User Branching:: Multiple users working at multiple branches
in parallel.
@end menu
@node Switching Branches
@c @subsubsection Switching between Branches
@subsubsection $B;^$N@Z$jBX$((B
@c To switch between branches, type @kbd{C-u C-x C-q} and specify the
@c version number you want to select. This version is then visited
@c @emph{unlocked} (write-protected), so you can examine it before locking
@c it. Switching branches in this way is allowed only when the file is not
@c locked.
$B;^$r@Z$jBX$($k$K$O!"(B@kbd{C-u C-x C-q}$B$HBG$C$F$+$i!"(B
$BA*Br$7$?$$HGHV9f$r;XDj$7$^$9!#(B
$B$=$NHG$r(B@emph{$B%m%C%/$7$J$$(B}$B!J=q$-9~$_IT2D!K$GK,Ld$9$k$N$G!"(B
$B%m%C%/$9$k$^$($KD4$Y$k$3$H$,$G$-$^$9!#(B
$B$3$N$h$&$J;^$N@Z$jBX$($,2DG=$J$N$O!"(B
$B%U%!%$%k$,%m%C%/$5$l$F$$$J$$>l9g$K8B$j$^$9!#(B
@c You can omit the minor version number, thus giving only the branch
@c number; this takes you to the head version on the chosen branch. If you
@c only type @key{RET}, Emacs goes to the highest version on the trunk.
$B;^$NCf$G$NHGHV9f$r>JN,$7$F;^HV9f$@$1$r;XDj$G$-$^$9!#(B
$B$9$k$H!"$=$N;^$N@hF,HG$rA*$V$3$H$K$J$j$^$9!#(B
@key{RET}$B$@$1$rBG$D$H!"(BEmacs$B$O44$N>e$N$b$C$H$bBg$-$$HG$rA*$S$^$9!#(B
@c After you have switched to any branch (including the main branch), you
@c stay on it for subsequent VC commands, until you explicitly select some
@c other branch.
$B!J44$r4^$`!K$I$l$+$N;^$X@Z$jBX$($?$"$H$G$O!"(B
$BL@<(E*$KB>$N;^$rA*Br$9$k$^$G!"$=$l0J9_$N(BVC$B%3%^%s%I$O$=$N;^$r;H$$$^$9!#(B
@node Creating Branches
@c @subsubsection Creating New Branches
@subsubsection $B?7$7$$;^$N:n@.(B
@c To create a new branch from a head version (one that is the latest in
@c the branch that contains it), first select that version if necessary,
@c lock it with @kbd{C-x C-q}, and make whatever changes you want. Then,
@c when you check in the changes, use @kbd{C-u C-x C-q}. This lets you
@c specify the version number for the new version. You should specify a
@c suitable branch number for a branch starting at the current version.
@c For example, if the current version is 2.5, the branch number should be
@c 2.5.1, 2.5.2, and so on, depending on the number of existing branches at
@c that point.
$B@hF,HG!J;^$NCf$K$"$k:G?7HG!K$+$i?7$?$J;^$r:n$k$K$O!"(B
$BI,MW$J$i$^$:$=$NHG$rA*Br$7$F$+$i!"(B@kbd{C-x C-q}$B$G$=$l$r%m%C%/$7!"(B
$BI,MW$JJQ99$r;\$7$^$9!#(B
$B$=$7$F!"JQ99$r%A%'%C%/%$%s$9$k$H$-$K!"(B@kbd{C-u C-x C-q}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$G$O!"?7HG$KBP$9$kHGHV9f$r;XDj$G$-$^$9!#(B
$B8=:_$NHG$+$i;O$^$k;^$H$7$FE,@Z$JHV9f$r;XDj$9$kI,MW$,$"$j$^$9!#(B
$B$?$H$($P!"8=:_$NHG$,(B2.5$B$J$i$P!"$=$N;~E@$GB8:_$9$k;^$N?t$K0MB8$7$^$9$,!"(B
$B;^HV9f$O!"(B2.5.1$B!"(B2.5.2$B!"!D$G$9!#(B
@c To create a new branch at an older version (one that is no longer the
@c head of a branch), first select that version (@pxref{Switching
@c Branches}), then lock it with @kbd{C-x C-q}. You'll be asked to
@c confirm, when you lock the old version, that you really mean to create a
@c new branch---if you say no, you'll be offered a chance to lock the
@c latest version instead.
$B5lHG!J@hF,HG$G$O$J$$$b$N!K$+$i?7$7$$;^$r:n$k$K$O!"(B
$B$=$NHG$r$^$:A*Br$7$F$+$i!J(B@pxref{Switching Branches}$B!K!"(B
$B$=$l$r(B@kbd{C-x C-q}$B$G%m%C%/$7$^$9!#(B
$B5lHG$r%m%C%/$9$k$H!"K\Ev$K?7$7$$;^$r:n$k$N$+$I$&$+3NG'$7$F$-$^$9!#(B
no$B$GEz$($k$H!"$+$o$j$K!":G?7HG$r%m%C%/$9$k$+$I$&$+J9$$$F$-$^$9!#(B
@c Then make your changes and type @kbd{C-x C-q} again to check in a new
@c version. This automatically creates a new branch starting from the
@c selected version. You need not specially request a new branch, because
@c that's the only way to add a new version at a point that is not the head
@c of a branch.
$BJQ99$7$F$+$i!"$U$?$?$S(B@kbd{C-x C-q}$B$HBG$C$F?7HG$K%A%'%C%/%$%s$7$^$9!#(B
$B$3$&$9$k$HA*Br$7$?HG$+$i;O$^$k?7$7$$;^$r<+F0E*$K:n$j$^$9!#(B
$B?7$7$$;^$rFC$K;XDj$9$kI,MW$O$"$j$^$;$s!#(B
$B$J$<$J$i!";^$N@hF,HG$G$J$$$H$3$m$K?7HG$rIU$12C$($kM#0l$NJ}K!$@$+$i$G$9!#(B
@c After the branch is created, you ``stay'' on it. That means that
@c subsequent check-ins create new versions on that branch. To leave the
@c branch, you must explicitly select a different version with @kbd{C-u C-x
@c C-q}. To transfer changes from one branch to another, use the merge
@c command, described in the next section.
$B;^$r:n$C$?$"$H$G$O!"$=$N;^$K!XN1$^$j!Y$^$9!#(B
$B$D$^$j!"$=$l0J9_$K%A%'%C%/%$%s$9$k$H!"$=$N;^$K?7HG$,:n$i$l$^$9!#(B
$B;^$r5n$k$K$O!"(B@kbd{C-u C-x C-q}$B$GL@<(E*$KJL$NHG$rA*$VI,MW$,$"$j$^$9!#(B
$B$"$k;^$+$iJL$N;^$XJQ99$r0\$9$K$O!"<!@a$G@bL@$9$kJ;9g%3%^%s%I$r;H$C$F$/$@$5$$!#(B
@node Merging
@c @subsubsection Merging Branches
@subsubsection $B;^$NJ;9g(B
@c @cindex merging changes
@cindex $BJQ99$NJ;9g(B
@c When you have finished the changes on a certain branch, you will
@c often want to incorporate them into the file's main line of development
@c (the trunk). This is not a trivial operation, because development might
@c also have proceeded on the trunk, so that you must @dfn{merge} the
@c changes into a file that has already been changed otherwise. VC allows
@c you to do this (and other things) with the @code{vc-merge} command.
$B$"$k;^$GJQ99$r40N;$7$?$H$-$K$O!"$=$l$i$NJQ99$r%U%!%$%k$N3+H/$N<gN.!J44!K$K(B
$B<h$j9~$_$?$$$3$H$,$7$P$7$P$"$k$G$7$g$&!#(B
$B$3$l$O4JC1$JA`:n$G$O$"$j$^$;$s!#(B
$B$H$$$&$N$O!"44$G$b3+H/$O?J9T$7$F$$$k$N$G!"(B
$BJL$N8~$-$KJQ99$5$l$F$$$k%U%!%$%k$KJQ99$r(B@dfn{$BJ;9g(B}$B$9$kI,MW$,$"$k$+$i$G$9!#(B
VC$B$G$O!"(B@code{vc-merge}$B%3%^%s%I$GJ;9g!J$H$=$l0J30$N$3$H$b!K$G$-$^$9!#(B
@table @kbd
@item C-x v m (vc-merge)
@c Merge changes into the work file.
$B:n6H%U%!%$%k$KJQ99$rJ;9g$9$k!#(B
@end table
@kindex C-x v m
@findex vc-merge
@c @kbd{C-x v m} (@code{vc-merge}) takes a set of changes and merges it
@c into the current version of the work file. It first asks you for a
@c branch number or a pair of version numbers in the minibuffer. Then it
@c finds the changes from that branch, or between the two versions you
@c specified, and merges them into the current version of the current file.
@kbd{C-x v m}$B!J(B@code{vc-merge}$B!K$O!"(B
$B0lO"$NJQ99$r:n6H%U%!%$%k$N8=:_$NHG$KJ;9g$7$^$9!#(B
$B$3$N%3%^%s%I$O$^$:!"%_%K%P%C%U%!$G;^HV9f$+(B2$B$D$NHGHV9f$rFI$_<h$j$^$9!#(B
$B$=$7$F!"$=$N;^$G$NJQ99!"$"$k$$$O!";XDj$7$?(B2$B$D$NHG$N$"$$$@$NJQ99$rD4$Y!"(B
$B$=$l$i$r%U%!%$%k$N8=:_$NHG$KJ;9g$7$^$9!#(B
@c As an example, suppose that you have finished a certain feature on
@c branch 1.3.1. In the meantime, development on the trunk has proceeded
@c to version 1.5. To merge the changes from the branch to the trunk,
@c first go to the head version of the trunk, by typing @kbd{C-u C-x C-q
@c RET}. Version 1.5 is now current. If locking is used for the file,
@c type @kbd{C-x C-q} to lock version 1.5 so that you can change it. Next,
@c type @kbd{C-x v m 1.3.1 RET}. This takes the entire set of changes on
@c branch 1.3.1 (relative to version 1.3, where the branch started, up to
@c the last version on the branch) and merges it into the current version
@c of the work file. You can now check in the changed file, thus creating
@c version 1.6 containing the changes from the branch.
$BNc$H$7$F!";^(B1.3.1$B$G$"$k5!G=$r<BAu$7=*$($?$H$7$^$7$g$&!#(B
$B$3$N4V!"44$G$b3+H/$,?J$s$G$$$FHG(B1.5$B$K$J$C$F$$$^$9!#(B
$B;^$G$NJQ99$r44$KJ;9g$9$k$K$O!"(B
$B$^$:!"(B@kbd{C-u C-x C-q @key{RET}}$B$HBG$C$F!"44$N@hF,HG$X9T$-$^$9!#(B
$BHG(B1.5$B$,8=:_$NHG$K$J$j$^$9!#(B
$B%U%!%$%k$N%m%C%/$r;H$C$F$$$k>l9g$K$O!"(B@kbd{C-x C-q}$B$HBG$C$F!"(B
$BHG(B1.5$B$r%m%C%/$7$FJQ99$G$-$k$h$&$K$7$^$9!#(B
$BB3$$$F(B@kbd{C-x v m 1.3.1 @key{RET}}$B$HBG$A$^$9!#(B
$B$9$k$H!";^(B1.3.1$B$G$N!J;^$N3+;OE@$G$"$kHG(B1.3$B$+$i;^$NCf$K$"$k:G?7HG$^$G$N!K(B
$B0lO"$NJQ99$r<h$j=P$7$F!"$=$l$i$r:n6H%U%!%$%k$N8=:_$NHG$KJ;9g$7$^$9!#(B
$B$3$3$G!"JQ99$5$l$?:n6H%U%!%$%k$r%A%'%C%/%$%s$G$-$^$9!#(B
$B$D$^$j!";^$G$NJQ99$r<h$j9~$s$@HG(B1.6$B$r:n$l$k$N$G$9!#(B
@c It is possible to do further editing after merging the branch, before
@c the next check-in. But it is usually wiser to check in the merged
@c version, then lock it and make the further changes. This will keep
@c a better record of the history of changes.
$B%A%'%C%/%$%s$9$k$^$($K!";^$+$iJ;9g$7$?$"$H$K$5$i$KJT=8$9$k$3$H$b2DG=$G$9!#(B
$B$7$+$7!"J;9g$7$?HG$r%A%'%C%/%$%s$7$?$"$H$G!"(B
$B%m%C%/$7$F$5$i$KJT=8$9$k$N$,!"IaDL$O8-$$$d$jJ}$G$9!#(B
$B$3$&$9$l$P!"JQ99MzNr$r$h$j$h$/5-O?$K;D$;$^$9!#(B
@c @cindex conflicts
@c @cindex resolving conflicts
@cindex $BL7=b(B
@cindex $BL7=b$N2r>C(B
@c When you merge changes into a file that has itself been modified, the
@c changes might overlap. We call this situation a @dfn{conflict}, and
@c reconciling the conflicting changes is called @dfn{resolving a
@c conflict}.
$B$9$G$K=$@5$5$l$F$$$k%U%!%$%k$KJQ99$rJ;9g$9$k$H$-$K$O!"(B
$BJQ99$,=EJ#$9$k>l9g$,$"$j$^$9!#(B
$B$3$N>u67$r(B@dfn{$BL7=b(B}$B$H8F$S$^$9!#(B
$BL7=b$7$?JQ99$NDTjm$r9g$o$;$k$3$H$r(B@dfn{$BL7=b$N2r>C(B}$B$H8F$S$^$9!#(B
@c Whenever conflicts occur during merging, VC detects them, tells you
@c about them in the echo area, and asks whether you want help in merging.
@c If you say yes, it starts an Ediff session (@pxref{Top,
@c Ediff, Ediff, ediff, The Ediff Manual}).
$BJ;9gCf$KL7=b$,5/$3$k$H!"(BVC$B$O$3$l$i$r8!=P$7!"(B
$B$=$l$i$r%(%3!<NN0h$KI=<($7$F%f!<%6!<$KEA$(!"(B
$BJ;9g$rJd:4$7$F$[$7$$$+$I$&$+J9$$$F$-$^$9!#(B
yes$B$GEz$($k$H!"(Bediff$B%;%C%7%g%s$r3+;O$7$^$9(B
$B!J(B@pxref{Top, Ediff, Ediff, ediff, The Ediff Manual}$B!K!#(B
@c If you say no, the conflicting changes are both inserted into the
@c file, surrounded by @dfn{conflict markers}. The example below shows how
@c a conflict region looks; the file is called @samp{name} and the current
@c master file version with user B's changes in it is 1.11.
no$B$GEz$($k$H!"L7=b$9$kJQ99$O$I$A$i$b(B@dfn{$BL7=b0u(B}$B$G0O$C$F%U%!%$%k$KA^F~$7$^$9!#(B
$BL7=b$9$kItJ,$O!"2<$NNc$N$h$&$K$J$j$^$9!#(B
$B:n6H%U%!%$%k$NL>A0$O(B@samp{name}$B$G$"$j!"(B
$B%f!<%6!<(BB$B$NJQ99$r<}$a$?%^%9%?%U%!%$%k$NHG$O(B1.11$B$G$9!#(B
@c @w here is so CVS won't think this is a conflict.
@smallexample
@group
@w{<}<<<<<< name
@var{User A's version}
=======
@var{User B's version}
@w{>}>>>>>> 1.11
@end group
@end smallexample
@c @cindex vc-resolve-conflicts
@findex vc-resolve-conflicts
@c Then you can resolve the conflicts by editing the file manually. Or
@c you can type @code{M-x vc-resolve-conflicts} after visiting the file.
@c This starts an Ediff session, as described above.
$B$3$NL7=b$r2r>C$9$k$h$&$K%U%!%$%k$r<j$GJT=8$G$-$^$9!#(B
$B$"$k$$$O!"%U%!%$%k$rK,Ld$7$F$+$i(B@code{M-x vc-resolve-conflicts}$B$HBG$A$^$9!#(B
$B$9$k$H>e$K=R$Y$?(Bediff$B%;%C%7%g%s$r3+;O$7$^$9!#(B
@node Multi-User Branching
@c @subsubsection Multi-User Branching
@subsubsection $BJ#?t%f!<%6!<$N;^(B
@c It is often useful for multiple developers to work simultaneously on
@c different branches of a file. CVS allows this by default; for RCS, it
@c is possible if you create multiple source directories. Each source
@c directory should have a link named @file{RCS} which points to a common
@c directory of RCS master files. Then each source directory can have its
@c own choice of selected versions, but all share the same common RCS
@c records.
$B%U%!%$%k$N0[$J$k;^>e$GF1;~$KJ#?t$N3+H/<T$,:n6H$9$k$HM-1W$J$3$H$,(B
$B$7$P$7$P$"$j$^$9!#(B
CVS$B$G$O!"%G%U%)%k%H$G!"$3$l$,$G$-$^$9!#(B
RCS$B$G$O!"J#?t$N%=!<%9%G%#%l%/%H%j$r:n$l$P2DG=$G$9!#(B
RCS$B$N%^%9%?%U%!%$%k$rCV$$$?6&DL$N%G%#%l%/%H%j$r;X$9(B@file{RCS}$B$H$$$&L>A0$N(B
$B%j%s%/$r3F%=!<%9%G%#%l%/%H%j$KCV$-$^$9!#(B
$B$3$&$9$l$P!"3F%=!<%9%G%#%l%/%H%j$G$O!"$=$l$>$lFH<+$KHG$rA*Br$G$-$^$9!#(B
$B$7$+$7!"F1$86&DL$N(BRCS$B%l%3!<%I$r$9$Y$F$G6&M-$7$^$9!#(B
@c This technique works reliably and automatically, provided that the
@c source files contain RCS version headers (@pxref{Version Headers}). The
@c headers enable Emacs to be sure, at all times, which version number is
@c present in the work file.
$B%=!<%9%U%!%$%k$K(BRCS$B$NHG4IM}%X%C%@!J(B@pxref{Version Headers}$B!K$,F~$C$F$$$l$P!"(B
$B$3$N5;K!$O?.Mj@-$,$"$j<+F0E*$KF0:n$7$^$9!#(B
$B%X%C%@$K$h$j!"(BEmacs$B$O$$$D$G$b:n6H%U%!%$%k$KF~$C$F$$$kHGHV9f$,$o$+$j$^$9!#(B
@c If the files do not have version headers, you must instead tell Emacs
@c explicitly in each session which branch you are working on. To do this,
@c first find the file, then type @kbd{C-u C-x C-q} and specify the correct
@c branch number. This ensures that Emacs knows which branch it is using
@c during this particular editing session.
$B%U%!%$%k$KHG4IM}%X%C%@$,F~$C$F$$$J$$$H$-$K$O!"(B
$B3F%;%C%7%g%s$4$H$K$I$N;^$G:n6H$7$F$$$k$+$r(BEmacs$B$KL@<($9$kI,MW$,$"$j$^$9!#(B
$B$3$&$9$k$K$O!"%U%!%$%k$rK,Ld$7$F$+$i!"(B
@kbd{C-u C-x C-q}$B$HBG$A!"@5$7$$;^HV9f$r;XDj$7$^$9!#(B
$B$3$l$K$h$j!"JT=8%;%C%7%g%s$G$O$I$N;^$rA`:n$7$F$$$k$+$r(B
Emacs$B$,CN$C$F$$$k$3$H$rJ]>Z$7$^$9!#(B
@node Snapshots
@c @subsection Snapshots
@c @cindex snapshots and version control
@subsection $B%9%J%C%W%7%g%C%H(B
@cindex $B%9%J%C%W%7%g%C%H$HHG4IM}(B
@c A @dfn{snapshot} is a named set of file versions (one for each
@c registered file) that you can treat as a unit. One important kind of
@c snapshot is a @dfn{release}, a (theoretically) stable version of the
@c system that is ready for distribution to users.
@dfn{$B%9%J%C%W%7%g%C%H(B}$B$H$O!"(B
$B%U%!%$%k$NHG!JEPO?$5$l$?%U%!%$%k$=$l$>$l$K(B1$B$D$:$D!K(B
$B$N=89g$KL>A0$rIU$1$?$b$N$G!"0l2t$H$7$F07$&$3$H$,$G$-$^$9!#(B
$B%9%J%C%W%7%g%C%H$N=EMW$J<oN`$N(B1$B$D$O!"(B@dfn{$B%j%j!<%9(B}$B$G$9!#(B
$B$3$l$O!"%f!<%6!<$XG[I[$9$k=`Hw$,@0$C$?%7%9%F%`$N!JM}O@E*$K$O!K(B
$B0BDj$7$?HG$N$3$H$G$9!#(B
@menu
* Making Snapshots:: The snapshot facilities.
* Snapshot Caveats:: Things to be careful of when using snapshots.
@end menu
@node Making Snapshots
@c @subsubsection Making and Using Snapshots
@subsubsection $B%9%J%C%W%7%g%C%H$N:n@.$H;HMQ(B
@c There are two basic commands for snapshots; one makes a
@c snapshot with a given name, the other retrieves a named snapshot.
$B%9%J%C%W%7%g%C%H$KBP$7$F$O!"4pK\E*$J%3%^%s%I$,(B2$B$D$"$j$^$9!#(B
1$B$D$OL>A0$r;XDj$7$F%9%J%C%W%7%g%C%H$r:n$j!"(B
$B$b$&(B1$B$D$O;XL>$7$?%9%J%C%W%7%g%C%H$r<h$j=P$9$3$H$G$9!#(B
@table @code
@kindex C-x v s
@findex vc-create-snapshot
@item C-x v s @var{name} @key{RET}
@c Define the last saved versions of every registered file in or under the
@c current directory as a snapshot named @var{name}
@c (@code{vc-create-snapshot}).
$B%+%l%s%H%G%#%l%/%H%j$d$=$N2<$KCV$$$F$"$kEPO?$5$l$?%U%!%$%k$N(B
$B$=$l$>$l$NJ]B8$5$l$?:G?7HG$r(B@var{name}$B$H$$$&L>A0$N(B
$B%9%J%C%W%7%g%C%H$H$7$FDj5A$9$k(B
$B!J(B@code{vc-create-snapshot}$B!K!#(B
@kindex C-x v r
@findex vc-retrieve-snapshot
@item C-x v r @var{name} @key{RET}
@c For all registered files at or below the current directory level, select
@c whatever versions correspond to the snapshot @var{name}
@c (@code{vc-retrieve-snapshot}).
$B%+%l%s%H%G%#%l%/%H%j$d$=$N2<$KCV$$$F$"$kEPO?$5$l$?%U%!%$%k$9$Y$F$K$D$$$F!"(B
$B%9%J%C%W%7%g%C%H(B@var{name}$B$KBP1~$9$kHG$rA*Br$9$k!#(B
@c This command reports an error if any files are locked at or below the
@c current directory, without changing anything; this is to avoid
@c overwriting work in progress.
$B%+%l%s%H%G%#%l%/%H%j$d$=$N2<$KCV$$$F$"$kEPO?$5$l$?%U%!%$%k$N$$$:$l$+$,(B
$B%m%C%/$5$l$F$$$k$H!"$3$N%3%^%s%I$O2?$bJQ99$;$:$K%(%i!<$rJs9p$9$k!#(B
$B$3$l$O!"?J9TCf$N:n6H7k2L$r>e=q$-$7$F$7$^$&$3$H$rHr$1$k$?$a!#(B
@end table
@c A snapshot uses a very small amount of resources---just enough to record
@c the list of file names and which version belongs to the snapshot. Thus,
@c you need not hesitate to create snapshots whenever they are useful.
$B%9%J%C%W%7%g%C%H$O$H$F$b>/NL$N;q8;$7$+;H$$$^$;$s!#(B
$B%U%!%$%kL>0lMw$H%9%J%C%W%7%g%C%H$KB0$9$kHGHV9f$r(B
$B5-O?$9$k$K==J,$JNL$@$1$G$$$$$N$G$9!#(B
$B$7$?$,$C$F!";H$$$b$N$K$J$k$b$N$r%9%J%C%W%7%g%C%H$K$9$k$3$H$r(B
$Bm0$&$3$H$O$"$j$^$;$s!#(B
@c You can give a snapshot name as an argument to @kbd{C-x v =} or
@c @kbd{C-x v ~} (@pxref{Old Versions}). Thus, you can use it to compare a
@c snapshot against the current files, or two snapshots against each other,
@c or a snapshot against a named version.
@kbd{C-x v =}$B$d(B@kbd{C-x v ~}$B!J(B@pxref{Old Versions}$B!K$N0z?t$H$7$F!"(B
$B%9%J%C%W%7%g%C%H$NL>A0$r;XDj$G$-$^$9!#(B
$B$7$?$,$C$F!"%9%J%C%W%7%g%C%H$H8=:_$N%U%!%$%k!"$"$k$$$O!"(B
2$B$D$N%9%J%C%W%7%g%C%HF1;N!"$"$k$$$O!"(B
$B;XDj$7$?L>A0$NHG$H%9%J%C%W%7%g%C%HF1;N$rHf3S$G$-$^$9!#(B
@node Snapshot Caveats
@c @subsubsection Snapshot Caveats
@subsubsection $B%9%J%C%W%7%g%C%H$N<eE@(B
@c @cindex named configurations (RCS)
@cindex $BL>A0IU$-$N%3%s%U%#%.%e%l!<%7%g%s!J(BRCS$B!K(B
@c VC's snapshot facilities are modeled on RCS's named-configuration
@c support. They use RCS's native facilities for this, so under VC
@c snapshots made using RCS are visible even when you bypass VC.
VC$B$N%9%J%C%W%7%g%C%H5!G=$O!"(BRCS$B$NL>A0IU$-%3%s%U%#%.%e%l!<%7%g%s%5%]!<%H(B
$B!J(Bnamed-configuration support$B!K$r%b%G%k$K$7$F$$$^$9!#(B
RCS$B8GM-$N5!G=$r;H$C$F$$$k$?$a!"(BRCS$B$r;H$C$F:n$C$?(BVC$B$N%9%J%C%W%7%g%C%H(B
$B$O!"(BVC$B$r;H$o$J$/$F$b8+$($^$9!#(B
@c @c worded verbosely to avoid overfull hbox.
@c For SCCS, VC implements snapshots itself. The files it uses contain
@c name/file/version-number triples. These snapshots are visible only
@c through VC.
SCCS$B$G$O!"(BVC$B<+?H$G%9%J%C%W%7%g%C%H5!G=$r<BAu$7$F$$$^$9!#(B
VC$B$,;H$&%U%!%$%k$K$O!"L>A0!?%U%!%$%k!?HGHV9f$N(B3$B$DAH$_$,4^$^$l$^$9!#(B
$B$3$l$i$N%9%J%C%W%7%g%C%H$O!"(BVC$B$r;H$C$?$H$-$@$18+$($^$9!#(B
@c A snapshot is a set of checked-in versions. So make sure that all the
@c files are checked in and not locked when you make a snapshot.
$B%9%J%C%W%7%g%C%H$O%A%'%C%/%$%s$7$?HG$N=89g$G$9!#(B
$B$G$9$+$i!"%9%J%C%W%7%g%C%H$r:n$k$H$-$K$O!"(B
$B$9$Y$F$N%U%!%$%k$r%A%'%C%/%$%s$7$F$"$j!"(B
$B$7$+$b%m%C%/$7$F$$$J$$$3$H$r3NG'$7$F$/$@$5$$!#(B
@c File renaming and deletion can create some difficulties with snapshots.
@c This is not a VC-specific problem, but a general design issue in version
@c control systems that no one has solved very well yet.
$B%U%!%$%k$r2~L>$7$?$j:o=|$9$k$H!"%9%J%C%W%7%g%C%H$KLdBj$r@8$8$^$9!#(B
$B$3$l$O(BVC$B$K8GM-$NLdBj$G$O$J$/!"HG4IM}%7%9%F%`$K0lHLE*$J@_7W>e$NLdBj$G!"(B
$B$^$@C/$bK~B-$f$/2r7h$r$G$-$F$$$^$;$s!#(B
@c If you rename a registered file, you need to rename its master along
@c with it (the command @code{vc-rename-file} does this automatically). If
@c you are using SCCS, you must also update the records of the snapshot, to
@c mention the file by its new name (@code{vc-rename-file} does this,
@c too). An old snapshot that refers to a master file that no longer
@c exists under the recorded name is invalid; VC can no longer retrieve
@c it. It would be beyond the scope of this manual to explain enough about
@c RCS and SCCS to explain how to update the snapshots by hand.
$BEPO?$5$l$?%U%!%$%k$r2~L>$9$k$J$i!"(B
$B$=$N%^%9%?%U%!%$%k$b0l=o$K2~L>$9$kI,MW$,$"$j$^$9(B
$B!J%3%^%s%I(B@code{vc-rename-file}$B$O<+F0E*$K$3$l$r9T$&!K!#(B
SCCS$B$r;H$C$F$$$k$J$i$P!"%U%!%$%kL>$r?7$7$$L>A0$K$7$F(B
$B%9%J%C%W%7%g%C%H$N5-O?$b99?7$9$kI,MW$,$"$j$^$9(B
$B!J(B@code{vc-rename-file}$B$O$3$l$b9T$&!K!#(B
$B5-O?$5$l$?L>A0$G$O$b$O$dB8:_$7$J$$%^%9%?%U%!%$%k$r;2>H$9$k(B
$B8E$$%9%J%C%W%7%g%C%H$OL58z$G$9!#(B
VC$B$O!J8E$$L>A0$G$O!K<h$j=P$;$^$;$s!#(B
$B%9%J%C%W%7%g%C%H$r<j$G99?7$9$kJ}K!$r@bL@$9$k$?$a$K(B
RCS$B$d(BSCCS$B$r>\$7$/@bL@$9$k$3$H$O!"K\=q$NHO0O$r1[$($F$$$^$9!#(B
@c Using @code{vc-rename-file} makes the snapshot remain valid for
@c retrieval, but it does not solve all problems. For example, some of the
@c files in the program probably refer to others by name. At the very
@c least, the makefile probably mentions the file that you renamed. If you
@c retrieve an old snapshot, the renamed file is retrieved under its new
@c name, which is not the name that the makefile expects. So the program
@c won't really work as retrieved.
@code{vc-rename-file}$B$r;H$($P!"(B
$B<h$j=P$7A`:n$K;H$($kDxEY$K$O%9%J%C%W%7%g%C%H$rJ]$F$^$9$,!"(B
$B$9$Y$F$NLdBj$r2r7h$G$-$k$o$1$G$O$"$j$^$;$s!#(B
$B$?$H$($P!"%W%m%0%i%`$N$$$/$D$+$N%U%!%$%k$G$O!"(B
$BL>A0$GB>$N%U%!%$%k$r;2>H$7$F$$$k$G$7$g$&!#(B
$B>/$J$/$H$b!"(Bmakefile$B$G$O!"2~L>$7$?%U%!%$%k$r;X$7$F$$$k$G$7$g$&!#(B
$B8E$$%9%J%C%W%7%g%C%H$r<h$j=P$9$H!"(B
$B2~L>$7$?%U%!%$%k$O?7$7$$L>A0$G<h$j=P$7$^$9$,!"(B
makefile$B$G;H$C$F$$$kL>A0$G$O$"$j$^$;$s!#(B
$B$G$9$+$i!"<h$j=P$7$?$@$1$G$O%W%m%0%i%`$OF0$+$J$$$G$7$g$&!#(B
@node Miscellaneous VC
@c @subsection Miscellaneous Commands and Features of VC
@subsection VC$B$N$=$NB>$N%3%^%s%I$H5!G=(B
@c This section explains the less-frequently-used features of VC.
$BK\@a$G$O!";HMQIQEY$N>/$J$$(BVC$B$N5!G=$r@bL@$7$^$9!#(B
@menu
* Change Logs and VC:: Generating a change log file from log entries.
* Renaming and VC:: A command to rename both the source and master
file correctly.
* Version Headers:: Inserting version control headers into working files.
@end menu
@node Change Logs and VC
@c @subsubsection Change Logs and VC
@subsubsection $BJQ995-O?$H(BVC
@c If you use RCS or CVS for a program and also maintain a change log
@c file for it (@pxref{Change Log}), you can generate change log entries
@c automatically from the version control log entries:
$B%W%m%0%i%`$KBP$7$F(BRCS$B$d(BCVS$B$r;H$$!"$7$+$b!"$=$l$i$KJQ995-O?%U%!%$%k(B
$B!J(B@pxref{Change Log}$B!K$rJ];}$7$F$$$k$J$i$P!"(B
$BHG4IM}$N5-O?9`L\$+$iJQ995-O?9`L\$r<+F0E*$K@8@.$G$-$^$9!#(B
@table @kbd
@item C-x v a
@kindex C-x v a
@findex vc-update-change-log
@c Visit the current directory's change log file and, for registered files
@c in that directory, create new entries for versions checked in since the
@c most recent entry in the change log file.
@c (@code{vc-update-change-log}).
$B%+%l%s%H%G%#%l%/%H%j$K$"$kJQ995-O?%U%!%$%k$rK,$l$k!#(B
$B$=$7$F!"$=$N%G%#%l%/%H%j$KCV$$$F$"$kEPO?$5$l$?3F%U%!%$%k$K$D$$$F!"(B
$BJQ995-O?%U%!%$%k$K$"$k:G?7$N9`L\0J9_$K%A%'%C%/%$%s$5$l$?HG$K4X$9$k(B
$B?7$?$J9`L\$r:n@.$9$k!#(B
$B!J(B@code{vc-update-change-log}$B!K!#(B
@c This command works with RCS or CVS only, not with SCCS.
$B$3$N%3%^%s%I$O(BRCS$B$d(BCVS$B$@$1$GF0:n$7!"(BSCCS$B$G$OF0:n$7$J$$!#(B
@item C-u C-x v a
@c As above, but only find entries for the current buffer's file.
$B>e$HF1MM$G$"$k$,!"%+%l%s%H%P%C%U%!$N%U%!%$%k$K4X$9$k9`L\$@$1$rC5$9!#(B
@item M-1 C-x v a
@c As above, but find entries for all the currently visited files that are
@c maintained with version control. This works only with RCS, and it puts
@c all entries in the log for the default directory, which may not be
@c appropriate.
$B>e$HF1MM$@$,!"8=:_K,Ld$7$F$$$k%U%!%$%k$N$&$AHG4IM}$N2<$KCV$+$l$F$$$k%U%!%$%k(B
$B$9$Y$F$K4X$9$k9`L\$rC5$9!#(B
$B$3$N%3%^%s%I$O(BRCS$B$G$N$_F0:n$9$k!#(B
$B$7$+$b!"%G%U%)%k%H%G%#%l%/%H%j$K4X$9$k(B
$B$9$Y$F$N9`L\$rJQ995-O?$KDI2C$9$k$,!"$3$l$OE,@Z$G$J$$$3$H$b$"$k!#(B
@end table
@c For example, suppose the first line of @file{ChangeLog} is dated
@c 1999-04-10, and that the only check-in since then was by Nathaniel
@c Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
@c messages that start with `#'.}. Then @kbd{C-x v a} visits
@c @file{ChangeLog} and inserts text like this:
$B$?$H$($P!"(B@file{ChangeLog}$B$N:G=i$N9T$NF|IU$,(B1999$BG/(B4$B7n(B10$BF|$G$"$j!"(B
$B$=$l0J9_$N%A%'%C%/%$%s$O(B
Nathaniel Bowditch$B$,(B1999$BG/(B5$B7n(B22$BF|$K(B
@samp{Ignore log messages that start with `#'.}$B$H$$$&5-O?$G(B
@file{rcs2log}$B$K%A%'%C%/%$%s$7$?$b$N$@$1$@$H$7$^$7$g$&!#(B
$B$=$&$9$k$H!"(B@kbd{C-x v a}$B$O(B@file{ChangeLog}$B$rK,Ld$7$F!"(B
$B$D$.$N$h$&$J%F%-%9%H$rA^F~$7$^$9!#(B
@iftex
@medbreak
@end iftex
@smallexample
@group
1999-05-22 Nathaniel Bowditch <nat@@apn.org>
* rcs2log: Ignore log messages that start with `#'.
@end group
@end smallexample
@iftex
@medbreak
@end iftex
@noindent
@c You can then edit the new change log entry further as you wish.
$B$3$N$"$H!"JQ995-O?$N?7$7$$9`L\$r9%$-$J$h$&$KJT=8$G$-$^$9!#(B
@c Unfortunately, timestamps in ChangeLog files are only dates, so some
@c of the new change log entry may duplicate what's already in ChangeLog.
@c You will have to remove these duplicates by hand.
$B;DG0$J$,$i!"(BChangeLog$B%U%!%$%k$K$OF|IU$7$+5-O?$7$F$$$J$$$N$G!"(B
$B?7$?$JJQ995-O?9`L\$,(BChangeLog$B%U%!%$%k$N4{B8$N9`L\$H=EJ#$9$k$3$H$,$"$j$^$9!#(B
$B$=$N$h$&$JF|IU$N=EJ#$O!"<j:n6H$G:o=|$9$kI,MW$,$"$j$^$9!#(B
@c Normally, the log entry for file @file{foo} is displayed as @samp{*
@c foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
@c if the text of the log entry starts with @w{@samp{(@var{functionname}):
@c }}. For example, if the log entry for @file{vc.el} is
@c @samp{(vc-do-command): Check call-process status.}, then the text in
@c @file{ChangeLog} looks like this:
$BDL>o!"%U%!%$%k(B@file{foo}$B$K4X$9$k5-O?9`L\$O!"(B
@samp{* foo: @var{text of log entry}}$B$N$h$&$KI=<($5$l$^$9!#(B
$B5-O?9`L\$N%F%-%9%H$,(B@w{@samp{(@var{functionname}):}}$B$G;O$^$k$H!"(B
@file{foo}$B$N$&$7$m$N(B@samp{:}$B$O>J$+$l$^$9!#(B
$B$?$H$($P!"(B@file{vc.el}$B$K4X$9$k5-O?9`L\$,(B
@samp{(vc-do-command): Check call-process status.}$B$G$"$l$P!"(B
@file{ChangeLog}$B$NCf$N%F%-%9%H$O$D$.$N$h$&$K$J$j$^$9!#(B
@iftex
@medbreak
@end iftex
@smallexample
@group
1999-05-06 Nathaniel Bowditch <nat@@apn.org>
* vc.el (vc-do-command): Check call-process status.
@end group
@end smallexample
@iftex
@medbreak
@end iftex
@c When @kbd{C-x v a} adds several change log entries at once, it groups
@c related log entries together if they all are checked in by the same
@c author at nearly the same time. If the log entries for several such
@c files all have the same text, it coalesces them into a single entry.
@c For example, suppose the most recent check-ins have the following log
@c entries:
@kbd{C-x v a}$B$,J#?t$NJQ995-O?9`L\$r0lEY$KDI2C$9$k$H$-$K$O!"(B
$BF1$8:n<T$,$[$\F1$8F|;~$K%A%'%C%/%$%s$7$?$b$N$J$i$P!"(B
$B4XO"$9$k5-O?9`L\$r$^$H$a$^$9!#(B
$B$=$N$h$&$J$$$/$D$+$N%U%!%$%k$KBP$9$k5-O?9`L\$,$9$Y$FF1$8%F%-%9%H$J$i$P!"(B
1$B$D$N9`L\$K$^$H$a$^$9!#(B
$B$?$H$($P!":G8e$K%A%'%C%/%$%s$7$?$b$N$K!"0J2<$N5-O?$,$"$C$?$H$7$^$9!#(B
@flushleft
@c @bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
@c @bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
@c @bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
@bullet{} @file{vc.texinfo}$B$N5-O?9`L\(B: @samp{Fix expansion typos.}
@bullet{} @file{vc.el}$B$N5-O?9`L\(B: @samp{Don't call expand-file-name.}
@bullet{} @file{vc-hooks.el}$B$N5-O?9`L\(B: @samp{Don't call expand-file-name.}
@end flushleft
@noindent
@c They appear like this in @file{ChangeLog}:
$B$3$l$i$O(B@file{ChangeLog}$B$NCf$G$O$D$.$N$h$&$K$J$j$^$9!#(B
@iftex
@medbreak
@end iftex
@smallexample
@group
1999-04-01 Nathaniel Bowditch <nat@@apn.org>
* vc.texinfo: Fix expansion typos.
* vc.el, vc-hooks.el: Don't call expand-file-name.
@end group
@end smallexample
@iftex
@medbreak
@end iftex
@c Normally, @kbd{C-x v a} separates log entries by a blank line, but you
@c can mark several related log entries to be clumped together (without an
@c intervening blank line) by starting the text of each related log entry
@c with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
@c itself is not copied to @file{ChangeLog}. For example, suppose the log
@c entries are:
$BDL>o!"(B@kbd{C-x v a}$B$O5-O?9`L\$r6u9T$G6h@Z$j$^$9$,!"(B
$B4XO"$9$k5-O?9`L\$N%F%-%9%H$r(B@w{@samp{@{@var{clumpname}@} }}$B$N$h$&$J(B
$B%i%Y%k$G;O$a$l$P!"4XO"$9$kJ#?t$N5-O?9`L\$r(B1$B$D$N2t$K$9$k(B
$B!J6h@Z$j$N6u9T$rF~$l$J$$!K$h$&$K0u$rIU$1$i$l$^$9!#(B
$B%i%Y%k<+BN$O(B@file{ChangeLog}$B$K$O%3%T!<$5$l$^$;$s!#(B
$B$?$H$($P!"5-O?9`L\$,$D$.$N$h$&$G$"$k$H$7$^$9!#(B
@flushleft
@c @bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
@c @bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
@c @bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
@bullet{} @file{vc.texinfo}$B$N5-O?9`L\(B: @samp{@{expand@} Fix expansion typos.}
@bullet{} @file{vc.el}$B$N5-O?9`L\(B: @samp{@{expand@} Don't call expand-file-name.}
@bullet{} @file{vc-hooks.el}$B$N5-O?9`L\(B: @samp{@{expand@} Don't call expand-file-name.}
@end flushleft
@noindent
@c Then the text in @file{ChangeLog} looks like this:
$B$9$k$H!"(B@file{ChangeLog}$B$N%F%-%9%H$O$D$.$N$h$&$K$J$j$^$9!#(B
@iftex
@medbreak
@end iftex
@smallexample
@group
1999-04-01 Nathaniel Bowditch <nat@@apn.org>
* vc.texinfo: Fix expansion typos.
* vc.el, vc-hooks.el: Don't call expand-file-name.
@end group
@end smallexample
@iftex
@medbreak
@end iftex
@c A log entry whose text begins with @samp{#} is not copied to
@c @file{ChangeLog}. For example, if you merely fix some misspellings in
@c comments, you can log the change with an entry beginning with @samp{#}
@c to avoid putting such trivia into @file{ChangeLog}.
$B5-O?9`L\$N%F%-%9%H$,(B@samp{#}$B$G;O$^$k$H!"(B
$B$=$N5-O?9`L\$O(B@file{ChangeLog}$B$K$O%3%T!<$5$l$^$;$s!#(B
$B$?$H$($P!"%3%a%s%H$NDV$j$^$A$,$$$@$1$rJQ99$7$?$H$-$K$O!"(B
$B5-O?9`L\$r(B@samp{#}$B$G;O$a$l$P!"$3$N$h$&$J<+L@$J$b$N$r(B@file{ChangeLog}$B$K(B
$BF~$l$J$$$G$9$_$^$9!#(B
@node Renaming and VC
@c @subsubsection Renaming VC Work Files and Master Files
@subsubsection VC$B:n6H%U%!%$%k$H%^%9%?%U%!%$%k$N2~L>(B
@findex vc-rename-file
@c When you rename a registered file, you must also rename its master
@c file correspondingly to get proper results. Use @code{vc-rename-file}
@c to rename the source file as you specify, and rename its master file
@c accordingly. It also updates any snapshots (@pxref{Snapshots}) that
@c mention the file, so that they use the new name; despite this, the
@c snapshot thus modified may not completely work (@pxref{Snapshot
@c Caveats}).
$BEPO?$7$?%U%!%$%k$r2~L>$9$k$H$-$K$O!"$=$N%^%9%?%U%!%$%k$bF1MM$K2~L>$7$F(B
$B@5$7$$7k2L$rF@$i$l$k$h$&$K$9$kI,MW$,$"$j$^$9!#(B
$B;XDj$I$*$j$K%=!<%9%U%!%$%k$r2~L>$7!"$=$l$K=>$C$F(B
$B%^%9%?%U%!%$%k$b2~L>$9$k$K$O!"(B@code{vc-rename-file}$B$r;H$$$^$9!#(B
$B$3$N%3%^%s%I$O!"Ev3:%U%!%$%k$r;XL>$7$F$$$k$I$s$J%9%J%C%W%7%g%C%H(B
$B!J(B@pxref{Snapshots}$B!K$b99?7$9$k$N$G!"%9%J%C%W%7%g%C%H$G$b(B
$B?7$7$$L>A0$r;H$&$h$&$K$J$j$^$9!#(B
$B$=$l$K$b4X$o$i$:!"=$@5$7$?%9%J%C%W%7%g%C%H$OF0:n$7$J$$$+$b$7$l$^$;$s(B
$B!J(B@pxref{Snapshot Caveats}$B!K!#(B
@c You cannot use @code{vc-rename-file} on a file that is locked by
@c someone else.
$BC/$+$,%m%C%/$7$F$$$k%U%!%$%k$KBP$7$F$O!"(B
@code{vc-rename-file}$B$r;H$($^$;$s!#(B
@node Version Headers
@c @subsubsection Inserting Version Control Headers
@subsubsection $BHG4IM}%X%C%@$NA^F~(B
@c Sometimes it is convenient to put version identification strings
@c directly into working files. Certain special strings called
@c @dfn{version headers} are replaced in each successive version by the
@c number of that version.
$BHG$r<1JL$9$kJ8;zNs$r:n6H%U%!%$%k$XD>@\F~$l$F$*$/$HJXMx$J$3$H$b$"$j$^$9!#(B
@dfn{$BHG4IM}%X%C%@(B}$B$H8F$P$l$kFCJL$JJ8;zNs$O!"(B
$B3FHG$4$H$K$=$NHGHV9f$GCV$-49$($i$l$^$9!#(B
@c If you are using RCS, and version headers are present in your working
@c files, Emacs can use them to determine the current version and the
@c locking state of the files. This is more reliable than referring to the
@c master files, which is done when there are no version headers. Note
@c that in a multi-branch environment, version headers are necessary to
@c make VC behave correctly (@pxref{Multi-User Branching}).
RCS$B$r;H$C$F$$$F!"$+$D!":n6H%U%!%$%k$KHG4IM}%X%C%@$,F~$C$F$$$l$P!"(B
Emacs$B$O!"HG4IM}%X%C%@$r;H$C$F8=:_$NHG$H%U%!%$%k$N%m%C%/>uBV$r7hDj$G$-$^$9!#(B
$B$3$l$O!"HG4IM}%X%C%@$,$J$$$H$-$K%^%9%?%U%!%$%k$r;2>H$9$k$h$j!"(B
$B?.Mj$G$-$^$9!#(B
$BJ#?t$N;^$r;H$&4D6-$G$O!"(B
VC$B$,@5$7$/$U$k$^$&$?$a$K$OHG4IM}%X%C%@$,I,MW$G$9(B
$B!J(B@pxref{Multi-User Branching}$B!K!#(B
@c Searching for version headers is controlled by the variable
@c @code{vc-consult-headers}. If it is non-@code{nil}, Emacs searches for
@c headers to determine the version number you are editing. Setting it to
@c @code{nil} disables this feature.
$BHG4IM}%X%C%@$NC5:w$O!"JQ?t(B@code{vc-consult-headers}$B$G@)8f$5$l$^$9!#(B
@code{nil}$B0J30$J$i$P!"JT=8Cf$NHGHV9f$r7hDj$9$k$?$a$K(BEmacs$B$O%X%C%@$rC5$7$^$9!#(B
@code{nil}$B$r@_Dj$9$k$H!"$3$N5!G=$O%*%U$K$J$j$^$9!#(B
@kindex C-x v h
@findex vc-insert-headers
@c You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
@c insert a suitable header string.
$BE,@Z$J%X%C%@J8;zNs$rF~$l$k$K$O!"%3%^%s%I(B@kbd{C-x v h}
$B!J(B@code{vc-insert-headers}$B!K$r;H$$$^$9!#(B
@table @kbd
@item C-x v h
@c Insert headers in a file for use with your version-control system.
$BHG4IM}%7%9%F%`$G;H$&%X%C%@$r%U%!%$%k$KA^F~$9$k!#(B
@end table
@vindex vc-header-alist
@c The default header string is @samp{@w{$}Id$} for RCS and
@c @samp{@w{%}W%} for SCCS. You can specify other headers to insert by
@c setting the variable @code{vc-header-alist}. Its value is a list of
@c elements of the form @code{(@var{program} . @var{string})} where
@c @var{program} is @code{RCS} or @code{SCCS} and @var{string} is the
@c string to use.
$B%G%U%)%k%H$N%X%C%@J8;zNs$O!"(B
RCS$B$G$O(B@samp{@w{$}Id$}$B!"(BSCCS$B$G$O(B@samp{@w{%}W%}$B$G$9!#(B
$BJQ?t(B@code{vc-header-alist}$B$K@_Dj$9$l$P!"B>$N%X%C%@$r;XDj$G$-$^$9!#(B
$B$3$NCM$O!"(B@code{(@var{program} . @var{string})}$B$N7A<0$N(B
$BMWAG$+$i@.$k%j%9%H$G$9!#(B
$B$3$3$G!"(B@var{program}$B$O(B@code{RCS}$B$^$?$O(B@code{SCCS}$B$G$"$j!"(B
@var{string}$B$O;HMQ$9$kJ8;zNs$G$9!#(B
@c Instead of a single string, you can specify a list of strings; then
@c each string in the list is inserted as a separate header on a line of
@c its own.
1$B$D$NJ8;zNs$N$+$o$j$K!"J8;zNs$N%j%9%H$r;XDj$9$k$3$H$b$G$-$^$9!#(B
$B$=$&$9$k$H!"%j%9%H$N3FJ8;zNs$O!"JL!9$N9T$KJL$N%X%C%@$H$7$FA^F~$5$l$^$9!#(B
@c It is often necessary to use ``superfluous'' backslashes when writing
@c the strings that you put in this variable. This is to prevent the
@c string in the constant from being interpreted as a header itself if the
@c Emacs Lisp file containing it is maintained with version control.
$B$3$NJQ?t$KF~$l$kJ8;zNs$r=q$/$H$-$K$O!"!XM>J,$J!Y%P%C%/%9%i%C%7%e$r(B
$B;H$&I,MW$,$h$/$"$j$^$9!#(B
$B$3$NJ8;zNs$r4^$`(BEmacs Lisp$B%U%!%$%k$,HG4IM}$N2<$KCV$+$l$F$$$k$H$-$K!"(B
$BDj?tCf$NJ8;zNs$,%X%C%@$H2r<a$5$l$k$3$H$rKI$0$?$a$G$9!#(B
@vindex vc-comment-alist
@c Each header is inserted surrounded by tabs, inside comment delimiters,
@c on a new line at point. Normally the ordinary comment
@c start and comment end strings of the current mode are used, but for
@c certain modes, there are special comment delimiters for this purpose;
@c the variable @code{vc-comment-alist} specifies them. Each element of
@c this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
$B3F%X%C%@$O!"%]%$%s%H0LCV$N?7$7$$9T$K!"(B
$B%3%a%s%H6h@Z$j$NFbB&$K%?%V$G0O$s$GA^F~$5$l$^$9!#(B
$BDL>o!"8=:_$N%b!<%I$N%3%a%s%H3+;OJ8;zNs$H%3%a%s%H=*N;J8;zNs$r;H$$$^$9$,!"(B
$BFCDj$N%b!<%I$G$O!"$3$NL\E*$N$?$a$NFCJL$J%3%a%s%H6h@Z$j$,$"$j$^$9!#(B
$BJQ?t(B@code{vc-comment-alist}$B$,$=$l$i$r;XDj$7$^$9!#(B
$B$3$N%j%9%H$N3FMWAG$O(B
@code{(@var{mode} @var{starter} @var{ender})}$B$H$$$&7A<0$G$9!#(B
@vindex vc-static-header-alist
@c The variable @code{vc-static-header-alist} specifies further strings
@c to add based on the name of the buffer. Its value should be a list of
@c elements of the form @code{(@var{regexp} . @var{format})}. Whenever
@c @var{regexp} matches the buffer name, @var{format} is inserted as part
@c of the header. A header line is inserted for each element that matches
@c the buffer name, and for each string specified by
@c @code{vc-header-alist}. The header line is made by processing the
@c string from @code{vc-header-alist} with the format taken from the
@c element. The default value for @code{vc-static-header-alist} is as follows:
$BJQ?t(B@code{vc-static-header-alist}$B$O!"(B
$B%P%C%U%!L>$K4p$E$$$?DI2C$NJ8;zNs$r;XDj$7$^$9!#(B
$B$3$NCM$O!"(B@code{(@var{regexp} . @var{format})}$B$N7A<0$N(B
$BMWAG$+$i@.$k%j%9%H$G$J$/$F$O$$$1$^$;$s!#(B
@var{regexp}$B$,%P%C%U%!L>$K0lCW$9$k$?$S$K!"(B
@var{format}$B$r%X%C%@$N0lIt$H$7$FA^F~$7$^$9!#(B
$B%P%C%U%!L>$K0lCW$9$k3FMWAG$H(B@code{vc-header-alist}$B$K;XDj$5$l$?3FJ8;zNs$4$H$K(B
$B%X%C%@9T$rA^F~$7$^$9!#(B
@code{vc-header-alist}$B$NJ8;zNs$rMWAG$N=q<0(B@var{format}$B$G=hM}$7$F(B
$B%X%C%@9T$r:n$j$^$9!#(B
@code{vc-static-header-alist}$B$N%G%U%)%k%HCM$O$D$.$N$H$*$j$G$9!#(B
@example
@group
(("\\.c$" .
"\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
#endif /* lint */\n"))
@end group
@end example
@noindent
@c It specifies insertion of text of this form:
$B$3$l$O!"$D$.$N$h$&$J%F%-%9%H$rA^F~$7$^$9!#(B
@example
@group
#ifndef lint
static char vcid[] = "@var{string}";
#endif /* lint */
@end group
@end example
@noindent
@c Note that the text above starts with a blank line.
$B>e$N%F%-%9%H$O6u9T$G;O$^$C$F$$$k$3$H$KCm0U$7$F$/$@$5$$!#(B
@c If you use more than one version header in a file, put them close
@c together in the file. The mechanism in @code{revert-buffer} that
@c preserves markers may not handle markers positioned between two version
@c headers.
$BJ#?t$NHG4IM}%X%C%@$r%U%!%$%k$KF~$l$k>l9g$K$O!"(B
$B%U%!%$%kFb$G$O$=$l$i$r0l=o$K$^$H$a$FF~$l$F$*$-$^$9!#(B
@code{revert-buffer}$B$N%^!<%+$rJ]B8$9$k5!9=$O!"(B
2$B$D$NHG4IM}%X%C%@$N$"$$$@$KCV$+$l$?%^!<%+$r07$($J$$$3$H$b$"$j$^$9!#(B
@node Customizing VC
@c @subsection Customizing VC
@subsection VC$B$N%+%9%?%^%$%:(B
@c There are many ways of customizing VC. The options you can set fall
@c into four categories, described in the following sections.
VC$B$r%+%9%?%^%$%:$9$kJ}K!$O$?$/$5$s$"$j$^$9!#(B
$B@_Dj2DG=$J%*%W%7%g%s$O!"<!@a$K=R$Y$k(B4$B$D$KJ,N`$G$-$^$9!#(B
@menu
* Backend Options:: Customizing the back-end to your needs.
* VC Workfile Handling:: Various options concerning working files.
* VC Status Retrieval:: How VC finds the version control status of a file,
and how to customize this.
* VC Command Execution:: Which commands VC should run, and how.
@end menu
@node Backend Options
@c @subsubsection Options for VC Backends
@subsubsection VC$B$N%P%C%/%(%s%I$KBP$9$k%*%W%7%g%s(B
@c @cindex backend options (VC)
@c @cindex locking under version control
@cindex $B%P%C%/%(%s%I$N%*%W%7%g%s!J(BVC$B!K(B
@cindex $BHG4IM}2<$N%m%C%/(B
@c You can tell RCS and CVS whether to use locking for a file or not
@c (@pxref{VC Concepts}, for a description of locking). VC automatically
@c recognizes what you have chosen, and behaves accordingly.
RCS$B$H(BCVS$B$K$O!"%U%!%$%k$N%m%C%/$r;H$&$+$I$&$+$r;XDj$G$-$^$9(B
$B!J%m%C%/$K4X$7$F$O(B@pxref{VC Concepts}$B!K!#(B
VC$B$O$I$A$i$rA*$s$@$+$r<1JL$7!"$=$N$h$&$K$U$k$^$$$^$9!#(B
@c @cindex non-strict locking (RCS)
@c @cindex locking, non-strict (RCS)
@cindex $B<e$$%m%C%/!J(BRCS$B!K(B
@cindex $B%m%C%/!"<e$$!J(BRCS$B!K(B
@c For RCS, the default is to use locking, but there is a mode called
@c @dfn{non-strict locking} in which you can check-in changes without
@c locking the file first. Use @samp{rcs -U} to switch to non-strict
@c locking for a particular file, see the @samp{rcs} manpage for details.
RCS$B$G$O!"%G%U%)%k%H$O%m%C%/$r;H$$$^$9!#(B
$B$7$+$7!"%U%!%$%k$r%m%C%/$7$F$$$J$/$F$bJQ99$r%A%'%C%/%$%s$G$-$k!"(B
@dfn{$B<e$$%m%C%/(B}$B$H8F$P$l$k%b!<%I$,$"$j$^$9!#(B
$BFCDj$N%U%!%$%k$KBP$7$F<e$$%m%C%/$r;H$&$h$&$K@Z$jBX$($k$K$O!"(B
@samp{rcs -U}$B$r;H$$$^$9!#(B
$B>\$7$/$O!"(B@samp{rcs}$B$N%^%K%e%"%k%Z!<%8$r;2>H$7$F$/$@$5$$!#(B
@c @cindex locking (CVS)
@cindex $B%m%C%/!J(BCVS$B!K(B
@c Under CVS, the default is not to use locking; anyone can change a work
@c file at any time. However, there are ways to restrict this, resulting
@c in behavior that resembles locking.
CVS$B$G$O!"%G%U%)%k%H$O%m%C%/$r;H$$$^$;$s!#(B
$B$$$D$G$bC/$b$,:n6H%U%!%$%k$rJQ99$G$-$^$9!#(B
$B$7$+$7!"$3$l$r@)8B$9$kJ}K!$,$"$j!"%m%C%/$K;w$?$U$k$^$$$r$7$^$9!#(B
@c @cindex CVSREAD environment variable (CVS)
@cindex CVSREAD$B!J4D6-JQ?t!K!J(BCVS$B!K(B
@cindex $B4D6-JQ?t(BCVSREAD$B!J(BCVS$B!K(B
@c For one thing, you can set the @code{CVSREAD} environment variable to
@c an arbitrary value. If this variable is defined, CVS makes your work
@c files read-only by default. In Emacs, you must type @kbd{C-x C-q} to
@c make the file writeable, so that editing works in fact similar as if
@c locking was used. Note however, that no actual locking is performed, so
@c several users can make their files writeable at the same time. When
@c setting @code{CVSREAD} for the first time, make sure to check out all
@c your modules anew, so that the file protections are set correctly.
1$B$D$NJ}K!$O!"4D6-JQ?t(B@code{CVSREAD}$B$K2?$+CM$r@_Dj$9$k$3$H$G$9!#(B
$B$3$NJQ?t$,Dj5A$5$l$F$$$k$H!"(B
CVS$B$O%G%U%)%k%H$G$O:n6H%U%!%$%k$rFI$_=P$7@lMQ$K$7$^$9!#(B
Emacs$BFb$G$O!"(B@kbd{C-x C-q}$B$HBG$C$F%U%!%$%k$r=q$-9~$_2DG=$K$9$kI,MW$,$"$j$^$9!#(B
$B$=$&$9$k$H!";v<B>e%m%C%/$r;H$C$F$$$k$+$N$h$&$KJT=8$G$-$^$9!#(B
$B$7$+$7$J$,$i!"<B:]$K%m%C%/$5$l$F$$$k$o$1$G$O$J$$$N$G!"(B
$BJ#?t$N%f!<%6!<$,3F<+$N%U%!%$%k$rF1;~$K=q$-9~$_2DG=$K$G$-$F$7$^$$$^$9!#(B
@code{CVSREAD}$B$r=i$a$F@_Dj$9$k$H$-$K$O!"(B
$B%U%!%$%k$NJ]8n$,@5$7$/@_Dj$5$l$k$h$&$K!"(B
$B$"$J$?$N%b%8%e!<%k$9$Y$F$r?7$?$K%A%'%C%/%"%&%H$7$?$3$H$r3NG'$7$F$/$@$5$$!#(B
@c @cindex cvs watch feature
@c @cindex watching files (CVS)
@cindex cvs$B4F;k5!G=(B
@cindex $B%U%!%$%k$N4F;k!J(BCVS$B!K(B
@c Another way to achieve something similar to locking is to use the
@c @dfn{watch} feature of CVS. If a file is being watched, CVS makes it
@c read-only by default, and you must also use @kbd{C-x C-q} in Emacs to
@c make it writable. VC calls @code{cvs edit} to make the file writeable,
@c and CVS takes care to notify other developers of the fact that you
@c intend to change the file. See the CVS documentation for details on
@c using the watch feature.
$B%m%C%/$K;w$?$U$k$^$$$rC#@.$9$kJL$NJ}K!$O!"(BCVS$B$N(B@dfn{$B4F;k(B}$B5!G=$r;H$&$3$H$G$9!#(B
$B%U%!%$%k$r4F;k$9$k$h$&$K$7$F$*$/$H!"(B
CVS$B$O%G%U%)%k%H$G$=$N%U%!%$%k$rFI$_=P$7@lMQ$K$7$^$9!#(B
$B$=$N$?$a!"(BEmacs$BFb$G$O(B@kbd{C-x C-q}$B$r;H$C$F=q$-9~$_2DG=$K$9$kI,MW$,$"$j$^$9!#(B
VC$B$O!"(B@code{cvs edit}$B$r<B9T$7$F%U%!%$%k$r=q$-9~$_2DG=$K$7$^$9!#(B
$B$9$k$H!"(BCVS$B$O!"$"$J$?$,%U%!%$%k$rJQ99$7$h$&$H$7$F$$$k$3$H$r(B
$BB>$N3+H/<T$KDLCN$7$^$9!#(B
$B4F;k5!G=$N>\$7$$;H$$J}$K$D$$$F$O!"(BCVS$B$N2r@b$r;2>H$7$F$/$@$5$$!#(B
@vindex vc-handle-cvs
@c You can turn off use of VC for CVS-managed files by setting the
@c variable @code{vc-handle-cvs} to @code{nil}. If you do this, Emacs
@c treats these files as if they were not registered, and the VC commands
@c are not available for them. You must do all CVS operations manually.
$BJQ?t(B@code{vc-handle-cvs}$B$K(B@code{nil}$B$r@_Dj$9$l$P!"(B
CVS$B$N4IM}2<$KCV$$$?%U%!%$%k$KBP$7$F(BVC$B$r;H$o$J$$$h$&$K$G$-$^$9!#(B
$B$3$&$9$k$H!"(BEmacs$B$O!"$3$l$i$N%U%!%$%k$r(B
$B$"$?$+$bEPO?$5$l$F$$$J$$$+$N$h$&$K07$$!"(B
$B$=$l$i$KBP$7$F(BVC$B%3%^%s%I$O;H$($^$;$s!#(B
$B$9$Y$F$N(BCVS$BA`:n$r<jF0$G9T$&I,MW$,$"$j$^$9!#(B
@node VC Workfile Handling
@c @subsubsection VC Workfile Handling
@subsubsection VC$B:n6H%U%!%$%k$N07$$J}(B
@vindex vc-make-backup-files
@c Emacs normally does not save backup files for source files that are
@c maintained with version control. If you want to make backup files even
@c for files that use version control, set the variable
@c @code{vc-make-backup-files} to a non-@code{nil} value.
Emacs$B$O!"HG4IM}$N2<$KCV$+$l$?%=!<%9%U%!%$%k$KBP$7$F$O!"(B
$BDL>o%P%C%/%"%C%W%U%!%$%k$r:n$j$^$;$s!#(B
$BHG4IM}$r;H$C$F$$$k%U%!%$%k$KBP$7$F$b%P%C%/%"%C%W%U%!%$%k$r:n$j$?$$$J$i!"(B
$BJQ?t(B@code{vc-make-backup-files}$B$K(B@code{nil}$B0J30$NCM$r@_Dj$7$^$9!#(B
@vindex vc-keep-workfiles
@c Normally the work file exists all the time, whether it is locked or
@c not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
@c in a new version with @kbd{C-x C-q} deletes the work file; but any
@c attempt to visit the file with Emacs creates it again. (With CVS, work
@c files are always kept.)
$B%m%C%/$N>uBV$K4X$o$i$:!"(B
$BIaDL!":n6H%U%!%$%k$O$D$M$KB8:_$7$^$9!#(B
@code{vc-keep-workfiles}$B$K(B@code{nil}$B$r@_Dj$9$k$H!"(B
@kbd{C-x C-q}$B$G?7HG$r%A%'%C%/%$%s$9$k$H!":n6H%U%!%$%k$r:o=|$7$^$9!#(B
$B$7$+$7!"(BEmacs$B$G%U%!%$%k$rK,Ld$7$h$&$H$9$k$H!":n6H%U%!%$%k$r$U$?$?$S:n$j$^$9!#(B
$B!J(BCVS$B$G$O!":n6H%U%!%$%k$O$D$M$KB8:_$9$k!#!K(B
@vindex vc-follow-symlinks
@c Editing a version-controlled file through a symbolic link can be
@c dangerous. It bypasses the version control system---you can edit the
@c file without locking it, and fail to check your changes in. Also,
@c your changes might overwrite those of another user. To protect against
@c this, VC checks each symbolic link that you visit, to see if it points
@c to a file under version control.
$BHG4IM}$5$l$F$$$k%U%!%$%k$r%7%s%\%j%C%/%j%s%/$r2p$7$FJT=8$9$k$3$H$O!"(B
$B4m81$J$3$H$K$J$j$($^$9!#(B
$BHG4IM}%7%9%F%`$r1*2s$7$F$7$^$$$^$9!#(B
$B$D$^$j!"%m%C%/$;$:$K%U%!%$%k$rJT=8$G$-$F$7$^$$!"(B
$BJQ99$N%A%'%C%/%$%s$K$O<:GT$7$^$9!#(B
$B$^$?!"B>$N%f!<%6!<$,$"$J$?$NJQ99$r>e=q$-$7$F$7$^$&$+$b$7$l$^$;$s!#(B
$B$3$&$$$C$?$3$H$rKI$0$?$a$K!"(B
VC$B$O!"K,Ld$9$k3F%7%s%\%j%C%/%j%s%/$r8!::$7$F!"(B
$B$=$l$,HG4IM}$N2<$KCV$+$l$?%U%!%$%k$r;X$7$F$$$k$+$I$&$+D4$Y$^$9!#(B
@c The variable @code{vc-follow-symlinks} controls what to do when a
@c symbolic link points to a version-controlled file. If it is @code{nil},
@c VC only displays a warning message. If it is @code{t}, VC automatically
@c follows the link, and visits the real file instead, telling you about
@c this in the echo area. If the value is @code{ask} (the default), VC
@c asks you each time whether to follow the link.
$BJQ?t(B@code{vc-follow-symlinks}$B$O!"(B
$B%7%s%\%j%C%/%j%s%/$,HG4IM}$5$l$F$$$k%U%!%$%k$r;X$7$F$$$k$H$-$K(B
$B$I$&$9$k$+$r@)8f$7$^$9!#(B
$B$=$NCM$,(B@code{nil}$B$J$i$P!"(BVC$B$O7Y9p%a%C%;!<%8$rI=<($9$k$@$1$G$9!#(B
@code{t}$B$J$i$P!"(BVC$B$O<+F0E*$K%j%s%/$rC)$C$F!"$+$o$j$KK\Ev$N%U%!%$%k$rK,Ld$7!"(B
$B%(%3!<NN0h$K$3$N$3$H$rI=<($7$^$9!#(B
$BCM$,(B@code{ask}$B!J%G%U%)%k%H!K$J$i$P!"(B
VC$B$O%j%s%/$rC)$k$+$I$&$+$rKh2sJ9$$$F$-$^$9!#(B
@node VC Status Retrieval
@c @subsubsection VC Status Retrieval
@subsubsection VC$B>uBV8!:w(B
@c There is no need to tell users about vc-master-templates.
@c When deducing the locked/unlocked state of a file, VC first looks for
@c an RCS version header string in the file (@pxref{Version Headers}). If
@c there is no header string, or if you are using SCCS, VC normally looks
@c at the file permissions of the work file; this is fast. But there might
@c be situations when the file permissions cannot be trusted. In this case
@c the master file has to be consulted, which is rather expensive. Also
@c the master file can only tell you @emph{if} there's any lock on the
@c file, but not whether your work file really contains that locked
@c version.
$B%U%!%$%k$N%m%C%/>uBV$r?dB,$9$k$H$-!"(B
VC$B$O$^$:%U%!%$%k$N(BRCS$B$NHG4IM}%X%C%@J8;zNs$rC5$7$^$9(B
$B!J(B@pxref{Version Headers}$B!K!#(B
$B%X%C%@J8;zNs$,$J$+$C$?$j!"(BSCCS$B$r;H$C$F$$$k$H$-$O!"(B
VC$B$ODL>o!":n6H%U%!%$%k$N%Q!<%_%C%7%g%s$rD4$Y$^$9!#(B
$B$3$3$^$G$O!"$9$0$K$G$-$^$9!#(B
$B$7$+$7!"%U%!%$%k$N%Q!<%_%C%7%g%s$r?.Mj$G$-$J$$>l9g$b$"$j$^$9!#(B
$B$3$N>l9g!"$d$d<j4V$,$+$+$j$^$9$,!"%^%9%?%U%!%$%k$rD4$Y$kI,MW$,$"$j$^$9!#(B
$B$5$i$K!"%^%9%?%U%!%$%k$O!"%U%!%$%k$,%m%C%/$5$l$F$$$k$+$I$&$+$O(B
$B65$($F$/$l$^$9$,!"(B
$B:n6H%U%!%$%k$,%m%C%/$5$l$?HG$rK\Ev$K4^$s$G$$$k$+$I$&$+$O65$($F$/$l$^$;$s!#(B
@vindex vc-consult-headers
@c You can tell VC not to use version headers to determine lock status by
@c setting @code{vc-consult-headers} to @code{nil}. VC then always uses
@c the file permissions (if it can trust them), or else checks the master
@c file.
$B%m%C%/>uBV$rD4$Y$k$?$a$KHG4IM}%X%C%@$r;H$o$J$$$h$&$K(BVC$B$K;X<($9$k$K$O!"(B
$BJQ?t(B@code{vc-consult-headers}$B$K(B@code{nil}$B$r@_Dj$7$^$9!#(B
$B$9$k$H!"(BVC$B$O!J?.Mj$G$-$k$J$i!K%U%!%$%k%Q!<%_%C%7%g%s$r;H$&$+!"(B
$B%^%9%?%U%!%$%k$rD4$Y$^$9!#(B
@vindex vc-mistrust-permissions
@c You can specify the criterion for whether to trust the file
@c permissions by setting the variable @code{vc-mistrust-permissions}. Its
@c value can be @code{t} (always mistrust the file permissions and check
@c the master file), @code{nil} (always trust the file permissions), or a
@c function of one argument which makes the decision. The argument is the
@c directory name of the @file{RCS}, @file{CVS} or @file{SCCS}
@c subdirectory. A non-@code{nil} value from the function says to mistrust
@c the file permissions. If you find that the file permissions of work
@c files are changed erroneously, set @code{vc-mistrust-permissions} to
@c @code{t}. Then VC always checks the master file to determine the file's
@c status.
$BJQ?t(B@code{vc-mistrust-permissions}$B$r@_Dj$9$k$3$H$G!"(B
$B%U%!%$%k%Q!<%_%C%7%g%s$r?.Mj$9$k$+$I$&$+$N4p=`$r;XDj$G$-$^$9!#(B
$B$=$NCM$O!"(B@code{t}$B!J$D$M$K%U%!%$%k%Q!<%_%C%7%g%s$r5?$$!"(B
$B%^%9%?%U%!%$%k$rD4$Y$k!K!"(B
@code{nil}$B!J$D$M$K%U%!%$%k%Q!<%_%C%7%g%s$r?.Mj$9$k!K!"$"$k$$$O!"(B
$B2DH]$r7hDj$9$k(B1$B0z?t$N4X?t$G$9!#(B
$B$=$N0z?t$O!"%5%V%G%#%l%/%H%j!"(B@file{RCS}$B!"(B@file{CVS}$B!"(B@file{SCCS}$B$N(B
$B$$$:$l$+$NL>A0$G$9!#(B
$B4X?t$NLa$jCM$,(B@code{nil}$B0J30$J$i$P!"%U%!%$%k%Q!<%_%C%7%g%s$r5?$$$^$9!#(B
$B:n6H%U%!%$%k$N%Q!<%_%C%7%g%s$,$^$A$,$C$FJQ99$5$l$F$$$k$H;W$&$J$i!"(B
@code{vc-mistrust-permissions}$B$K(B@code{t}$B$r@_Dj$7$^$9!#(B
$B$9$k$H!"(BVC$B$O$D$M$K%U%!%$%k$N>uBV$r7hDj$9$k$?$a$K%^%9%?%U%!%$%k$rD4$Y$^$9!#(B
@node VC Command Execution
@c @subsubsection VC Command Execution
@subsubsection VC$B%3%^%s%I$N<B9T(B
@vindex vc-suppress-confirm
@c If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x C-q}
@c and @kbd{C-x v i} can save the current buffer without asking, and
@c @kbd{C-x v u} also operates without asking for confirmation. (This
@c variable does not affect @kbd{C-x v c}; that operation is so drastic
@c that it should always ask for confirmation.)
@code{vc-suppress-confirm}$B$,(B@code{nil}$B0J30$J$i$P!"(B
@kbd{C-x C-q}$B$H(B@kbd{C-x v i}$B$O3NG'$;$:$K%+%l%s%H%P%C%U%!$rJ]B8$7!"(B
@kbd{C-x v u}$B$b3NG'$;$:$K:nMQ$7$^$9!#(B
$B!J$3$NJQ?t$O(B@kbd{C-x v c}$B$K$O1F6A$7$J$$!#(B
$B$=$NA`:n$O;W$$@Z$C$?$b$N$J$N$G!"$D$M$K3NG'$9$k$Y$-!#!K(B
@vindex vc-command-messages
@c VC mode does much of its work by running the shell commands for RCS,
@c CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
@c displays messages to indicate which shell commands it runs, and
@c additional messages when the commands finish.
VC$B%b!<%I$O!"(BRCS$B!"(BCVS$B!"(BSCCS$B$N%7%'%k%3%^%s%I$r<B9T$9$k$3$H$G!"(B
$B$=$N:n6H$NB?$/$r9T$$$^$9!#(B
@code{vc-command-messages}$B$,(B@code{nil}$B0J30$J$i$P!"(B
VC$B$O$I$N%7%'%k%3%^%s%I$r<B9T$7$F$$$k$+I=<($7!"(B
$B%3%^%s%I$,=*N;$7$?$H$-$KDI2C%a%C%;!<%8$rI=<($7$^$9!#(B
@vindex vc-path
@c You can specify additional directories to search for version control
@c programs by setting the variable @code{vc-path}. These directories are
@c searched before the usual search path. But the proper files are usually
@c found automatically.
$BJQ?t(B@code{vc-path}$B$r@_Dj$9$l$P!"(B
$BHG4IM}%W%m%0%i%`$rC5$9$?$a$NDI2C$N%G%#%l%/%H%j$r;XDj$G$-$^$9!#(B
$B$3$l$i$N%G%#%l%/%H%j$O!"DL>o$NC5:w%Q%9$rC5$9$^$($KC5$5$l$^$9!#(B
$B$7$+$7!"DL>o$OE,@Z$J%U%!%$%k$r<+F0E*$K$_$D$1$i$l$^$9!#(B
@node Directories
@c @section File Directories
@section $B%U%!%$%k%G%#%l%/%H%j(B
@c @cindex file directory
@c @cindex directory listing
@cindex $B%U%!%$%k%G%#%l%/%H%j(B
@cindex $B%G%#%l%/%H%j0lMw(B
@c The file system groups files into @dfn{directories}. A @dfn{directory
@c listing} is a list of all the files in a directory. Emacs provides
@c commands to create and delete directories, and to make directory
@c listings in brief format (file names only) and verbose format (sizes,
@c dates, and authors included). There is also a directory browser called
@c Dired; see @ref{Dired}.
$B%U%!%$%k%7%9%F%`$O!"%U%!%$%k72$r(B@dfn{$B%G%#%l%/%H%j(B}$B$K$^$H$a$^$9!#(B
@dfn{$B%G%#%l%/%H%j0lMw(B}$B$O!"%G%#%l%/%H%j$NCf$K$"$k!"(B
$B$9$Y$F$N%U%!%$%k$N0lMwI=$G$9!#(B
Emacs$B$K$O!"%G%#%l%/%H%j$r:n@.$7$?$j:o=|$7$?$j$9$k%3%^%s%I!"(B
$BC;7A<0!J%U%!%$%kL>$N$_!K$dD97A<0!J%5%$%:!"F|IU!":n<T$r4^$`!K$N(B
$B%G%#%l%/%H%j0lMw$r:n@.$9$k%3%^%s%I$,$"$j$^$9!#(B
dired$B$H8F$P$l$k%G%#%l%/%H%j%V%i%&%6$b$"$j$^$9!#(B
@xref{Dired}$B!#(B
@table @kbd
@item C-x C-d @var{dir-or-pattern} @key{RET}
@c Display a brief directory listing (@code{list-directory}).
$BC;7A<0$G%G%#%l%/%H%j0lMw$rI=<($9$k!J(B@code{list-directory}$B!K!#(B
@item C-u C-x C-d @var{dir-or-pattern} @key{RET}
@c Display a verbose directory listing.
$BD97A<0$G%G%#%l%/%H%j0lMw$rI=<($9$k!#(B
@item M-x make-directory @key{RET} @var{dirname} @key{RET}
@c Create a new directory named @var{dirname}.
@var{dirname}$B$H$$$&L>A0$N?7$7$$%G%#%l%/%H%j$r:n$k!#(B
@item M-x delete-directory @key{RET} @var{dirname} @key{RET}
@c Delete the directory named @var{dirname}. It must be empty,
@c or you get an error.
@var{dirname}$B$H$$$&L>A0$N%G%#%l%/%H%j$r:o=|$9$k!#(B
$B%G%#%l%/%H%j$O6u$G$"$kI,MW$,$"$j!"$5$b$J$$$H%(%i!<!#(B
@end table
@findex list-directory
@kindex C-x C-d
@c The command to display a directory listing is @kbd{C-x C-d}
@c (@code{list-directory}). It reads using the minibuffer a file name
@c which is either a directory to be listed or a wildcard-containing
@c pattern for the files to be listed. For example,
$B%G%#%l%/%H%j0lMw$rI=<($9$k%3%^%s%I$O(B
@kbd{C-x C-d}$B!J(B@code{list-directory}$B!K$G$9!#(B
$BI=<($9$k%G%#%l%/%H%j$d0lMw$K4^$a$k%U%!%$%k$r;XDj$9$k%o%$%k%I%+!<%I$r4^$`(B
$B%Q%?!<%s$r%_%K%P%C%U%!$+$iFI$_<h$j$^$9!#(B
$B$?$H$($P!"(B
@example
C-x C-d /u2/emacs/etc @key{RET}
@end example
@noindent
@c lists all the files in directory @file{/u2/emacs/etc}. Here is an
@c example of specifying a file name pattern:
$B$H$9$k$H!"(B
$B%G%#%l%/%H%j(B@file{/u2/emacs/etc}$B$NCf$N$9$Y$F$N%U%!%$%k$rI=<($7$^$9!#(B
$B%U%!%$%kL>$N%Q%?!<%s$r;XDj$7$?Nc$O$D$.$N$H$*$j$G$9!#(B
@example
C-x C-d /u2/emacs/src/*.c @key{RET}
@end example
@c Normally, @kbd{C-x C-d} prints a brief directory listing containing
@c just file names. A numeric argument (regardless of value) tells it to
@c make a verbose listing including sizes, dates, and authors (like
@c @samp{ls -l}).
$BDL>o!"(B@kbd{C-x C-d}$B$O%U%!%$%kL>$@$1$r4^$s$@C;7A<0$N%G%#%l%/%H%j0lMw$r(B
$BI=<($7$^$9!#(B
$B!JCM$OL54X78$J!K?t0z?t$r;XDj$9$k$H!"(B
$B!J(B@samp{ls -l}$B$N$h$&$K!K%5%$%:!"F|IU!":n<T$r4^$`D97A<0$N0lMw$r:n$j$^$9!#(B
@vindex list-directory-brief-switches
@vindex list-directory-verbose-switches
@c The text of a directory listing is obtained by running @code{ls} in an
@c inferior process. Two Emacs variables control the switches passed to
@c @code{ls}: @code{list-directory-brief-switches} is a string giving the
@c switches to use in brief listings (@code{"-CF"} by default), and
@c @code{list-directory-verbose-switches} is a string giving the switches to
@c use in a verbose listing (@code{"-l"} by default).
$B%G%#%l%/%H%j0lMw$N%F%-%9%H$O!"2<0L%W%m%;%9$G(B@code{ls}$B$r<B9T$7$F<hF@$7$^$9!#(B
Emacs$B$N(B2$B$D$NJQ?t$G!"(B@code{ls}$B$XEO$9%*%W%7%g%s$r@)8f$7$^$9!#(B
@code{list-directory-brief-switches}$B$O!"C;7A<00lMw$N$H$-$K;H$&(B
$B%*%W%7%g%s$rM?$($kJ8;zNs$G$9!J%G%U%)%k%H$O(B@code{"-CF"}$B!K!#(B
@code{list-directory-verbose-switches}$B$O!"D97A<00lMw$N$H$-$K;H$&(B
$B%*%W%7%g%s$rM?$($kJ8;zNs$G$9!J%G%U%)%k%H$O(B@code{"-l"}$B!K!#(B
@node Comparing Files
@c @section Comparing Files
@c @cindex comparing files
@section $B%U%!%$%k$NHf3S(B
@cindex $B%U%!%$%k$NHf3S(B
@findex diff
@vindex diff-switches
@c The command @kbd{M-x diff} compares two files, displaying the
@c differences in an Emacs buffer named @samp{*Diff*}. It works by running
@c the @code{diff} program, using options taken from the variable
@c @code{diff-switches}, whose value should be a string.
$B%3%^%s%I(B@kbd{M-x diff}$B$O!"(B2$B$D$N%U%!%$%k$rHf3S$7!"(B
@samp{*Diff*}$B$H$$$&L>A0$N(BEmacs$B%P%C%U%!$K$=$N0c$$$rI=<($7$^$9!#(B
$B$3$N%3%^%s%I$O!"CM$,J8;zNs$G$"$kJQ?t(B@code{diff-switches}$B$G;XDj$5$l$?(B
$B%*%W%7%g%s$r;H$C$F(B@code{diff}$B%W%m%0%i%`$r<B9T$7$^$9!#(B
@c The buffer @samp{*Diff*} has Compilation mode as its major mode, so
@c you can use @kbd{C-x `} to visit successive changed locations in the two
@c source files. You can also move to a particular hunk of changes and
@c type @key{RET} or @kbd{C-c C-c}, or click @kbd{Mouse-2} on it, to move
@c to the corresponding source location. You can also use the other
@c special commands of Compilation mode: @key{SPC} and @key{DEL} for
@c scrolling, and @kbd{M-p} and @kbd{M-n} for cursor motion.
@c @xref{Compilation}.
$B%P%C%U%!(B@samp{*Diff*}$B$N%a%8%c!<%b!<%I$O%3%s%Q%$%k!J(Bcompilation$B!K%b!<%I$G$9!#(B
$B$G$9$+$i!"(B@kbd{C-x `}$B$r;H$C$F!"(B
2$B$D$N%=!<%9%U%!%$%k$GJQ99$5$l$F$$$k2U=j$r<!!9$KK,$l$k$3$H$,$G$-$^$9!#(B
$BFCDj$NJQ992U=j$K%]%$%s%H$r0\F0$7$F$+$i!"(B
@key{RET}$B$d(B@kbd{C-c C-c}$B$rBG$D$+!"$=$3$G(B@kbd{Mouse-2}$B$r%/%j%C%/$9$k$H!"(B
$B$=$3$KBP1~$9$k%=!<%9$N>l=j$X0\F0$G$-$^$9!#(B
$B%3%s%Q%$%k!J(Bcompilation$B!K%b!<%I$NB>$NFCJL$J%3%^%s%I$r;H$&$3$H$b$G$-$^$9!#(B
@key{SPC}$B$H(B@key{DEL}$B$G%9%/%m!<%k!"(B
@kbd{M-p}$B$H(B@kbd{M-n}$B$G%+!<%=%k0\F0$G$-$^$9!#(B
@xref{Compilation}$B!#(B
@findex diff-backup
@c The command @kbd{M-x diff-backup} compares a specified file with its most
@c recent backup. If you specify the name of a backup file,
@c @code{diff-backup} compares it with the source file that it is a backup
@c of.
$B%3%^%s%I(B@kbd{M-x diff-backup}$B$O!"(B
$B;XDj$5$l$?%U%!%$%k$H$=$N:G?7$N%P%C%/%"%C%W$H$rHf3S$7$^$9!#(B
$B%P%C%/%"%C%W%U%!%$%k$NL>A0$r;XDj$9$k$H!"(B
@code{diff-backup}$B$O$=$N$b$H$N%U%!%$%k$H%P%C%/%"%C%W%U%!%$%k$H$rHf3S$7$^$9!#(B
@findex compare-windows
@c The command @kbd{M-x compare-windows} compares the text in the current
@c window with that in the next window. Comparison starts at point in each
@c window, and each starting position is pushed on the mark ring in its
@c respective buffer. Then point moves forward in each window, a character
@c at a time, until a mismatch between the two windows is reached. Then
@c the command is finished. For more information about windows in Emacs,
@c @ref{Windows}.
$B%3%^%s%I(B@kbd{M-x compare-windows}$B$O!"(B
$B%+%l%s%H%&%#%s%I%&$NCf$N%F%-%9%H$H!"(B
$B$D$.$N%&%#%s%I%&$NCf$N%F%-%9%H$rHf3S$7$^$9!#(B
$B$=$l$>$l$N%&%#%s%I%&$N%]%$%s%H0LCV$+$iHf3S$r;O$a$^$9!#(B
$B$=$l$>$l$N3+;O0LCV$O!"3F%P%C%U%!$N%^!<%/%j%s%0$K@Q$^$l$^$9!#(B
$B$=$7$F!"3F%&%#%s%I%&$G$=$l$>$l$N%]%$%s%H$r(B1$BJ8;z$:$D?J$a$k$3$H$r!"(B
$BN><T$N%&%#%s%I%&$G0lCW$7$J$$$b$N$K=P2q$&$^$G9T$$$^$9!#(B
$B$=$7$F!"%3%^%s%I$O=*N;$7$^$9!#(B
Emacs$B$N%&%#%s%I%&$K$D$$$F$h$j>\$7$/$O!"(B@xref{Windows}$B!#(B
@vindex compare-ignore-case
@c With a numeric argument, @code{compare-windows} ignores changes in
@c whitespace. If the variable @code{compare-ignore-case} is
@c non-@code{nil}, it ignores differences in case as well.
$B?t0z?t$r;XDj$9$k$H!"(B@code{compare-windows}$B$O(B
$BGrJ8;z$N0c$$$rL5;k$7$^$9!#(B
$BJQ?t(B@code{compare-ignore-case}$B$,(B@code{nil}$B0J30$J$i$P!"(B
$BBgJ8;z>.J8;z$N0c$$$bF1MM$KL5;k$7$^$9!#(B
@c See also @ref{Emerge}, for convenient facilities for merging two
@c similar files.
2$B$D$N;w$?%U%!%$%k$NJ;9g$KJXMx$J5!G=$K4X$7$F$O!"(B@xref{Emerge}$B!#(B
@node Misc File Ops
@c @section Miscellaneous File Operations
@section $B$=$NB>$N%U%!%$%kA`:n(B
@c Emacs has commands for performing many other operations on files.
@c All operate on one file; they do not accept wildcard file names.
Emacs$B$K$O!"%U%!%$%k$r$5$^$6$^$KA`:n$9$k%3%^%s%I$,$"$j$^$9!#(B
$B$=$l$i$9$Y$F$O(B1$B$D$N%U%!%$%k$rA`:n$7$^$9!#(B
$B$3$l$i$N%3%^%s%I$O!"%o%$%k%I%+!<%I$r4^$`%U%!%$%kL>$r<u$1IU$1$^$;$s!#(B
@findex view-file
@c @cindex viewing
@c @cindex View mode
@c @cindex mode, View
@cindex $B1\Mw(B
@cindex $B1\Mw%b!<%I!J(BView mode$B!K(B
@cindex $B%b!<%I!"(BView
@c @kbd{M-x view-file} allows you to scan or read a file by sequential
@c screenfuls. It reads a file name argument using the minibuffer. After
@c reading the file into an Emacs buffer, @code{view-file} displays the
@c beginning. You can then type @key{SPC} to scroll forward one windowful,
@c or @key{DEL} to scroll backward. Various other commands are provided
@c for moving around in the file, but none for changing it; type @kbd{?}
@c while viewing for a list of them. They are mostly the same as normal
@c Emacs cursor motion commands. To exit from viewing, type @kbd{q}.
@c The commands for viewing are defined by a special major mode called View
@c mode.
@kbd{M-x view-file}$B$G$O!"%U%!%$%k$r(B1$B2hLLJ,$:$D=gHV$KD/$a$k$3$H$,$G$-$^$9!#(B
$B$3$N%3%^%s%I$O!"%_%K%P%C%U%!$G%U%!%$%kL>$rFI$_<h$j$^$9!#(B
Emacs$B%P%C%U%!$K%U%!%$%k$rFI$_9~$s$@$"$H!"(B@code{view-file}$B$O@hF,$rI=<($7$^$9!#(B
$B$=$&$7$?$i!"(B1$B%&%#%s%I%&J,@h$X%9%/%m!<%k$9$k$K$O(B@key{SPC}$B!"(B
$B5U8~$-$K%9%/%m!<%k$9$k$K$O(B@key{DEL}$B$rBG$A$^$9!#(B
$B%U%!%$%kFb$rF0$-2v$k$?$a$NB>$N$$$m$$$m$J%3%^%s%I$b$"$j$^$9$,!"(B
$BJQ99$9$k$?$a$N%3%^%s%I$O$"$j$^$;$s!#(B
$B%3%^%s%I0lMw$r8+$k$K$O!"$3$N%b!<%I$G(B@kbd{?}$B$HBG$A$^$9!#(B
$B%3%^%s%I72$O!"(BEmacs$B$NIaDL$N%+!<%=%k0\F0%3%^%s%I$H$[$H$s$IF1$8$G$9!#(B
$B%U%!%$%k1\Mw$r=*N;$9$k$K$O!"(B@kbd{q}$B$rBG$A$^$9!#(B
$B1\MwMQ$N%3%^%s%I$O!"1\Mw!J(Bview$B!K%b!<%I$H8F$P$l$k(B
$BFCJL$J%a%8%c!<%b!<%I$GDj5A$5$l$F$$$^$9!#(B
@c A related command, @kbd{M-x view-buffer}, views a buffer already present
@c in Emacs. @xref{Misc Buffer}.
$B4XO"$7$?%3%^%s%I!"(B@kbd{M-x view-buffer}$B$O!"(B
Emacs$B$N4{B8$N%P%C%U%!$r1\Mw$7$^$9!#(B
@xref{Misc Buffer}$B!#(B
@findex insert-file
@c @kbd{M-x insert-file} inserts a copy of the contents of the specified
@c file into the current buffer at point, leaving point unchanged before the
@c contents and the mark after them.
@kbd{M-x insert-file}$B$O!";XDj$7$?%U%!%$%k$NFbMF$r(B
$B%+%l%s%H%P%C%U%!$N%]%$%s%H0LCV$KA^F~$7$^$9!#(B
$B%]%$%s%H$N0LCV$O$=$N$^$^$G$9$,!"A^F~$5$l$?ItJ,$ND>8e$K%^!<%/$r@_Dj$7$^$9!#(B
@findex write-region
@c @kbd{M-x write-region} is the inverse of @kbd{M-x insert-file}; it
@c copies the contents of the region into the specified file. @kbd{M-x
@c append-to-file} adds the text of the region to the end of the specified
@c file. @xref{Accumulating Text}.
@kbd{M-x write-region}$B$O!"(B@kbd{M-x insert-file}$B$N5U$G$9!#(B
$B;XDj$7$?%U%!%$%k$K%j!<%8%g%s$NFbMF$r%3%T!<$7$^$9!#(B
@kbd{M-x append-to-file}$B$O!"(B
$B;XDj$7$?%U%!%$%k$NKvHx$K%j!<%8%g%s$N%F%-%9%H$rIU$12C$($^$9!#(B
@xref{Accumulating Text}$B!#(B
@findex delete-file
@c @cindex deletion (of files)
@cindex $B:o=|!J%U%!%$%k!K(B
@cindex $B%U%!%$%k$N:o=|(B
@c @kbd{M-x delete-file} deletes the specified file, like the @code{rm}
@c command in the shell. If you are deleting many files in one directory, it
@c may be more convenient to use Dired (@pxref{Dired}).
@kbd{M-x delete-file}$B$O!"%7%'%k$N(B@code{rm}$B%3%^%s%I$N$h$&$K!"(B
$B;XDj$7$?%U%!%$%k$r:o=|$7$^$9!#(B
1$B$D$N%G%#%l%/%H%jFb$N$?$/$5$s$N%U%!%$%k$r:o=|$9$k$N$J$i!"(B
dired$B$r;H$&$[$&$,JXMx$G$9!J(B@pxref{Dired}$B!K!#(B
@findex rename-file
@c @kbd{M-x rename-file} reads two file names @var{old} and @var{new} using
@c the minibuffer, then renames file @var{old} as @var{new}. If a file named
@c @var{new} already exists, you must confirm with @kbd{yes} or renaming is not
@c done; this is because renaming causes the old meaning of the name @var{new}
@c to be lost. If @var{old} and @var{new} are on different file systems, the
@c file @var{old} is copied and deleted.
@kbd{M-x rename-file}$B$O!"%_%K%P%C%U%!$G(B2$B$D$N%U%!%$%kL>!"(B
@var{old}$B$H(B@var{new}$B$rFI$_<h$j!"%U%!%$%k(B@var{old}$B$r(B@var{new}$B$K2~L>$7$^$9!#(B
@var{new}$B$H$$$&L>A0$N%U%!%$%k$,4{B8$N$H$-$K$O!"(B
$B3NG'$K(B@kbd{yes}$B$G1~Ez$9$kI,MW$,$"$j$^$9!#(B
$B$=$&$7$J$$$H!"2~L>$7$^$;$s!#(B
$B$3$l$O!"2~L>$K$h$jL>A0(B@var{new}$B$N8E$$0UL#$,<:$o$l$k$+$i$G$9!#(B
@var{old}$B$H(B@var{new}$B$,0[$J$k%U%!%$%k%7%9%F%`$N>e$K$"$k$H$-$K$O!"(B
$B%U%!%$%k(B@var{old}$B$r!J(B@var{new}$B$K!K%3%T!<$7$F$+$i:o=|$7$^$9!#(B
@findex add-name-to-file
@c The similar command @kbd{M-x add-name-to-file} is used to add an
@c additional name to an existing file without removing its old name.
@c The new name must belong on the same file system that the file is on.
$B;w$?%3%^%s%I(B@kbd{M-x add-name-to-file}$B$O!"(B
$B4{B8%U%!%$%k$NL>A0$r>C$5$:$KJL$NL>A0$rDI2C$9$k$?$a$K;H$$$^$9!#(B
$B?7$7$$L>A0$O!"4{B8%U%!%$%k$,CV$+$l$F$$$kF1$8%U%!%$%k%7%9%F%`$K(B
$BB0$7$F$$$kI,MW$,$"$j$^$9!#(B
@findex copy-file
@c @cindex copying files
@cindex $B%U%!%$%k$N%3%T!<(B
@c @kbd{M-x copy-file} reads the file @var{old} and writes a new file named
@c @var{new} with the same contents. Confirmation is required if a file named
@c @var{new} already exists, because copying has the consequence of overwriting
@c the old contents of the file @var{new}.
@kbd{M-x copy-file}$B$O!"%U%!%$%k(B@var{old}$B$rFI$s$G!"(B
$B?7$7$$%U%!%$%k(B@var{new}$B$KF1$8FbMF$r=q$-=P$7$^$9!#(B
@var{new}$B$H$$$&L>A0$N%U%!%$%k$,4{B8$J$i!"3NG'$r5a$a$F$-$^$9!#(B
$B$H$$$&$N$O!"%3%T!<$9$k$H%U%!%$%k(B@var{new}$B$N8E$$FbMF$r>e=q$-$7$F$7$^$&$+$i$G$9!#(B
@findex make-symbolic-link
@c @kbd{M-x make-symbolic-link} reads two file names @var{target} and
@c @var{linkname}, then creates a symbolic link named @var{linkname} and
@c pointing at @var{target}. The effect is that future attempts to open file
@c @var{linkname} will refer to whatever file is named @var{target} at the
@c time the opening is done, or will get an error if the name @var{target} is
@c not in use at that time. This command does not expand the argument
@c @var{target}, so that it allows you to specify a relative name
@c as the target of the link.
@kbd{M-x make-symbolic-link}$B$O!"(B2$B$D$N%U%!%$%kL>!"(B
@var{target}$B$H(B@var{linkname}$B$rFI$_<h$C$F!"(B
@var{target}$B$r;X$9(B@var{linkname}$B$H$$$&L>A0$N%7%s%\%j%C%/%j%s%/$r:n$j$^$9!#(B
$B$3$N7k2L!">-Mh(B@var{linkname}$B$r%*!<%W%s$7$h$&$H$9$k$H!"(B
$B$=$N;~E@$G(B@var{target}$B$H$$$&L>A0$N%U%!%$%k$r;2>H$7$^$9!#(B
$B$=$N;~E@$GL>A0(B@var{target}$B$,;H$o$l$F$$$J$1$l$P!"%(%i!<$K$J$j$^$9!#(B
$B$3$N%3%^%s%I$O0z?t(B@var{target}$B$rE83+$7$J$$$N$G!"(B
$B%j%s%/@h$KAjBPL>$r=q$/$3$H$,$G$-$^$9!#(B
@c Confirmation is required when creating the link if @var{linkname} is
@c in use. Note that not all systems support symbolic links.
@var{linkname}$B$,;H$o$l$F$$$k$H!"(B
$B%j%s%/$r:n$k$H$-$K3NG'$r5a$a$^$9!#(B
$B$9$Y$F$N%7%9%F%`$G%7%s%\%j%C%/%j%s%/$r;H$($k$o$1$G$O$J$$$3$H$K(B
$BCm0U$7$F$/$@$5$$!#(B
@node Compressed Files
@c @section Accessing Compressed Files
@section $B05=L$5$l$?%U%!%$%k$N;2>H(B
@c @cindex compression
@c @cindex uncompression
@c @cindex Auto Compression mode
@c @cindex mode, Auto Compression
@cindex $B05=L(B
@cindex $BE83+(B
@cindex $B<+F005=L%b!<%I!J(BAuto Compression mode$B!K(B
@cindex $B%b!<%I!"(BAuto Compression
@pindex gzip
@findex auto-compression-mode
@c Emacs comes with a library that can automatically uncompress
@c compressed files when you visit them, and automatically recompress them
@c if you alter them and save them. To enable this feature, type the
@c command @kbd{M-x auto-compression-mode}.
Emacs$B$K$O!"(B
$B05=L$5$l$?%U%!%$%k$rK,Ld$9$k$H<+F0E*$KE83+$7!"(B
$B$=$l$rJQ99$7$FJ]B8$9$k$H<+F0E*$K:FEY05=L$9$k%i%$%V%i%j$,$"$j$^$9!#(B
$B$3$N5!G=$rMxMQ$9$k$K$O!"%3%^%s%I(B@kbd{M-x auto-compression-mode}$B$rBG$A$^$9!#(B
@c When automatic compression (which implies automatic uncompression as
@c well) is enabled, Emacs recognizes compressed files by their file names.
@c File names ending in @samp{.gz} indicate a file compressed with
@c @code{gzip}. Other endings indicate other compression programs.
$B!J<+F0E83+$r4^$`!K<+F005=L$,%*%s$N$H$-$K$O!"(B
Emacs$B$O%U%!%$%kL>$G05=L$5$l$?%U%!%$%k$rG'<1$7$^$9!#(B
$B%U%!%$%kL>$N8lHx$,(B@samp{.gz}$B$N$b$N$O!"(B
@code{gzip}$B$G05=L$5$l$?%U%!%$%k$G$"$k$3$H$rI=$7$^$9!#(B
$BB>$N8lHx$N>l9g$K$O!"B>$N05=L%W%m%0%i%`$G$"$k$3$H$rI=$7$^$9!#(B
@c Automatic uncompression and compression apply to all the operations in
@c which Emacs uses the contents of a file. This includes visiting it,
@c saving it, inserting its contents into a buffer, loading it, and byte
@c compiling it.
$B<+F0E83+$H<+F005=L$O!"(BEmacs$B$,%U%!%$%k$NFbMF$r;H$&$9$Y$F$NA`:n$KE,MQ$5$l$^$9!#(B
$B%U%!%$%k$rK,Ld$9$k!"%U%!%$%k$KJ]B8$9$k!"%U%!%$%k$NFbMF$r%P%C%U%!$KA^F~$9$k!"(B
$B%U%!%$%k$r%m!<%I$9$k!"%U%!%$%k$r%P%$%H%3%s%Q%$%k$9$k$3$H$r4^$_$^$9!#(B
@node Remote Files
@c @section Remote Files
@section $B%j%b!<%H%U%!%$%k(B
@cindex FTP
@c @cindex remote file access
@cindex $B%j%b!<%H%U%!%$%k$N;2>H(B
@c You can refer to files on other machines using a special file name syntax:
$BFCJL$J%U%!%$%kL>$N9=J8$r;H$C$F!"B>$N%^%7%s>e$N%U%!%$%k$r;2>H$G$-$^$9!#(B
@example
@group
/@var{host}:@var{filename}
/@var{user}@@@var{host}:@var{filename}
@end group
@end example
@noindent
@c When you do this, Emacs uses the FTP program to read and write files on
@c the specified host. It logs in through FTP using your user name or the
@c name @var{user}. It may ask you for a password from time to time; this
@c is used for logging in on @var{host}.
$B$3$N$h$&$K$9$k$H!"(BEmacs$B$O!"(B
$B;XDj$7$?%[%9%H>e$N%U%!%$%k$rFI$_=q$-$9$k$?$a$K(BFTP$B%W%m%0%i%`$r;H$$$^$9!#(B
$B$"$J$?$N%f!<%6!<L>$+(B@var{user}$B$r;H$C$F(BFTP$B$G%m%0%$%s$7$^$9!#(B
$BKh2s%Q%9%o!<%I$rJ9$+$l$k$3$H$b$"$j$^$9$,!"(B
$B$3$l$O(B@var{host}$B$X$N%m%0%$%s$K;H$o$l$^$9!#(B
@cindex ange-ftp
@vindex ange-ftp-default-user
@c Normally, if you do not specify a user name in a remote file name,
@c that means to use your own user name. But if you set the variable
@c @code{ange-ftp-default-user} to a string, that string is used instead.
@c (The Emacs package that implements FTP file access is called
@c @code{ange-ftp}.)
$BIaDL!"%j%b!<%H%U%!%$%kL>$K%f!<%6!<L>$r;XDj$7$J$$$H!"(B
$B$"$J$?$N%f!<%6!<L>$r;H$&$3$H$r0UL#$7$^$9!#(B
$B$7$+$7!"JQ?t(B@code{ange-ftp-default-user}$B$KJ8;zNs$r@_Dj$7$F$*$1$P!"(B
$B$=$NJ8;zNs$r$+$o$j$K;H$$$^$9!#(B
$B!J(BFTP$B$K$h$k%U%!%$%k;2>H$r<BAu$9$k(BEmacs$B$N%Q%C%1!<%8$O!"(B
@code{ange-ftp}$B$H8F$P$l$k!#!K(B
@vindex file-name-handler-alist
@c You can entirely turn off the FTP file name feature by setting the
@c variable @code{file-name-handler-alist} to @code{nil}.
$BJQ?t(B@code{file-name-handler-alist}$B$K(B@code{nil}$B$r@_Dj$9$k$H!"(B
FTP$B%U%!%$%kL>5!G=$r40A4$K%*%U$K$G$-$^$9(B
@footnote{$B%U%!%$%kL>$r%/%)!<%H$9$k(B@samp{/:}$B$N5!G=$b%*%U$K$J$k!#(B}$B!#(B
@node Quoted File Names
@c @section Quoted File Names
@section $B%/%)!<%H$7$?%U%!%$%kL>(B
@c @cindex quoting file names
@cindex $B%U%!%$%kL>$r%/%)!<%H$9$k(B
@c You can @dfn{quote} an absolute file name to prevent special
@c characters and syntax in it from having their special effects.
@c The way to do this is to add @samp{/:} at the beginning.
$BFC<lJ8;z$dFCJL$J9=J8$NFCJL$J8z2L$rM^$($k$?$a$K!"(B
$B@dBP%U%!%$%kL>$r(B@dfn{$B%/%)!<%H(B}$B$G$-$^$9!#(B
$B$=$&$9$k$K$O!"@hF,$K(B@samp{/:}$B$r2C$($^$9!#(B
@c For example, you can quote a local file name which appears remote, to
@c prevent it from being treated as a remote file name. Thus, if you have
@c a directory named @file{/foo:} and a file named @file{bar} in it, you
@c can refer to that file in Emacs as @samp{/:/foo:/bar}.
$B$?$H$($P!"%j%b!<%H$K$"$k$h$&$K8+$($k%m!<%+%k$J%U%!%$%kL>$r%/%)!<%H$7$F!"(B
$B%j%b!<%H%U%!%$%kL>$H$7$F07$o$l$k$N$rKI$.$^$9!#(B
$B$7$?$,$C$F!"%G%#%l%/%H%j$,(B@file{/foo:}$B$H$$$&L>A0$G$"$j!"(B
$B$=$NCf$K(B@file{bar}$B$H$$$&L>A0$N%U%!%$%k$,$"$k$H$-!"(B
Emacs$B$G$O!"$=$N%U%!%$%k$r(B@samp{/:/foo:/bar}$B$G;2>H$G$-$^$9!#(B
@c @samp{/:} can also prevent @samp{~} from being treated as a special
@c character for a user's home directory. For example, @file{/:/tmp/~hack}
@c refers to a file whose name is @file{~hack} in directory @file{/tmp}.
@samp{/:}$B$O!"(B@samp{~}$B$r%f!<%6!<$N%[!<%`%G%#%l%/%H%j$rI=$9(B
$BFC<lJ8;z$H$7$F07$o$J$$$h$&$K$b$7$^$9!#(B
$B$?$H$($P!"(B@file{/:/tmp/~hack}$B$O!"(B
$B%G%#%l%/%H%j(B@file{/tmp}$B$NCf$K$"$k(B@file{~hack}$B$H$$$&%U%!%$%kL>$r;X$7$^$9!#(B
@c Likewise, quoting with @samp{/:} is one way to enter in the minibuffer
@c a file name that contains @samp{$}. However, the @samp{/:} must be at
@c the beginning of the buffer in order to quote @samp{$}.
$BF1MM$K!"(B@samp{/:}$B$O(B@samp{$}$B$r4^$`%U%!%$%kL>$r(B
$B%_%K%P%C%U%!$GF~NO$9$kJ}K!$N(B1$B$D$G$9!#(B
$B$7$+$7!"(B@samp{$}$B$r%/%)!<%H$9$k$K$O!"(B
@samp{/:}$B$O!J%_%K!K%P%C%U%!$N@hF,$KCV$/I,MW$,$"$j$^$9!#(B
@c You can also quote wildcard characters with @samp{/:}, for visiting.
@c For example, @file{/:/tmp/foo*bar} visits the file @file{/tmp/foo*bar}.
@c However, in most cases you can simply type the wildcard characters for
@c themselves. For example, if the only file name in @file{/tmp} that
@c starts with @samp{foo} and ends with @samp{bar} is @file{foo*bar}, then
@c specifying @file{/tmp/foo*bar} will visit just @file{/tmp/foo*bar}.
$B%o%$%k%I%+!<%IJ8;z$r(B@samp{/:}$B$G%/%)!<%H$9$k$3$H$b$G$-$^$9!#(B
$B$?$H$($P!"(B@file{/:/tmp/foo*bar}$B$G%U%!%$%k(B@file{/tmp/foo*bar}$B$rK,Ld$7$^$9!#(B
$B$7$+$7$J$,$i!"B?$/$N>l9g!"C1$K%o%$%k%I%+!<%IJ8;z$=$N$b$N$rF~NO$G$-$^$9!#(B
$B$?$H$($P!"(B@file{/tmp}$B$K$"$k(B@samp{foo}$B$G;O$^$j(B@samp{bar}$B$G=*$kL>A0$N(B
$B%U%!%$%k$,(B@file{foo*bar}$B$G$"$k$H$-$K$O!"(B
@file{/tmp/foo*bar}$B$H;XDj$9$k$H!"C1$K(B@file{/tmp/foo*bar}$B$rK,Ld$7$^$9!#(B
|