XEmacs / man / dired.texi

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
\input texinfo    @c -*-texinfo-*-

@comment !Date: 1993/12/21 22:31:56 ! !Revision: 1.1 !

@comment %**start of header (This is for running Texinfo on a region.)
@setfilename ../info/dired.info
@settitle Tree Dired Version 6
@c @setchapternewpage odd
@comment %**end of header (This is for running Texinfo on a region.)

@iftex
@finalout
@end iftex

@ifinfo
This file documents Tree Dired, the GNU Emacs Directory Browser, and
most of the extra features available as an option.

Copyright (C) 1991, 1992 Free Software Foundation

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

@ignore
Permission is granted to process this file through TeX and print the
results, provided the printed document carries copying permission notice
identical to this one except for the removal of this paragraph (this
paragraph not being relevant to the printed manual).

@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled ``GNU General Public License'' is included exactly as
in the original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that the section entitled ``GNU General Public License'' may be
included in a translation approved by the author instead of in the
original English.
@end ifinfo

@titlepage
@sp 6
@center @titlefont{Tree Dired}
@sp 2
@center @titlefont{The GNU Emacs}
@sp 1
@center @titlefont{Directory Editor}
@sp 4
@c @@center !Date: 1993/12/21 22:31:56 !
@sp 1
@c @@center !Revision: 1.1 !
@sp 5
@center Sebastian Kremer
@center sk@@thp.uni-koeln.de

@page

@noindent
!Date: 1993/12/21 22:31:56 !

@noindent
!Revision: 1.1 !

@vskip 0pt plus 1filll
Copyright @copyright{} 1991, 1992 Free Software Foundation

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

@ignore
Permission is granted to process this file through TeX and print the
results, provided the printed document carries copying permission notice
identical to this one except for the removal of this paragraph (this
paragraph not being relevant to the printed manual).

@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled ``GNU General Public License'' is included exactly as
in the original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that the section entitled ``GNU General Public License'' may be
included in a translation approved by the author instead of in the
original English.
@end titlepage

@ifinfo

@node Top, Dired, (dir), (dir)

This file documents Tree Dired (version 6), the GNU Emacs Directory
Editor, including the optional ``Dired Extra'' features.

Tree Dired is an enhanced version of the Classic (18.xx Emacs) Dired and
will be the Dired of Emacs 19.  It is known to work with Emacs 18.55 and
18.57 (and probably most earlier versions).
@c and also with prerelease versions of Emacs 19, but I don't write that
@c since I don't want to be bombarded with questions like `when it will
@c be ready'...

@noindent
Revision of this manual:

@noindent
!Id: dired.texinfo,v 1.1 1993/12/21 22:31:56 jwz Exp !

@noindent
Report bugs to:
@example
Sebastian Kremer <sk@@thp.uni-koeln.de>
@end example

@menu
* Dired::			Dired, the Directory Editor
* Tree Dired Extra::		Tree Dired Extra features
* Dired Internals::		Dired Internals
* Dired Known Problems::	Known Problems with Dired

 --- Indices ---

* Dired Variable Index::	
* Dired Function Index::	
* Dired Key Index::		
* Dired Concept Index::		

 --- The Detailed Node Listing ---

Dired, the Directory Editor

* Entering Dired::		
* Editing in Dired::		
* Listing Files in Dired::	
* Marking Files in Dired::	
* Mark-using Commands::		
* Commands That Do Not Use Marks::  
* Subdirectories in Dired::	
* Hiding Directories in Dired::	 
* Acknowledgement::		
* Dired Customization::		

Mark-using Commands

* Copy and Move Into a Directory::  
* Renaming and More With Regexps::  
* Other File Creating Commands::  
* Deleting Files With Dired::	
* Dired Shell Commands::	
* Compressing and Uncompressing::  
* Changing File Attributes::	
* Loading and Byte-compiling Emacs Lisp Files::	 
* Printing the Marked Files::	

Dired Customization

* Dired User Options::		
* Dired Configuration::		
* Dired Hooks::			

Tree Dired Extra features

* Tree Dired Extra Features::	
* Dired Minibuffer History::	
* Inserting All Marked Subdirectories::	 
* Dynamic Dired Markers::	
* Omitting Files in Dired::	
* Advanced Dired Mark Commands::  
* Virtual Dired::		
* Multiple Dired Directories::	
* Dired Local Variables::	
* Making Relative Symbolic Links in Dired::  
* Letting Dired Guess What Shell Command to Apply::  
* dired-trns.el::		Filename Transformers for Dired Shell Commands
* dired-cd.el::			Changing the Working Directory for Dired Shell Commands
* dired-nstd.el::		Nested Dired format
* find-dired.el::		Feeding Find Output to Dired

Dired Internals

* Tree Dired Internals::	
* Dired Mark Internals::	
@end menu

@end ifinfo

@node Dired, Tree Dired Extra, Top, Top
@chapter Dired, the Directory Editor
@cindex Dired
@cindex Deletion (of files)

Dired makes it easy to delete or visit many of the files in a single
directory (and possibly its subdirectories) at once.  It makes an Emacs
buffer containing a listing of the directories, in the format of
@code{ls -lR}.  You can use the normal Emacs commands to move around in
this buffer, and special Dired commands to operate on the files.  You
can run shell commands on files, visit, compress, load or byte-compile
them, change their file attributes and insert subdirectories into the
same buffer.  You can ``mark'' files for later commands or ``flag'' them
for deletion, either file by file or all files matching certain
criteria.

@menu
* Entering Dired::		
* Editing in Dired::		
* Listing Files in Dired::	
* Marking Files in Dired::	
* Mark-using Commands::		
* Commands That Do Not Use Marks::  
* Subdirectories in Dired::	
* Hiding Directories in Dired::	 
* Acknowledgement::		
* Dired Customization::		
@end menu

@node Entering Dired, Editing in Dired, Dired, Dired
@section Entering Dired

@findex Dired
@kindex C-x d
@vindex dired-listing-switches
@noindent
To invoke Dired, do @kbd{C-x d} or @kbd{M-x dired}.  The command reads a
directory name or wildcard file name pattern as a minibuffer argument
just like the @code{list-directory} command, @kbd{C-x C-d}. Invoking
Dired with a prefix argument lets you enter the listing switches for the
directory.

Dired assumes you meant to use a wildcard if the last component of the
name is not an existing file.  Note that only the last pathname
component may contain wildcards.  With wildcards it uses the shell to do
the filename globbing, whereas usually it calls @samp{ls} directly.
Because of this, you might have to quote characters that are special to
the shell.  For example, to dired all auto-save files in your
@file{~/mail/} directory, use @samp{~/mail/\#*} as argument to Dired.
Note the backslash needed to quote @samp{#} (at the beginning of a word)
to the shell.

Where @code{dired} differs from @code{list-directory} is in naming the
buffer after the directory name or the wildcard pattern used for the
listing, and putting the buffer into Dired mode so that the special
commands of Dired are available in it.  The variable
@code{dired-listing-switches} is a string used as an argument to
@code{ls} in making the directory; this string @i{must} contain
@samp{-l}.  Most other switches are also allowed, especially @samp{-F},
@samp{-i} and @samp{-s}.  For the @samp{-F} switch to work you may have
to set the variable @code{dired-ls-F-marks-symlinks}, depending on what
kind of @samp{ls} program you are using.
@xref{Dired Configuration}.
@refill

When a Dired buffer for the given directory already exists, it is simply
selected without refreshing it.  You can type @kbd{g} if you suspect it
is out of date.

@findex dired-other-window
@kindex C-x 4 d
To display the Dired buffer in another window rather than in the
selected window, use @kbd{C-x 4 d} (@code{dired-other-window)} instead
of @kbd{C-x d}.@refill

@node Editing in Dired, Listing Files in Dired, Entering Dired, Dired
@section Editing in Dired

@noindent
Once the Dired buffer exists, you can switch freely between it and other
Emacs buffers.  Whenever the Dired buffer is selected, certain special
commands are provided that operate on files that are listed.  The Dired
buffer is ``read-only'', and inserting text in it is not useful, so
ordinary printing characters such as @kbd{d} and @kbd{x} are used for Dired
commands, and digits are prefix arguments.@refill

@cindex Current file (in Dired)
The file described by the line that point is on is called the
@dfn{current file}.  The directory this file is in is the @dfn{current
Dired directory}.  Note that there may be several directories in one
Dired buffer as long as they belong to the same tree.  The top level
directory, the @dfn{root} of the tree, is used as the working directory
of the buffer.@refill

Some or all directories can be @dfn{hidden}, leaving only their
headerlines visible, and exlcuding their files from Dired operations.

@cindex Marking files (in Dired)
Files can be @dfn{marked} for later commands.  Marking means putting a
special character, usually @samp{*}, in the first column of the file
line.  To @dfn{flag} a file means to mark it for later deletion.  This
special case of ``marking'' is distinguished so that you do not delete
files accidentally.  Internally, the only difference between marking and
flagging is the character used to mark the file: @samp{*} (an asterisk)
for a marked file, and @samp{D} for files flagged for deletion.

@cindex Mark-using commands
Most Dired commands operate on the ``marked'' files and default to the
current file.  They are the @dfn{mark-using} commands.  Deleting is the
only mark-using command that does not default to the current file.

Dired buffers ``know'' about each other.  For example, copying from
@var{dir1} into @var{dir2} will update @var{dir2}'s Dired buffer(s).
When you move files or directories, file and dired buffers are kept up
to date and refer to the new location.  But Dired only knows about files
changed by itself, not by other parts of Emacs or programs outside
Emacs.

All the usual Emacs cursor motion commands are available in Dired
buffers.  Some special purpose commands are also provided.  The keys
@kbd{C-n} and @kbd{C-p} are redefined so that they try to position the
cursor at the beginning of the filename on the line, rather than at the
beginning of the line.

For extra convenience, @key{SPC} and @kbd{n} in Dired are equivalent to
@kbd{C-n}.  @kbd{p} is equivalent to @kbd{C-p}.  Moving by lines is also
done so often in Dired that it deserves to be easy to type.  @key{DEL}
(move up and unflag) is often useful simply for moving up.@refill

@node Listing Files in Dired, Marking Files in Dired, Editing in Dired, Dired
@section Listing Files in Dired

@cindex Headerline
@cindex Non-file line
@cindex File line
@noindent
Initially the Dired buffer shows the directory you selected.  The first
line shows the full directory name.  It is an example of a
@dfn{headerline} of a directory.  Note that it is terminated by a colon
(@samp{:}) that is not part of the directory name.  The second line
usually displays the total size of all files in the directory or
the wildcard used.  Both are examples of @dfn{non-file lines}.
Applying a command to a non-file line signals an error.  The other lines
of the directory, called the @dfn{file lines}, show information about
each file such as permission bits, size and date of last modification,
and the name of the file.@refill

For example, the listing

@example
  /home/sk/lib/emacs/lisp:
  total 4973
  -rw-r--r--   1 sk       users      231608 Feb  6 16:58 ChangeLog
  drwxr-sr-x   2 sk       users        2048 Feb  6 11:07 RCS
  -r--r--r--   1 sk       users      141389 Feb  6 10:45 dired.el
  -r--r--r--   1 sk       users      113033 Feb  5 16:21 dired.texi
  @dots{}

  /home/sk/lib/emacs/lisp/RCS:
  total 4798
  -r--r--r--   1 sk       users      231748 Feb  6 16:59 dired.texi,v
  -r--r--r--   1 sk       users      763898 Feb  6 10:45 dired.el,v
  @dots{}
@end example

has a headerline for the @file{lisp} directory, a total line saying
there are 4973 K in all the files of that directory (your @samp{ls}
program may use units of blocks instead), and several file lines.  After
that, a headerline for the @file{RCS} subdirectory with its total line
and its files follows.

Here is an example of a wildcard listing:

@example
  /home/sk/lib/emacs/lisp:
  wildcard dired*
  -rw-r--r--   1 sk       users      113036 Feb  6 16:59 dired.texi
  -r--r--r--   1 sk       users       81267 Feb  6 16:29 dired.elc
  -r--r--r--   1 sk       users       38436 Feb  6 16:28 dired-x.elc
  -r--r--r--   1 sk       users       60258 Feb  6 16:27 dired-x.el
  -r--r--r--   1 sk       users      141389 Feb  6 10:45 dired.el
  @dots{}
@end example

Since @samp{ls} does not provide a total count when called with a wildcard
argument, the second line now gives instead the wildcard used, here
@samp{dired*}.  If there would have been a directory matching the
wildcard, e.g. a @samp{dired/} subdirectory, its file line would be
shown, but it would not have been expanded automatically.

Filenames may have embedded and trailing (but not leading) spaces.
Leading spaces are not recognized because different @samp{ls} programs
differ in the amount of whitespace the insert before the filename.
Filenames may @emph{not} contain newlines or @samp{^M}'s.  You can get
away with @samp{^M}'s in filenames if you do

@example
    (setq selective-display nil)
@end example

@noindent
in the Dired buffer (inside @code{dired-mode-hook}, @xref{Dired
Hooks}.). But this also disables the @kbd{=} and @kbd{$} hiding
commands, @xref{Hiding Directories in Dired}.@refill

Other unprintable characters than @samp{^M} or newline (@samp{^J}) in
filenames are no problem for Dired.  But your @samp{ls} program may not
output them correctly (e.g., replacing all unprintable characters with a
question mark @samp{?}).  Dired can do nothing if @samp{ls} suppresses
information about the filenames.  But some (System V derived) @samp{ls}
programs have a @samp{-b} switch to quote control characters, e.g.
@samp{\n} for a newline character, or @samp{\007} for a ASCII bell
character (@kbd{C-g}), so you might want to add @samp{b} to your
switches (see below).  Dired translates the quoted control character
escapes when a @samp{-b} switch was used.  The @samp{-b} switch is the
recommended method to cope with funny filenames containing newlines or
leading spaces.  But check if your @samp{ls} understands @samp{-b} and really
quotes newlines and spaces.  Dired is known to work with GNU @samp{ls
-b}, but other @samp{ls -b} don't quote spaces, so leading spaces still
don't work with these @samp{ls} programs.
@refill

The appearance of the listing is determined by the listing switches
used, for example whether you display or suppress @samp{.} files with
the @samp{-a} and @samp{-A} switches, use the @samp{-F} switch to tag
filenames etc.  It may additionally be restricted to certain files if you
used wildcards to display only those files matching a shell file
wildcard.@refill

@cindex Dired listing switches
Dired has commands that change the listing switches for this buffer.
They are mainly used to set the sort mode, but can also be used to
change other formatting options.  The buffer is automatically refreshed
after the switches are changed to let the new format take effect.

The default value for the switches comes from the variable
@code{dired-listing-switches}; a prefix argument to @code{dired} can be
use to determine the switches used for a specific buffer.
@xref{Entering Dired}.  Each Dired buffer has its own value for the
switches, stored in the variable @code{dired-actual-switches}.@refill
@vindex dired-actual-switches

@vindex dired-sort-by-name-regexp
@vindex dired-sort-by-date-regexp
The Dired modeline displays @samp{by name} or @samp{by date} to indicate
the sort mode.  It uses the regexps in the variables
@code{dired-sort-by-date-regexp} and @code{dired-sort-by-name-regexp} to
decide what should be displayed.  If neither of the regexps matches, the
listing switches are displayed literally.  You can use this to always
display the literal switches instead of @samp{by name} or @samp{by
date}: set them to a regexp that never matches any listing switches, for
example @samp{^$}.@refill

@vindex dired-ls-sorting-switches
Most @samp{ls} programs can only sort by name (without @samp{-t}) or by
date (with @samp{-t}), nothing else.  GNU @samp{ls} additionally sorts
on size with @samp{-S}, on extension with @samp{-X}, and unsorted (in
directory order) with @samp{-U}.  So anything that does not contain
these is sort "by name".  However, this is configurable in the variable
@code{dired-ls-sorting-switches}, which defaults to @code{"SXU"}.  It
contains a string of @samp{ls} switches (single letters) except @samp{t} that
influence sorting.  It is consulted at load time, so if you redefine it,
you must do it before Dired is loaded.@refill

@table @kbd

@item s
@kindex s
@findex dired-sort-toggle-or-edit
(@code{dired-sort-toggle-or-edit}) Toggle between sort by name/date and
refresh the dired buffer.  With a prefix argument you can edit the
current listing switches instead.

@end table

@cindex Refreshing a Dired listing
After some time the listing may become out of date because of actions by
other programs than Dired.  You can refresh the complete Dired buffer
from disk or only refresh the lines of certain files or a single file.

@table @kbd

@item l
@kindex l
@findex dired-do-redisplay
(@code{dired-do-redisplay}) Redisplay all marked (or, with a prefix
argument, the next @var{N}) files.  As always, if no files are marked,
the current file is used.

If on a headerline, redisplay that subdirectory.  In that case,
a prefix arg lets you edit the @samp{ls} switches used for the new listing.


@kindex g
@findex revert-buffer
@item g
(@code{revert-buffer}) The @kbd{g} command in Dired ultimately runs
@code{dired-revert} to reinitialize the buffer from the actual disk
directory (or directories).  All marks and flags in the Dired buffer are
restored, except of course for files that have vanished.  Hidden
subdirectories are hidden again.  @xref{Hiding Directories in Dired}.
@refill

@item k
@kindex k
@findex dired-kill-line-or-subdir
(@code{dired-kill-line-or-subdir}) Kill this line (but not this file).
Optional prefix argument is a repeat factor.
If file is displayed as expanded subdirectory, kill that as well.

If on a subdirectory line, kill that subdirectory.  Reinsert it with
@kbd{i} (@code{dired-maybe-insert-subdir}), @xref{Subdirectories in
Dired}.

Killing a file line means that the line is removed from the Dired
buffer.  The file is not touched, and the line will reappear when the
buffer is refreshed (using @kbd{g}, @code{revert-buffer}).  A killed
subdirectory will not reappear after reverting the buffer, since @kbd{g}
only list those subdirectories that were listed before.

@item M-k
@kindex M-k
@findex dired-do-kill
(@code{dired-do-kill}) Kill all marked lines (not files).  With a prefix
argument, kill all lines not marked or flagged.

(For file marking, @xref{Marking Files in Dired}.)

@item C-x u
@kindex C-x u
@item C-_
@kindex C-_
@findex dired-undo
(@code{dired-undo}) Undo in a Dired buffer.  This doesn't recover lost
files, it is just normal undo with a temporarily writable buffer.  You
can use it to recover marks, killed lines or subdirs.  In the latter
case, you have to do @kbd{M-x dired-build-subdir-alist} to parse the
buffer again for the new subdirectory list.@refill

@end table


@node Marking Files in Dired, Mark-using Commands, Listing Files in Dired, Dired
@section Marking Files in Dired

@noindent
This section describes commands to mark and unmark single files, and
commands to mark several files at once if they match certain criteria.
There also is a command to move to the next marked file.

As always, hidden subdirs are not affected.  @xref{Hiding Directories in
Dired}.

@table @kbd

@item m
@kindex m
@findex dired-mark-subdir-or-file
(@code{dired-mark-subdir-or-file}) If on a file line, mark the current
file.  A numeric argument tells how many next or previous files to mark.
If on a subdirectory header line, mark all its files except `.' and `..'.

@item u
@kindex u
@findex dired-unmark-subdir-or-file
(@code{dired-unmark-subdir-or-file}) Like @kbd{m}, only unmarking
instead of marking.

@item DEL
@kindex DEL
@findex dired-backup-unflag
(@code{dired-backup-unflag}) Move up lines and remove flags there.
Optional prefix argument says how many lines to unflag; default is one
line.

@item M-DEL
@kindex M-DEL
@findex dired-unflag-all-files
(@code{dired-unflag-all-files}) Remove a specific or all flags from
every file.  With an argument, queries for each marked file.  Type your
help character, usually
@kbd{C-h}, at that time for help.

@item *
@kindex *
@findex dired-mark-executables
(@code{dired-mark-executables}) Mark all executable files.  With prefix
argument, unflag all those files.

@item @@
@kindex @@
@findex dired-mark-symlinks
(@code{dired-mark-symlinks}) Mark all symbolic links.  With prefix
argument, unflag all those files.

@item /
@kindex /
@findex dired-mark-directories
(@code{dired-mark-directories}) Mark all directory files except `.' and
`..'.  With prefix argument, unflag all those files.

@item %m
@kindex %m
@findex dired-mark-files-regexp
(@code{dired-mark-files-regexp}) Mark all files matching @var{regexp}
for use in later commands.  A prefix argument means to unmark them
instead.  @file{.} and @file{..} are never marked.

The match is against the non-directory part of the filename.  Use
@samp{^} and @samp{$} to anchor matches.  Exclude subdirs by hiding
them.

This is an Emacs regexp, not a shell wildcard.	E.g., use @samp{\.o$}
for object files - just @samp{.o} will mark more than you might think.
By default, the match is case sensitive (just like filenames), since
@code{case-fold-search} is set to @code{nil} in Dired buffers.

@item M-@}
@kindex M-@}
@findex dired-next-marked-file
(@code{dired-next-marked-file}) Move to the next marked file, wrapping
around the end of the buffer.

@item M-@{
@kindex M-@{
@findex dired-prev-marked-file
(@code{dired-prev-marked-file}) Move to the previous marked file,
wrapping around the beginning of the buffer.

@end table

@node Mark-using Commands, Commands That Do Not Use Marks, Marking Files in Dired, Dired
@section Mark-using Commands

@cindex Mark-using commands
Most Dired commands operate on the ``marked'' files and default to the
current file.  They are the ``mark-using'' commands.  Deleting is the
only mark-using command that does not default to the current file.

@cindex Numeric argument to Dired's mark-using commands
@cindex Prefix argument to Dired's mark-using commands
@cindex Repeat count for Dired's mark-using commands
@cindex Mark-using commands, use of prefix argument as repeat count
Mark-using Dired commands treat a numeric argument as a repeat count,
meaning to act on the files of the next few lines instead of on the
marked files.  That is, when you give a prefix argument the marks are
not consulted at all.  A negative argument means to operate on the files
of the preceding lines.  Either set of files is called @dfn{marked
files} below, whether they really come from marks or from a prefix
argument.  The prompt of a mark-using command always makes clear which
set of files is operated upon: it mentions either the marker character
@samp{*} or the @samp{next @var{N}} files, where a negative @var{N}
really means the previous @var{-N} files.@refill

@cindex Prefix argument via digit keys
Thus you can use a prefix argument of @code{1} to apply a command to just the
current file, e.g, if you don't want to disturb the other files you
marked.  As digits are prefix arguments in Dired, simply type @kbd{1}
followed by the command.

Many mark-using commands treat a prefix of @var{N=0} specially, since it
would otherwise be a no-op.

@cindex Why something went wrong in Dired
@cindex Error logging in Dired
@kindex W
All mark-using commands display a list of files for which they failed.
Type @kbd{W} to see why a (mark-using or other) command failed.  Error
messages from shell commands (@samp{stderr}) cannot be redirected
separately and goes together with the usual output (@samp{stdout}).

@menu
* Copy and Move Into a Directory::  
* Renaming and More With Regexps::  
* Other File Creating Commands::  
* Deleting Files With Dired::	
* Dired Shell Commands::	
* Compressing and Uncompressing::  
* Changing File Attributes::	
* Loading and Byte-compiling Emacs Lisp Files::	 
* Printing the Marked Files::	
@end menu

@node Copy and Move Into a Directory, Renaming and More With Regexps, Mark-using Commands, Mark-using Commands
@subsection Copy, Move etc. Into a Directory

@cindex Target commands in Dired
@cindex Dired target commands
@noindent
This section explains commands that create a new file for each marked
file, for example by copying (@kbd{c}) or moving (@kbd{r}) files.  They
prompt in the minibuffer for a @var{target} argument, usually the target
directory in which the new files are created.  But if there is but one
marked file, the target may also be a plain file.  (Otherwise you could
not simply rename or copy a single file within the same directory.)
Even with one marked file the target may still be an (existing)
directory.

@cindex Target default in Dired
@cindex Default target in Dired
@vindex dired-dwim-target
The target prompt displays a @dfn{default target} that will be used if
you just type @kbd{RET}.  Normally the default target is the current
Dired directory, so if you want to copy into some specific subdirectory,
move point into that subdirectory before typing @kbd{c}.  But if there
is a Dired buffer in the next window, and @code{dired-dwim-target} is
true, its current Dired directory is used.  This makes it easy to copy
from one Dired buffer into another if both are displayed.  On the other
hand you have to use @kbd{C-x 1} to make other Dired buffers vanish if
you do not want to have them as default targets.  To make Dired never
look at the next window, set the variable @code{dired-dwim-target} to
nil (@samp{dwim} means Do What I Mean).  @xref{Dired User Options}, on
how to set cutomization variables.

@cindex Overwriting of files in Dired
As a general rule, Dired will not let you remove or overwrite a file
without explicit confirmation.  Dired asks you for each existing target
file whether or not to overwrite just this file (answer @kbd{y} or
@kbd{n}) or all remaining files (answer @kbd{!}).  You can also type
your help character, usually @kbd{C-h}, at that time for help.

@table @kbd
@findex dired-do-copy
@kindex c
@vindex dired-copy-preserve-time
@item c
(@code{dired-do-copy}) Copy the marked (or next @var{N}) files into a
directory, or copy a single file.

Thus, a zero prefix argument (@var{N-0}) copies nothing.  But it toggles
the variable @code{dired-copy-preserve-time}.@*
@xref{Dired User Options}, on how to set customization variables.

@findex dired-do-move
@kindex r
@item r
(@code{dired-do-move}) Move the marked files into a directory.  If
there is just one marked file, rename that file.  As the marked files
default to the current file, this can also be used to simply rename the
current file.

Dired silently changes the visited file name of buffers associated with
moved files so that they refer to the new location of the file.

When a directory is renamed, its headerlines in Dired buffers are
updated, and any buffers visiting affected files have their visited file
name changed to refer to the new location.  Their buffer name is changed
if no buffer with such a name already exists.  Affected files are all
those which contain the directory somewhere in their absolute path name.

A zero prefix arguments does not move any files, but toggles the
variable @code{dired-dwim-target}.

@findex dired-do-hardlink
@kindex H
@item H
(@code{dired-do-hardlink}) Make hard links from the target directory
to each marked file.
@findex dired-do-symlink
@kindex Y
@item Y
(@code{dired-do-symlink}) Make symbolic links from the target
directory to each marked file.
@end table

@vindex dired-keep-marker-copy
@vindex dired-keep-marker-hardlink
@vindex dired-keep-marker-symlink
Linking is very similar to copying in that new files are created while
the old files stay.  If you want each newly copied or linked file to be
marked with the same marker that its original has, set the variables
@code{dired-keep-marker-copy}, @code{dired-keep-marker-hardlink} or
@code{dired-keep-marker-symlink} to @code{t}.  Set them to @code{nil} to
not give these newly created files marks.  The default is to mark them
with @samp{C}, @samp{H} and @samp{Y}, respectively.

@vindex dired-keep-marker-move
Moving differs from copying and linking in that the old file is removed
as part of the creation of the new file.  Thus it makes sense to set the
variable @code{dired-keep-marker-move} to @code{t} (the default) so that
moved files ``take their markers with them''.

@node Renaming and More With Regexps, Other File Creating Commands, Copy and Move Into a Directory, Mark-using Commands
@subsection Renaming (and More) With Regexps

@cindex Regexp commands in Dired
@cindex Dired regexp commands
A second class of Commands uses regular expressions to construct a new
filename from each marked file. @xref{Regexps,Syntax of Regular
Expressions,Regular Expressions,emacs,The GNU Emacs Manual}.  The commands
to make new names by regexp conversion are the same as those to make
them in another directory, except that they share a prefix char, @kbd{%}.

@table @kbd

@item %r
@kindex %r
@findex dired-rename-regexp
(@code{dired-rename-regexp}) Rename files with regexps

@item %c
@kindex %c
@findex dired-do-copy-regexp
(@code{dired-do-copy-regexp})
Copy files with regexps.

@item %H
@kindex %H
@findex dired-do-hardlink-regexp
(@code{dired-do-hardlink-regexp})
Make hard links with regexps.

@item %Y
@kindex %Y
@findex dired-do-symlink-regexp
(@code{dired-do-symlink-regexp})
Make symbolic links with regexps.

@end table

These commands prompt in the minibuffer for a @var{regexp} and a
@var{newname}.  For each marked file matching @var{regexp}, a new
filename is constructed from @var{newname}.  The match can be anywhere
in the file name, it need not span the whole filename.  Use @samp{^} and
@samp{$} to anchor matches that should span the whole filename.  Only
the first match in the filename is replaced with @var{newtext}.  (It
would be easy to change this to replace all matches, but probably harder
to use.)

@samp{\&} in @var{newname} stands for the entire text being replaced.
@samp{\@var{d}} in @var{newname}, where @var{d} is a digit, stands for
whatever matched the @var{d}'th parenthesized grouping in @var{regexp}.
As each match is found, the user must type a character saying whether or
not to apply the command to just this file (@kbd{y} or @kbd{n}) or to
all remaining files(@kbd{!}).  For help type your help character,
usually @kbd{C-h}, at that time.@refill

For example, if you want to rename all @file{.lsp} files to @file{.el}
files, type first @kbd{%m} with @samp{\.lsp$} as regexp to mark all
@file{.lsp} files.  Then type @kbd{%r} with @samp{\.lsp$} and @samp{.el}
as @var{regexp} and @var{newtext} arguments.  Dired will prompt you for
each file to be renamed.

Or to append @file{.old} to all marked files, use @kbd{%r} @samp{$}
@kbd{RET} @samp{.old} @kbd{RET}, replacing the empty string at the end
of each file name with @samp{.old}.

You can use the regexp @samp{\(.+\)\.\(.+\)$} to make the
basename as @samp{\1} and the extension as @samp{\2} available in
@var{newtext}.

With a zero prefix arg, renaming by regexp affects the complete
pathname.  Usually only the non-directory part of file names is used and
changed, and renaming only takes place within the current directory.
The zero prefix argument can be used to change the directory part as
well.

Often you will want to apply the command to all files matching the same
@var{regexp} that you use in the command.  Simply use the @kbd{%m}
command with @var{regexp} as argument, which will then also be the
default for the next regexp using command.@refill For example, to remove
a @file{V17I12-} prefix from several filenames, use @kbd{%m}
@samp{^V17I12-} @kbd{RET} @kbd{%r} @kbd{RET} @kbd{RET}, in effect
replacing the prefix with the empy string.

@node Other File Creating Commands, Deleting Files With Dired, Renaming and More With Regexps, Mark-using Commands
@subsection Other File Creating Commands

@cindex Case-changing Dired commands
@cindex Dired case-changing commands
Commands to change the case of file names:

@table @kbd
@findex dired-upcase
@kindex %u
@item %u
(@code{dired-upcase}) Rename each marked file to upper case.
@findex dired-downcase
@kindex %l
@item %l
(@code{dired-downcase}) Rename each marked file to lower case.
@end table

@node Deleting Files With Dired, Dired Shell Commands, Other File Creating Commands, Mark-using Commands
@subsection Deleting Files With Dired

@noindent
Deleting is a special mark-using command.  It uses a special marker,
@samp{D}, and does not default to the current file if no files are
marked to prevent accidental deletions.@refill

@xref{Dired Customization}, variable @code{dired-del-marker} to make
deleting behave exactly like any mark-using command.@refill

@table @kbd

@findex dired-flag-file-deleted
@kindex d
@item d
(@code{dired-flag-file-deleted}) Flag this file for deletion.  If on a
subdirectory headerline, mark all its files except @file{.} and @file{..}.

@findex dired-unmark-subdir-or-file
@kindex u
@item u
(@code{dired-unmark-subdir-or-file}) Remove deletion-flag on this line.

@findex dired-backup-unflag
@kindex @key{DEL}
@item @key{DEL}
(@code{dired-backup-unflag}) Remove deletion-flag on previous line,
moving point to that line.

@findex dired-flag-regexp-files
@kindex %d
@item %d
(@code{dired-flag-regexp-files}) Flag all files containing the specified
@var{regexp} for deletion.

The match is against the non-directory part of the filename.  Use
@samp{^} and @samp{$} to anchor matches.  Exclude subdirs by hiding
them.

The special directories @file{.} and @file{..} are never flagged.

@findex dired-do-deletions
@kindex x
@item x
(@code{dired-do-deletions}) Delete the files that are flagged for
deletion (with @samp{D}).

@findex dired-do-delete
@kindex X
@item X
(@code{dired-do-delete}) Delete the @samp{*}-marked (as opposed to the
@samp{D}-flagged) files.

@findex dired-flag-auto-save-files
@kindex #
@item #
(@code{dired-flag-auto-save-files}) Flag all auto-save files (files
whose names start and end with @samp{#}) for deletion (@pxref{Auto
Save,Auto-Saving: Protection Against Disasters,Auto Save,emacs,The GNU Emacs
Manual}).

@findex dired-flag-backup-files
@kindex ~
@item ~
(@code{dired-flag-backup-files}) Flag all backup files (files whose
names end with @samp{~}) for deletion (@pxref{Backup,Backup
Files,Backup,emacs,The GNU Emacs Manual}).

@findex dired-clean-directory
@kindex .
@item .@: @r{(Period)}
(@code{dired-clean-directory}) Flag excess numeric backup files for
deletion.  The oldest and newest few backup files of any one file are
exempt; the middle ones are flagged.
@end table

You can flag a file for deletion by moving to the line describing the
file and typing @kbd{d} or @kbd{C-d}.  The deletion flag is visible as a
@samp{D} at the beginning of the line.  Point is moved to the beginning
of the next line, so that repeated @kbd{d} commands flag successive
files.

The files are flagged for deletion rather than deleted immediately to
avoid the danger of deleting a file accidentally.  Until you direct
Dired to delete the flagged files, you can remove deletion flags using
the commands @kbd{u} and @key{DEL}.  @kbd{u} works just like @kbd{d},
but removes flags rather than making flags.  @key{DEL} moves upward,
removing flags; it is like @kbd{u} with numeric argument automatically
negated.

To delete the flagged files, type @kbd{x}.  This command first displays
a list of all the file names flagged for deletion, and requests
confirmation with @kbd{yes}.  Once you confirm, all the flagged files
are deleted, and their lines are deleted from the text of the Dired
buffer.  The shortened Dired buffer remains selected.  If you answer
@kbd{no} or quit with @kbd{C-g}, you return immediately to Dired, with
the deletion flags still present and no files actually deleted.

Deletions proceed from the end of the buffer, so if subdirs are in a
natural order in the buffer, it usually works to flag @samp{dir1},
@samp{dir1/dir2} and @samp{dir1/dir2/*} (by typing @kbd{d} on the
directory headerlines) and delete everything, including @samp{dir1/dir2}
and @samp{dir1}.  Using shell commands (e.g.  @samp{rm -rf}) to remove
complete directories may be quicker than having Dired remove each file
separately. (@xref{Dired Shell Commands}.)  However, like all actions
external to Dired, this does not update the display.@refill
@c and does not offer to kill buffers of deleted files.

The @kbd{#}, @kbd{~} and @kbd{.} commands flag many files for deletion,
based on their names.  These commands are useful precisely because they
do not actually delete any files; you can remove the deletion flags from
any flagged files that you really wish to keep.@refill

@kbd{#} flags for deletion all files that appear to have been made by
auto-saving (that is, files whose names begin and end with @samp{#}).
@kbd{~} flags for deletion all files that appear to have been made as
backups for files that were edited (that is, files whose names end with
@samp{~}).

@vindex dired-kept-versions
@kbd{.} (Period) flags just some of the backup files for deletion: only
numeric backups that are not among the oldest few nor the newest few
backups of any one file.  Normally @code{dired-kept-versions} (not
@code{kept-new-versions}; that applies only when saving) specifies the
number of newest versions of each file to keep, and
@code{kept-old-versions} specifies the number of oldest versions to
keep.  Period with a positive numeric argument, as in @kbd{C-u 3 .},
specifies the number of newest versions to keep, overriding
@code{dired-kept-versions}.  A negative numeric argument overrides
@code{kept-old-versions}, using minus the value of the argument to
specify the number of oldest versions of each file to keep.@refill

@node Dired Shell Commands, Compressing and Uncompressing, Deleting Files With Dired, Mark-using Commands
@subsection Shell Commands on Marked files

@cindex Shell commands (in Dired)
@noindent
You can run arbitrary shell commands on the marked files. If there is
output, it goes to a separate buffer.

@table @kbd

@findex dired-do-shell-command
@kindex !
@item !
(@code{dired-do-shell-command}) Run a shell command on the marked
files.

@end table

A command string is prompted for in the minibuffer.  The list of marked
files is appended to the command string unless asterisks @samp{*}
indicate the place(s) where the list should go.  Thus,@refill

@example
command -flags
@end example

is equivalent to

@example
command -flags *
@end example

The filenames are inserted in the order they appear in the buffer.  The
file listed topmost in the buffer will be the leftmost in the list.

Currently, there is no way to insert a real @samp{*} into the command.

As with all mark-using commands, if no files are marked or a specific
numeric prefix arg is given, the current or the next @var{N} files are
used.  The prompt mentions the file(s) or the marker, as appropriate.

However, for shell commands, a zero argument is special. It means to run
command on each marked file separately:

@example
cmd * |foo
@end example

results in

@example
cmd F1 |foo; @dots{}; cmd F@var{n} |foo
@end example

Usually 

@example
cmd F1 @dots{} F@var{n} |foo 
@end example

would be executed.@refill

No automatic redisplay is attempted because Dired cannot know what files
should be redisplayed for a general shell command.  For example, a
@samp{tar cvf} will not change the marked files at all, but rather
create a new file, while a @samp{ci -u -m'@dots{}' *} will probably change
the permission bits of all marked files.

Type @kbd{l} to redisplay just the marked files, or @kbd{l} on a
directory headerline to redisplay just that directory, or @kbd{g} to
redisplay all directories.@refill

The shell command has the top level directory as working directory, so
output files usually are created there instead of in a subdirectory,
which may sometimes be surprising if all files come from the same
subdirectory.  Just remember that an Emacs buffer can have but one
working directory, and this is the top level directory in Dired
buffers.

Examples for shell commands:

@itemize @bullet

@item
Type @kbd{!} and

@example
tar cvf foo.tar
@end example

@noindent
to tar all marked files into a @file{foo.tar} file.  Dired does not know
that a new file has been created and you have to type @kbd{g} to refresh
the listing.  If you have several subdirectories in your Dired buffer,
the names given to @samp{tar} will be relative to the top level
directory, and the output file @file{foo.tar} will also be created
there.@refill

You can use

@example
tar cvf - * | compress -c > foo.tar.Z
@end example

@noindent
as an alternative to immediately compress the tar file.

@item
Type @kbd{0 !} and

@example
uudecode
@end example

@noindent
to uudecode each of the marked files.  Note the use of the zero prefix
argument to apply the shell command to each file separately (uudecode
doesn't accept a list of input files).  Type @kbd{g} afterwards to see
the created files.

@item
Type @kbd{0 !} and

@example
uuencode * * >*.uu
@end example

@noindent
to uuencode each of the marked files, writing into a corresponding
@file{.uu} file.  Note the use of the zero prefix argument to apply the
shell command to each file separately.  Type @kbd{g} afterwards to see
the created @file{.uu} files.

@item
Type @kbd{1 !} and

@example
mail joe@@somewhere <*
@end example

@noindent
to mail the current file (note the prefix argument @samp{1}) to user
@samp{joe@@somewhere}.@refill

@item
@cindex running the current file
@cindex executing the current file
@cindex current file, how to run it
Here is a Dired shell command to execute the current file, assuming no
other files are marked (else just give the prefix @kbd{1} to @kbd{!}):
@example
./*
@end example
which will be expanded to @samp{./@var{cmd}}, thus @var{cmd} will be
executed..  (Just @samp{./} would be expanded to @samp{./ @var{cmd}},
with an intervening @kbd{SPC}.)  This will work even if you don't have
@file{.} in your @code{$PATH}.  If @file{.} is in your path (not a good
idea, as you will find out if you dired a directory containing a file
named @file{ls}), a single @kbd{SPC} as command would also work.

@c <<NEED MORE AND BETTER EXAMPLES HERE>>
@end itemize

@node  Compressing and Uncompressing, Changing File Attributes, Dired Shell Commands, Mark-using Commands
@subsection Compressing and Uncompressing

@noindent
You can compress or uncompress the marked files.  Dired refuses to
compress files ending in @file{.Z} (which are already compressed) or
symbolic links (the link would be overwritten by a plain, compressed
file) and to uncompress files not ending in @file{.Z}.

@table @kbd

@findex dired-do-compress
@kindex C
@item C
(@code{dired-do-compress}) Compress the marked files.

@findex dired-do-uncompress
@kindex U
@item U
(@code{dired-do-uncompress}) Uncompress the marked files.
@end table

@node Changing File Attributes, Loading and Byte-compiling Emacs Lisp Files, Compressing and Uncompressing, Mark-using Commands
@subsection Changing File Attributes

@noindent
You can change the file attributes (mode, group, owner) of marked files.

@table @kbd

@findex dired-do-chmod
@kindex M
@item M
(@code{dired-do-chmod}) Change the mode (also called ``permission
bits'') of the marked files.  This calls the @samp{chmod} program, thus
symbolic modes like @samp{g+w} are allowed.

Multiple switches like @samp{-fR g+w} are not understood, though.  Use
@kbd{!} (@code{dired-do-shell-command}) for that.

@findex dired-do-chgrp
@kindex G
@item G
(@code{dired-do-chgrp}) Change the group of the marked files.

@vindex dired-chown-program
@findex dired-do-chown
@kindex O
@item O
(@code{dired-do-chown}) Change the owner of the marked files.  This
usually works for the superuser only.  It uses the program in the
variable @code{dired-chown-program} to do the change.@refill
@end table

@node Loading and Byte-compiling Emacs Lisp Files, Printing the Marked Files, Changing File Attributes, Mark-using Commands
@subsection Loading and Byte-compiling Emacs Lisp Files

@noindent
You can load and byte-compile GNU Emacs Lisp files.  Errors are caught and
reported after all files have been processed.

@table @kbd

@findex dired-do-load
@kindex L
@item L
(@code{dired-do-load}) Load the marked elisp files.

@findex dired-do-byte-compile
@kindex B
@item B
(@code{dired-do-byte-compile}) Byte compile the marked elisp files.
@end table

@node  Printing the Marked Files,  , Loading and Byte-compiling Emacs Lisp Files, Mark-using Commands
@subsection Printing the Marked Files

@table @kbd
@findex dired-do-print
@kindex P
@vindex lpr-command
@vindex lpr-switches
@item P
(@code{dired-do-print}) Print the marked (or next @var{N}) files.
Uses the shell command coming from variables @code{lpr-command} and
@code{lpr-switches} as default.

Since internally this is just a special case of
@code{dired-do-shell-command}, you can use @samp{*} and pipes like for
shell command, e.g.,
@example
(setq lpr-command: "lwf")
(setq lpr-switches: '("-l -m * | lpr -Palw"))
@end example
to print with the shell command @samp{lwf -l -m * | lpr -Palw}, where
@samp{*} will be substituted by the marked files.  The @code{lpr-buffer}
and @code{lpr-region} don't know about @samp{*} or @samp{|}, though, only
Dired does.
@end table

@node Commands That Do Not Use Marks, Subdirectories in Dired, Mark-using Commands, Dired
@section Commands That Do Not Use Marks

@noindent
These are commands that visit files.
@xref{Visiting,Visiting Files,Visiting,emacs,The GNU Emacs Manual}.

@table @kbd

@findex dired-advertised-find-file
@kindex f
@item f
(@code{dired-advertised-find-file}) Visits the file described on the
current line.  It is just like typing @kbd{C-x C-f} and supplying that
file name.  If the file on this line is a subdirectory, @kbd{f} actually
causes Dired to be invoked on that subdirectory.

@findex dired-find-file-other-window
@kindex o
@item o
(@code{dired-find-file-other-window}) Like @kbd{f}, but uses another
window to display the file's buffer.  The Dired buffer remains visible
in the first window.  This is like using @kbd{C-x 4 C-f} to visit the
file.  @xref{Windows,Multiple Windows,Windows,emacs,The GNU Emacs Manual}.

@findex dired-view-file
@kindex v
@item v
(@code{dired-view-file}) Views the file described on this line using
@kbd{M-x view-file}.  Viewing a file is like visiting it, but is slanted
toward moving around in the file conveniently and does not allow
changing the file.  @xref{Misc File Ops,View File,Miscellaneous File
Operations,emacs,The GNU Emacs Manual}.  @refill Viewing a file that is a
directory goes to its headerline if it is in this buffer.  Otherwise, it
is displayed in another buffer.

@c Forgot that this only works for my version of C-x C-r...
@c 
@c You might think that a @code{dired-view-file-other-window} command is
@c missing, but it is easy to use @kbd{o} followed by @kbd{C-x C-r}
@c @kbd{RET}, which will first visit the file in the other window, then
@c @samp{find-file-read-only} it (@kbd{RET} defaulting to the current
@c buffer's file).

@end table

@cindex Diffing files in Dired
@noindent
Commands to diff a file:

@table @kbd

@findex dired-diff
@kindex D
@item D
(@code{dired-diff}) Compare file at point with another file (default:
file at mark), by running the system command @samp{diff}.  The other
file is the first file given to @samp{diff}.

@findex dired-backup-diff
@kindex M-~
@item M-~
(@code{dired-backup-diff}) Diff this file with its backup file.  Uses
the latest backup, if there are several numerical backups.  If this file
is a backup, diff it with its original.  The backup file is the first
file given to @samp{diff}.
@end table

@noindent
Other commands:

@table @kbd
@findex dired-create-directory
@kindex +
@cindex Creating a directory in Dired
@cindex Directory, how to create one in Dired
@item +
(@code{dired-create-directory}) Create a directory.
@end table

@table @kbd
@findex dired-why
@kindex W
@cindex Why something went wrong in Dired
@cindex Error logging in Dired
@item W
(@code{dired-why}) Pop up a buffer with error log output from Dired.
All mark-using commands log errors there.  (Standard error from shell
commands cannot be logged separately, it goes into the usual shell
command output buffer.)  A group of errors from a single command ends
with a formfeed, so that you can use @kbd{C-x [} (@code{backward-page})
to find the beginning of new error logs that are reported by a command.

@end table

@node   Subdirectories in Dired, Hiding Directories in Dired, Commands That Do Not Use Marks, Dired
@section Subdirectories in Dired

@noindent
Thise section explains how to @dfn{insert} (or @dfn{expand})
subdirectories in the same Dired buffer and move around in them.
@cindex Inserting subdirectories in same Dired buffer
@cindex Expanding subdirectories in Dired

You can display subdirectories in your Dired buffer by using @samp{-R}
in your Dired listing switches.  But you do not usually want to have a
complete recursive listing in all your Dired buffers.  So there is a
command to insert a single directory:

@table @kbd

@findex dired-maybe-insert-subdir
@kindex i
@item i
@cindex Inserted subdirectory
@cindex Expanded subdirectory
@cindex In-situ subdirectory
@cindex Headerline
(@code{dired-maybe-insert-subdir}) Insert this subdirectory into the
same Dired buffer.  If it is already present, just move to it (type
@kbd{l}, @code{dired-do-redisplay} to refresh it).  Else inserts it as
@samp{ls -lR} would have done.  With a prefix arg, you may edit the ls
switches used for this listing.  You can add @samp{R} to the switches to
expand the whole tree starting at this subdirectory.  This function
takes some pains to conform to @samp{ls -lR} output.  For example, it adds the
headerline for the inserted subdirectory.@refill

The mark is dropped before moving, so @kbd{C-x C-x} takes you back to
the old position in the buffer.

@end table

Dired changes the buffer-local value of the variable
@code{page-delimiter} to @code{"\n\n"}, so that subdirectories become
pages.  Thus, the page moving commands @kbd{C-x [} and @kbd{C-x ]}
(@code{backward-page} and @code{forward-page}) can be used to move to
the beginning (i.e., the headerlines) of subdirectories.

In addition, the following commands move around directory-wise, usually
putting you on a file line instead of on a headerline.  For a mnemonic,
note that they all look like rotated versions of each other, and that
they move in the direction they point to.

@table @kbd

@findex dired-prev-dirline
@kindex <
@item <
(@code{dired-prev-dirline}) Goto previous directory file line.

@findex dired-next-dirline
@kindex >
@item >
(@code{dired-next-dirline}) Goto next directory file line.

@findex dired-up-directory
@kindex ^
@item ^
(@code{dired-up-directory}) Dired parent directory.  Tries first to find
its file line, then its header line in this buffer, then its Dired
buffer, finally creating a new Dired buffer if necessary.

@findex dired-view-file
@kindex v
@item v
(@code{dired-view-file}) When the current file is not a directory, view
it.  When file is a directory, tries to go to its subdirectory.

@comment actually, it is not always inverse
This command is inverse to the @kbd{^} command and it is very convenient
to use these two commands together.

@end table

The following commands move up and down in the directory tree:

@table @kbd

@findex dired-tree-up
@kindex M-C-u
@item M-C-u
(@code{dired-tree-up}) Go up to the parent directory's headerline.

@findex dired-tree-down
@kindex M-C-d
@item M-C-d
(@code{dired-tree-down}) Go down in the tree, to the first
subdirectory's headerline.

@end table

The following commands move forwards and backwards to subdirectory headerlines:

@table @kbd

@findex dired-next-subdir
@kindex M-C-n
@item M-C-n
(@code{dired-next-subdir}) Go to next subdirectory headerline,
regardless of level.

@findex dired-prev-subdir
@kindex M-C-p
@item M-C-p
(@code{dired-prev-subdir}) Go to previous subdirectory headerline,
regardless of level.

@end table

@node Hiding Directories in Dired, Acknowledgement, Subdirectories in Dired, Dired
@section Hiding Directories in Dired

@cindex Hiding in Dired
@noindent
@dfn{Hiding} a subdirectory means to make it invisible, except for its
headerline.  Files inside a hidden subdirectory are never considered by
Dired.  For example, mark-using commands will not ``see'' files in a
hidden directory.  Thus you can use hiding to temporarily exclude
subdirectories from operations without having to remove the markers.

The hiding commands toggle, that is they unhide what was hidden and vice
versa.

@table @kbd

@findex dired-hide-subdir
@kindex $
@item $
(@code{dired-hide-subdir}) Hide or unhide the current subdirectory and
move to next directory.  Optional prefix argument is a repeat factor.

@findex dired-hide-all
@kindex =
@item =
(@code{dired-hide-all}) Hide all subdirectories, leaving only their
header lines.  If there is already something hidden, make everything
visible again.  Use this command to get an overview in very deep
directory trees or to move quickly to subdirs far away.
@end table

@node Acknowledgement, Dired Customization, Hiding Directories in Dired, Dired
@section Acknowledgement

@noindent
I would like to thank

@itemize @bullet
@item
Richard Stallman for providing a pre-release version of @file{dired.el}
from Emacs 19, critical comments and many helpful suggestions
@item
Andy Norman for the collaboration that made Tree Dired and ange-ftp such
a successful combination
@item
Jamie Zawinski for insisting on and writing nested Dired format, and for
lots of other things
@item
Michael Ernst for the ``omitting'' code and helpful discussion about
Dired design
@item
Hans Chalupsky for providing FTP service and writing
@file{dired-trns.el}
@item
Roland McGrath for @file{find-dired.el} and bug fixes for the diffing
commands
@item
Kevin Gallagher for sending me existing VMS Dired fixes
@item
Hal R. Brand for VMS support and porting his old dired fixes to Tree
Dired
@item
Hugh Secker-Walker for writing @file{dired-cd.el}
@item
Tom Wurgler for ideas such as the @dfn{dired-jump-back} command
@item
Cengiz Alaettinoglu, who found more bugs in Tree Dired than anybody else
(except me)
@end itemize
@noindent
and all other beta testers and people who reported bugs or just said
``thanks''.

@node Dired Customization,  , Acknowledgement, Dired
@section Dired Customization

@noindent
You can customize Dired by setting some variables in your @file{~/.emacs}
file.  Other variables are intended to be configured when Dired is
installed.  Finally, there are so-called `hook' variables.

@menu
* Dired User Options::		
* Dired Configuration::		
* Dired Hooks::			
@end menu

@node Dired User Options, Dired Configuration, Dired Customization, Dired Customization
@subsection Customization of Dired

@noindent
The following variables are for personal customization in your
@file{~/.emacs} file.  For example, include a line similar to the
following

@example
(setq dired-listing-switches "-Alt")  ; sort on time, ignore . and ..
@end example

to set your favorite Dired listing switches.

@c Should actually use @defopt here, but this is in Texinfo2 only.

@table @code

@vindex dired-listing-switches
@item dired-listing-switches

Default: @code{"-al"}

Switches passed to @samp{ls} for Dired. @i{Must} contain the @samp{l} option.

@vindex dired-trivial-filenames
@item dired-trivial-filenames

Default: @code{"^\\.\\.?$\\|^#"}

Regexp of files to skip when moving point to the first file of a new
directory listing.  Nil means move to the subdirectory line, t means move to
first file.

@vindex dired-marker-char
@item dired-marker-char

Default: @code{?*} (@samp{?*} is the Lisp notation for the character
@samp{*}.)

In Dired, character used to mark files for later commands.

This is a variable so that one can write things like

@example
(let ((dired-marker-char ?X))
   ;; great code using X markers ...
   )
@end example

@vindex dired-del-marker
@item dired-del-marker

Default: @code{?D}

Character used to flag files for deletion.

Usually, marking for commands and flagging for deletion are separate
features.  (Internally they use the same marking mechanism.)  You type
@kbd{d} to flag with @samp{D} and @kbd{x} to delete the @samp{D}-flagged
files.@refill

This explains how to make deletion behave just like a special case of
the general file marking feature, so that you type @kbd{m} to mark with
@samp{*} (as usual) and @kbd{d} to delete the @samp{*} (or next @var{N})
files: In your @file{~/.emacs}, include

@example
(setq dired-del-marker dired-marker-char) ; use * also for deletions
(setq dired-load-hook
      (function
       (lambda ()
         ;; other customizations here
         ;; let "d" do the actual deletion:
         (define-key dired-mode-map "d" 'dired-do-delete))))
@end example

If you do not like that @kbd{d} defaults to the current file if there
are no marks, replace the @code{define-key} statement in
@code{dired-load-hook} above with this one:

@example
    (define-key dired-mode-map "d" 'dired-do-deletions)
@end example

@vindex dired-shrink-to-fit
@item dired-shrink-to-fit

Default: @code{(if (fboundp 'baud-rate) (> (baud-rate) search-slow-speed) t)}

Whether Dired shrinks the display buffer to fit the marked files.

@vindex dired-no-confirm
@item dired-no-confirm

Default: @code{nil}

If non-nil, list of commands Dired should not confirm.  Confirmation for
commands that require an argument to be entered (like the shell command
for @kbd{!}) means a list of marked files is displayed in a pop-up
buffer.  Confirmation for commands that do not require an argument (like
compressing with @kbd{C}) means you have to confirm by typing @kbd{y} or
@kbd{SPC}.

Except @code{nil}, it can be a sublist of

@example
'(byte-compile chgrp chmod chown compress copy delete hardlink load
  move print shell symlink uncompress)
@end example

to suppress confirmation for just those commands.

@c @vindex dired-deletion-confirmer
@c But you can
@c set the variable @code{dired-deletion-confirmer} to another function
@c than @code{yes-or-no-p}, its default value.  Using @code{y-or-no-p} will
@c confirm with only a single key stroke, @key{y} or @key{n}, and using
@c @code{identity} will effectively switch off confirmation.

@vindex dired-keep-marker-move
@item dired-keep-marker-move

Default: @code{t}

If nil, moved files are not marked.

If t, moved marked files are marked with the same marker they had before
(maybe none if you used the prefix argument to specify the next @var{N}
files).

If a character, moved files (marked or not) are marked with that
character.

This also applies to the following, similar variables for copied, and
hard or symbolically linked files:

@vindex dired-keep-marker-copy
@item dired-keep-marker-copy

Default: @code{?C}

@vindex dired-keep-marker-hardlink
@item dired-keep-marker-hardlink

Default: @code{?H}

@vindex dired-keep-marker-symlink
@item dired-keep-marker-symlink

Default: @code{?Y}

@vindex dired-dwim-target
@item dired-dwim-target

Default: @code{nil}

If non-nil, Dired tries to guess a default target directory: If there is
a Dired buffer displayed in the next window, use its current subdirectory,
instead of the current subdirectory of this Dired buffer.

The target is used in the prompt for file copy, move etc.,
@xref{Copy and Move Into a Directory}.

@item dired-copy-preserve-time
@vindex dired-copy-preserve-time

Default: @code{nil}

If non-nil, Dired preserves the last-modified time in a file copy.
(This works on only some systems.)  Use @kbd{c} (@code{dired-do-copy})
with a zero prefix argument to toggle its value.  The prompt of copy
commands will display @samp{Copy [-p]} instead of just @samp{Copy} if
preservation of file times is turned on.

@item dired-backup-if-overwrite
@vindex dired-backup-if-overwrite

Default: @code{nil}

Non-nil if Dired should ask about making backups before overwriting files.
Special value @code{'always} suppresses confirmation.

@end table

@node Dired Configuration, Dired Hooks, Dired User Options, Dired Customization
@subsection Dired Configuration

The following variables should have already been installed correctly by
your system manager.  If not, you can still set them in your
@file{~/.emacs} file.@refill

@table @code

@vindex dired-chown-program
@item dired-chown-program
Pathname of chown command, default @code{"chown"} (or
@code{"/etc/chown"} on System V derived systems.)

@vindex dired-ls-program
@item dired-ls-program
Absolute or relative name of the @samp{ls} program used by Dired,
default @code{"ls"}.

@vindex dired-ls-F-marks-symlinks
@item dired-ls-F-marks-symlinks
Set this to @code{t} if dired-ls-program with @samp{-lF} marks the
symbolic link itself with a trailing @samp{@@} (usually the case under
Ultrix).

Example: If

@example
ln -s foo bar; ls -F bar
@end example

gives

@example
bar -> foo
@end example

set it to @code{nil}, if it gives

@example
bar@@ -> foo
@end example

set it to @code{t}.

Dired checks if there is really a @@ appended.  Thus, if you have a
marking @samp{ls} program on one host and a non-marking one on another
host, and do not care about symbolic links which really end in a @@, you
can always set this variable to @code{t}.

@end table


@node Dired Hooks,  , Dired Configuration, Dired Customization
@subsection Dired Hooks

@noindent
Hook variables can contain functions that are run at certain times in
Dired.

@table @code

@vindex dired-load-hook
@item dired-load-hook

Run after loading Dired.  You can customize key bindings or load
extensions with this.  For example:

@example
(setq dired-load-hook
      (function
       (lambda ()
        ;; Load extras:
        (load "dired-x")
        ;; How to define your own key bindings:
        (define-key dired-mode-map " " 'scroll-up)
        (define-key dired-mode-map "b" 'scroll-down))))
@end example

@vindex dired-mode-hook
@item dired-mode-hook

Run at the very end of @code{dired-mode}, after most buffer local
variables have been initialized (e.g., @code{default-directory} and
@code{dired-directory}), but before the directory listing has been read
in.

Do buffer local things here, for example:

@example
(setq dired-mode-hook
      (function
       (lambda ()
         (dired-extra-startup)	 ;; dired-extra support
         ;; How to set (local) variables in each new Dired buffer:
         (setq case-fold-search t)
         (setq truncate-lines t))))
@end example

Since the listing has not yet been inserted you could still change
@code{dired-actual-switches}.  For example, if you use
@file{ange-ftp.el}, you might want to replace the @samp{-A} with the
@samp{-a} switch, depending on whether @code{default-directory}
corresponds to a System V hosts that does not understand all BSD
@samp{ls} switches.  The @code{dired.README} file gives an example.  If
you set @code{dired-actual-switches} remember that you may also have to
set @code{dired-sort-mode} to the appropriate string so that the
modeline looks right.

Do not set @code{dired-mode-hook} inside your @code{dired-load-hook},
simply set it somewhere in your @file{~/.emacs} (before Dired is loaded,
if you explicitly load Dired).  This is so that extensions packages
loaded via the load hook can add things to the @code{dired-mode-hook} at
the front or at the end, as they see fit.

In case you set @code{truncate-lines} to @code{t} as in the above
example, here is a function to toggle the value of
@code{truncate-lines}, in Dired and other buffers:
@example
(defun set-truncate-lines ()
  "Toggle value of truncate-lines and refresh window display."
  (interactive)
  (setq truncate-lines (not truncate-lines))
  ;; now refresh window display (an idiom from simple.el):
  (save-excursion
    (set-window-start (selected-window)
                      (window-start (selected-window)))))
@end example
You could bind it to @kbd{C-x 4 $}:
@example
(define-key ctl-x-4-map "$" 'set-truncate-lines)
@end example
It is sometimes useful to toggle @code{truncate-lines} in Dired buffers
to make long filenames completely visible and get the listing properly
aligned again.

@vindex dired-before-readin-hook
@item dired-before-readin-hook
This hook is run before a dired buffer is newly read in (created or reverted).

@vindex dired-after-readin-hook
@item dired-after-readin-hook

After each listing of a file or directory, this hook is run with the
buffer narrowed to the listing.

The @code{dired-subdir-alist} has already been updated so that the usual
Dired functions like @code{dired-get-filename} work.  It is possible to
modify the buffer with this hook.  The package @file{dired-x.el} does
this to implement omitting certain uninteresting files from a Dired
buffer.  Under X11, highlighting of certain files is also possible (see
package @file{dired-x11.el}).

@end table

@node Tree Dired Extra, Dired Internals, Dired, Top
@chapter Tree Dired Extra features

Numerous ``extra'' features are available, such as omitting certain
files from listings, minibuffer history, RCS related commands, and more.

@menu
* Tree Dired Extra Features::	
* Dired Minibuffer History::	
* Inserting All Marked Subdirectories::	 
* Dynamic Dired Markers::	
* Omitting Files in Dired::	
* Advanced Dired Mark Commands::  
* Virtual Dired::		
* Multiple Dired Directories::	
* Dired Local Variables::	
* Making Relative Symbolic Links in Dired::  
* Letting Dired Guess What Shell Command to Apply::  
* dired-trns.el::		Filename Transformers for Dired Shell Commands
* dired-cd.el::			Changing the Working Directory for Dired Shell Commands
* dired-nstd.el::		Nested Dired format
* find-dired.el::		Feeding Find Output to Dired
@end menu

@node Tree Dired Extra Features, Dired Minibuffer History, Tree Dired Extra, Tree Dired Extra
@section Tree Dired Extra Features

The rest of this manual describes the extra features provided by the
file @file{dired-x.el} and some other files.

To take advantage of these features, you must load the file and set some
variables and hooks.  See the accompanying @file{dired-x.README}
file for details and a template of code to insert in your @file{.emacs}.

Miscellanous features not fitting anywhere else:

Variables:

@table @code

@item dired-find-subdir
@vindex dired-find-subdir
Default: @code{nil}

If non-nil, Dired does not make a new buffer for a directory if it
can be found (perhaps as subdirectory) in some existing Dired buffer.

If there are several Dired buffers for a directory, the most recently
used is chosen.

Dired avoids switching to the current buffer, so that if you have a
normal and a wildcard buffer for the same directory, @kbd{C-x d RET}
will toggle between those two.

@end table

@table @kbd

@findex dired-goto-file
@kindex M-g
@item M-g
(@code{dired-goto-file}) Goto file line of a file (or directory).

@findex dired-goto-subdir
@kindex M-G
@item M-G
(@code{dired-goto-subdir}) Goto headerline of an inserted directory.
This commands reads its argument with completion over the names of the
inserted subdirectories.
@end table

@table @kbd

@findex dired-do-background-shell-command
@kindex &
@cindex Input to Dired shell commands 
@cindex Interactive Dired shell commands
@cindex Background Dired shell commands
@item &
(@code{dired-do-background-shell-command}) Run a shell command on the
marked files, in the background.  This requires @file{background.el}
from Olin Shiver's comint package to work.  Note that you can type input
to the command in its buffer.

@item w
@kindex w
@findex dired-copy-filename-as-kill
(@code{dired-copy-filename-as-kill}) The @kbd{w} command puts the names
of the marked (or next @var{N}) files into the kill ring, as if you had
killed them with @kbd{C-w}.  With a zero prefix argument @var{N}=0, use the
complete pathname of each file.  With a raw (just @kbd{C-u}) prefix argument,
use the relative pathname of each marked file.  As a special case, if no
prefix argument is given and point is on a directory headerline, it
gives you the name of that directory, without looking for marked files.

@vindex dired-marked-files
The list of names is also stored onto the variable @code{dired-marked-files}
for use, e.g., in an @kbd{ESC ESC} (@code{eval-expression}) command.

As this command also displays what was pushed onto the kill ring you can
use it to display the list of currently marked files in the
echo area (unless you happen to be on a subdirectory headerline).

You can then feed the file name to other Emacs commands with @kbd{C-y}.
For example, say you want to rename a long filename to a slightly
different name.  First type @kbd{w} to push the old name onto the kill
ring.  Then type @kbd{r} to rename it and use @kbd{C-y} inside @kbd{r}'s
minibuffer prompt to insert the old name at a convenient place.

@item T
@kindex T
@findex dired-do-toggle
(@code{dired-do-toggle}) Toggle marks.  That is, currently marked
files become unmarked and vice versa.  Files marked with other flags
(such as `D') are not affected.  The special directories `.' and `..'
are never toggled.

@end table

@node Dired Minibuffer History, Inserting All Marked Subdirectories, Tree Dired Extra Features, Tree Dired Extra
@section Minibuffer History for Dired Shell Commands

@cindex History of Minibuffer input
@cindex Minibuffer History
@cindex Gmhist
@kindex !
@kindex &
@kindex M-p
@kindex M-n
If @file{dired-x.el} determines at load-time that the Gmhist package is
available, the Dired shell commands @kbd{!} and @kbd{&} maintain a
history of commands.  Use @kbd{M-p} and @kbd{M-n} to scroll through them
while you are prompted in the minibuffer for a shell command.
@xref{Gmhist Keys in the Minibuffer,Gmhist Keys in the Minibuffer,Gmhist
Keys in the Minibuffer,gmhist,The Gmhist Manual}, for more info.

Gmhist also handles defaults:

@table @code

@vindex dired-dangerous-shell-command
@item dired-dangerous-shell-command
Default: @code{"rm"}

Regexp for dangerous shell commands that should never be the default.
It is deliberately chosen to match @samp{rm} anywhere in the command,
e.g. in @samp{rmdir}.
@end table

@node Inserting All Marked Subdirectories, Dynamic Dired Markers, Dired Minibuffer History, Tree Dired Extra
@section Insert all marked subdirectories

@table @kbd

@kindex I
@findex dired-do-insert-subdir
@item I
(@code{dired-do-insert-subdir}) Insert all marked subdirectories that
are not already inserted.  Non-directories are silently ignored.

Thus type @kbd{/I} to insert one more level of subdirectories.  You can
repeat this until no new directories are inserted to fully expand the
directory tree in this buffer.  As a faster alternative, use the prefix
argument for @kbd{C-x d} (@code{dired}) to add @samp{R} to the switches.

@end table

@node Dynamic Dired Markers, Omitting Files in Dired, Inserting All Marked Subdirectories, Tree Dired Extra
@section Dynamic Marker Characters

@cindex Dynamic marker characters
@cindex Marker characters in Dired, changing them
@cindex Changing marker character in Dired
@cindex Stack of marker characters in Dired
You can change the marker character from its usual value @code{*} to
something else.  Use this to mark a different set of files while keeping
the information on the already marked files.  You can nest several
marker characters.  The current stack of marker characters is displayed
in the Dired mode line, and all prompts of mark-using commands mention
to which marker they apply.

@table @kbd

@item (
@kindex (
@findex dired-set-marker-char
(@code{dired-set-marker-char}) Set the marker character to something
else.  Use @kbd{)} to restore the previous value.

@item )
@kindex )
@findex dired-restore-marker-char
(@code{dired-restore-marker-char}) Restore the marker character to its
previous value.  Uses @code{dired-default-marker} if the marker stack is
empty.
@end table

@kindex A
@kindex Z
@kindex m
@kindex (
Instead of using @kbd{m} inside a @kbd{(}@dots{}@kbd{)}, you can mark
files ``in passing'' with, say @samp{Z} without changing the
current marker character.  You will probably later use @kbd{(} to
temporarily make @samp{Z} to the marker and do something on the
@samp{Z}-files, and then return using @code{)}.

@table @code

@item dired-mark-keys
Default: @code{'("Z")}

List of keys (strings) that insert themselves as file markers.

@end table


@node  Omitting Files in Dired, Advanced Dired Mark Commands, Dynamic Dired Markers, Tree Dired Extra
@section Omitting Files in Dired

@cindex Omitting Files in Dired
@dfn{Omitting} a file means removing it from the directory listing.
Omitting is useful for keeping Dired buffers free of uninteresting files
(for instance, auto-save, auxiliary, backup, and revision control files)
so that the user can concentrate on the interesting files.  Like hidden
files, omitted files are never seen by Dired.
@xref{Dired Hiding,Hiding in Dired,Hiding in Dired,dired,Tree Dired Manual}.
Omitting differs from hiding in several respects:

@itemize @bullet

@item
Omitting works on individual files, not on directories; an entire
directory cannot be omitted (though each of its files could be).

@item
Omitting is wholesale; if omitting is turned on for a dired buffer, then
all ``uninteresting'' files listed in that buffer are omitted.  The user
does not omit (or unomit) files one at a time.

@item
Omitting can be automatic; uninteresting file lines in the buffer can
be removed before the user ever sees them.

@item
Marked files are never omitted.
@end itemize

@table @kbd

@item M-o
@kindex M-o
@findex dired-omit-toggle
(@code{dired-omit-toggle})
Toggle between displaying and omitting ``uninteresting'' files.
With a prefix argument, don't toggle and just mark the files, but don't
actually omit them.
@end table

In order to make omitting work, you must have @code{dired-omit-expunge}
on your @code{dired-after-readin-hook}, and you must call
@code{dired-omit-startup} (or @code{dired-extra-startup}, which calls
@code{dired-omit-startup}) in your @code{dired-mode-hook}.  Simply
loading @file{dired-x.el} inside @code{dired-load-hook} takes care of
all this.

The following variables can be used to customize omitting.

@table @code

@vindex dired-omit-files-p
@item dired-omit-files-p

Default: @code{nil}

@cindex How to make omitting the default in Dired
If non-nil, ``uninteresting'' files are not listed.  Uninteresting files
are those whose filenames match regexp @code{dired-omit-files}, plus those
ending with extensions in @code{dired-omit-extensions}.  @kbd{M-o}
(@code{dired-omit-toggle}) toggles its value, which is buffer-local.  Do

@example
(setq dired-omit-files-p t)
@end example

inside your @code{dired-mode-hook} to have omitting initially turned on
in every Dired buffer.  Since @file{dired-x.el} prepends the form
@samp{(dired-extra-startup)} to what you put yourself in your
@code{dired-mode-hook}, the @code{setq} will take place after
@code{dired-omit-files-p} has already been made local to the current
Dired buffer, so modelines of non-dired buffers are not affected.  For
this to work you shouldn't set @code{dired-mode-hook} inside
@code{dired-load-hook}, but directly in your @file{~/.emacs} (before
Dired is loaded, if you explicitly load Dired).

You can then use @kbd{M-o} to unomit in that buffer.

@vindex dired-omit-files
@item dired-omit-files

Default: @code{"^#\\|\\.$"}

Filenames matching this buffer-local regexp will not be displayed.
This only has effect when @code{dired-omit-files-p} is t.

The default value omits the special directories @file{.} and @file{..}
and autosave files (plus other files ending in ``.'').

@vindex dired-omit-extensions
@item dired-omit-extensions

Default: The elements of @code{completion-ignored-extensions},
@code{latex-unclean-extensions}, @code{bibtex-unclean-extensions} and
@code{texinfo-unclean-extensions}.

If non-nil, a list of extensions (strings) to omit from Dired listings.
Its format is the same as that of @code{completion-ignored-extensions}.

@vindex dired-omit-localp
@item dired-omit-localp

Default:  @code{'no-dir}

The @var{localp} argument @code{dired-omit-expunge} passes to
@code{dired-get-filename}.  If it is @code{'no-dir}, omitting is much
faster, but you can only match against the non-directory part of the
filename.  Set it to @code{nil} if you need to match the whole pathname
or @code{t} to match the pathname relative to the buffer's top-level
directory.

@item dired-omit-marker-char
@vindex dired-omit-marker-char

Default: @kbd{C-o}

Temporary marker used by Dired to implement omitting.
Should never be used as marker by the user or other packages.
@cindex Omitting additional files
There is one exception to this rule: by doing
@example
(setq dired-mark-keys "\C-o")
;; i.e., the value of dired-omit-marker-char
;; (which is not defined yet)
@end example
anywhere in your @file{~/.emacs}, you will bind the @kbd{C-o} key to
insert a @key{C-o} marker, thus causing these files to be omitted in
addition to the usually omitted files.  Unfortunately the files you
omitted manually this way will show up again after reverting the buffer,
unlike the others.

@end table

@cindex RCS files, how to omit them in Dired
@cindex Omitting RCS files in Dired
To avoid seeing RCS files and the RCS directory, do
@example
(setq dired-omit-files "\\.$\\|#\\|^RCS$\\|,v$")
@end example
This assumes @code{dired-omit-localp} has its default value of
@code{'no-dir} to make the @code{^}-anchored matches work.  As a slower
alternative, with @code{dired-omit-localp} set to @code{nil}, you can
use @code{/} instead of @code{^} in the regexp.

@cindex Tib files, how to omit them in Dired
@cindex Omitting tib files in Dired
If you use tib, the bibliography program for use with @TeX{} and
La@TeX{}, you might want to omit the @file{INDEX} and the @file{-t.tex}
files:
@example
(setq dired-omit-files "\\.$\\|#\\|^INDEX$\\|-t\\.tex$")
@end example

@node Advanced Dired Mark Commands, Virtual Dired, Omitting Files in Dired, Tree Dired Extra
@section Advanced Mark Commands

@table @kbd

@item M-(
@kindex M-(
@findex dired-mark-sexp
@cindex Lisp expression, marking files with in Dired
@cindex Mark file by lisp expression
(@code{dired-mark-sexp}) Mark files for which @var{predicate} returns non-nil.
With a prefix argument, unflag those files instead.

The @var{predicate} is a lisp expression that can refer to the following
symbols:
@table @code
@item inode
[@i{integer}] the inode of the file (only for @samp{ls -i} output)
@item s
[@i{integer}] the size of the file for @samp{ls -s} output (usually in blocks or,
with @samp{-k}, in KBytes)
@item mode
[@i{string}]  file permission bits, e.g., @samp{"-rw-r--r--"}
@item nlink
[@i{integer}] number of links to file
@item uid
[@i{string}]  owner
@item gid
[@i{string}]  group  (If the gid is not displayed by @samp{ls}, this
will still be set (to the same as uid))
@item size
[@i{integer}] file size in bytes
@item time
[@i{string}]  the time that @samp{ls} displays, e.g., @samp{"Feb 12 14:17"}
@item name
[@i{string}]  the name of the file
@item sym
[@i{string}]  if file is a symbolic link, the linked-to name, else @samp{""}
@end table

@noindent
For example, use
@example
(equal 0 size)
@end example
to mark all zero length files.

To find out all not yet compiled Emacs lisp files in a directory, dired
all @file{.el} files in the lisp directory using the wildcard
@samp{*.el}.  Then use @kbd{M-(} with
@example
(not (file-exists-p (concat name "c")))
@end example
to mark all @file{.el} files without a corresponding @file{.elc} file.

@item M-M
@kindex M-M
@cindex Marker character, how to replace it
@cindex Replacing one marker character with another
(@code{dired-do-unmark}) Unmark marked files by replacing the marker
with another character.  The new character defaults to a space,
effectively unmarking them.

@item ,
@kindex ,
@cindex RCS controlled files, how to mark them
@cindex Marking RCS controlled files
(@code{dired-mark-rcs-files}) Mark all files that are under RCS control.
With prefix argument, unflag all those files.  Mentions RCS files for
which a working file was not found in this buffer.  Type @kbd{W}
(@code{dired-why}) to see them again.

@item C-m C-c
@kindex C-m C-c
@cindex Compilation files, how to mark them
@cindex Marking compilation files
@cindex List of files, how to mark them
@cindex Marking a list of files from a buffer
(@kbd{C-m C-c} is the suggested binding for
@code{dired-mark-files-compilation-buffer}, it is not bound by default.)
Mark the files mentioned in the @samp{*compilation*} buffer.  With an
argument, you may specify the other buffer and your own regexp instead of
@code{compilation-error-regexp}.  Use @samp{^.+$} (the default with a
prefix argument) to match complete lines.  In conjunction with narrowing the
other buffer you can mark an arbitrary list of files, one per line, with
this command.  If your regexp contains a subexpression, i.e.
@samp{\(@var{...}\)}, that subexpression is taken for the file name,
else the whole match is used.  Thus you can easily strip pre- and
suffixes from filenames by using @samp{@var{prefix}\(.+\)@var{postfix}}
as regexp.

This is especially useful for a list of files obtained from @kbd{M-x
grep} or output from a similar shell command.

@item C-m C-d
@kindex C-m C-d
@cindex Corresponding files, how to mark them
@cindex List of files, how to mark them
(@kbd{C-m C-d} is the suggested binding for
@code{dired-mark-files-from-other-dired-buffer}, it is not bound by default.)
Mark those files in this Dired buffer that have the same name as the
marked files in the Dired buffer in the other window.

In short, mark the corresponding files from the other Dired buffer.

@end table

@table @kbd
@item F
@kindex F
@cindex Visiting several files at once
@cindex Simultaneous visiting of several files
@findex dired-do-find-file
(@code{dired-do-find-file}) Visit all marked files at once, and
display them simultaneously.  If you want to keep the dired buffer
displayed, type @kbd{C-x 2} first.  If you want just the marked files
displayed and nothing else, type @kbd{C-x 1} first.

The current window is split across all files.  Remaining lines go to the
last window.

The number of files that can be displayed this way is restricted by the
height of the current window and the variable @code{window-min-height}.

@end table

@table @code

@item dired-mark-extension
@findex dired-mark-extension
Mark all files with a certain extension for use in later commands.
A @samp{.} is not automatically prepended to the string entered.

When called from lisp, @var{extension} may also be a list of extensions
and an optional argument @var{marker-char} specifies the marker used.

@item dired-flag-extension
@findex dired-flag-extension
Flag all files with a certain extension for deletion.
A @samp{.} is @emph{not} automatically prepended to the string entered.

@item dired-clean-patch
@findex dired-clean-patch
Flag dispensable files created by the @samp{patch} program for deletion.
See variable @code{patch-unclean-extensions}.

@item dired-clean-tex
@findex dired-clean-tex
Flag dispensable files created by @TeX{}, La@TeX{} and @samp{texinfo}
for deletion.  See variables @code{tex-unclean-extensions},
@code{texinfo-unclean-extensions}, @code{latex-unclean-extensions} and
@code{bibtex-unclean-extensions}.

@end table

Variables used by the above cleanup commands (and in the default value
for variable @code{dired-omit-extensions}):

@table @code

@item patch-unclean-extensions
@vindex patch-unclean-extensions
Default:  @code{'(".rej" ".orig")}

List of extensions of dispensable files created by the @samp{patch} program.

@item tex-unclean-extensions
@vindex tex-unclean-extensions
Default:  @code{'(".toc" ".log" ".aux")}

List of extensions of dispensable files created by @TeX{}.

@item texinfo-unclean-extensions
@vindex texinfo-unclean-extensions
Default: @code{'(".cp" ".cps" ".fn" ".fns" ".ky" ".kys" ".pg" ".pgs"
".tp" ".tps" ".vr" ".vrs")}

List of extensions of dispensable files created by texinfo.

@item latex-unclean-extensions
@vindex latex-unclean-extensions
Default: @code{'(".idx" ".lof" ".lot" ".glo")}

List of extensions of dispensable files created by LaTeX.

@item bibtex-unclean-extensions
@vindex bibtex-unclean-extensions
Default:  @code{'(".blg" ".bbl")}

List of extensions of dispensable files created by BibTeX.

@end table


@node Virtual Dired, Multiple Dired Directories, Advanced Dired Mark Commands, Tree Dired Extra
@section Virtual Dired

@cindex Virtual Dired
@cindex Perusing ls listings
@cindex ls listings, how to peruse them in Dired
Using @dfn{Virtual Dired} means putting a buffer with Dired-like
contents in Dired mode.  The files described by the buffer contents need
not actually exist.  This is useful if you want to peruse an @samp{ls -lR}
output file, for example one you got from an FTP server.  You can use
all motion commands usually available in Tree Dired.  You can also use
it to save a Dired buffer in a file and resume it in a later session.

@findex dired-virtual
@kindex g
@findex dired-virtual-revert
Type @kbd{M-x dired-virtual} to put the current buffer into virtual
Dired mode.  You will be prompted for the top level directory of this
buffer, with a default value guessed from the buffer contents.  To
convert the virtual to a real Dired buffer again, type @kbd{g} (which
calls @code{dired-virtual-revert}) in the virtual Dired buffer and
answer @samp{y}.  You don't have to do this, though: you can relist
single subdirectories using @kbd{l} (@code{dired-do-redisplay}) on the subdirectory
headerline, leaving the buffer in virtual Dired mode all the time.

@findex dired-virtual-mode
@vindex auto-mode-alist
The function @samp{dired-virtual-mode} is specially designed to turn on
virtual Dired mode from the @code{auto-mode-alist}.  To automatically
edit all @file{*.dired} files in virtual Dired mode, put this into your
@file{~/.emacs}:

@example
(setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode)
                              auto-mode-alist))
@end example

The regexp is a bit more complicated than usual to exclude ".dired"
local variable files.

@node Multiple Dired Directories, Dired Local Variables, Virtual Dired, Tree Dired Extra
@section Multiple Dired Directories and Non-Dired Commands

@cindex Multiple Dired directories
@cindex Working directory
An Emacs buffer can have but one working directory, stored in the
buffer-local variable @code{default-directory}.  A Dired buffer may have
several subdirectories inserted, but still has but one working
directory: that of the top level Dired directory in that buffer.  For
some commands it is appropriate that they use the current Dired
directory instead of @code{default-directory}, e.g., @code{find-file} and
@code{compile}.

A general mechanism is provided for special handling of the working
directory in special major modes:

@table @code
@item default-directory-alist
@vindex default-directory-alist
Default: @code{((dired-mode . (dired-current-directory)))}

Alist of major modes and their opinion on @code{default-directory}, as a
lisp expression to evaluate.  A resulting value of @code{nil} is ignored
in favor of @code{default-directory}.

@item default-directory
@findex default-directory
Function with usage like variable @code{default-directory}, but knows about the
special cases in variable @code{default-directory-alist}.
@end table

The following dired-x commands take special care about the current
Dired directory:

@table @code

@item find-this-file
@findex find-this-file
@findex find-file
@kindex C-x C-f
Bind this to @kbd{C-x C-f} as a replacement for @code{find-file} that
will prompt for the filename within the current Dired subdirectory, not
the top level directory.

@item find-this-file-other-window
@findex find-this-file-other-window
@findex find-file-other-window
@kindex C-x 4 C-f
Bind this to @kbd{C-x 4 C-f} as a replacement for
@code{find-file-other-window}.

@item dired-smart-shell-command
@findex dired-smart-shell-command
@findex shell-command
@kindex M-!
Like function @code{shell-command}, but in the current Tree Dired directory.
Bound to @kbd{M-!} in Dired buffers.

@item dired-smart-background-shell-command
@findex dired-smart-background-shell-command
@findex background
@kindex M-&
Like function @code{background}, but in the current Tree Dired directory.
Bound to @kbd{M-&} in Dired buffers.

@item dired-jump-back
@findex dired-jump-back
@kindex C-x j
(Suggested binding @kbd{C-x j}) Jump back to dired: If in a file, dired
the current directory and move to file's line.  If in Dired already, pop
up a level and goto old directory's line.  In case the proper Dired file
line cannot be found, refresh the Dired buffer and try again.

@item dired-jump-back-other-window
@findex dired-jump-back-other-window
@kindex C-x 4 j
(Suggested binding @kbd{C-x 4 j}) Like @code{dired-jump-back}, but to
other window.

@item dired-vm
@kindex V
@findex dired-vm
@vindex vm-folder-directory
(@kbd{V}) Run VM on this file (assumed to be a UNIX mail folder).
Further `v' commands from within VM in that folder will default to the
folder's directory, not the usual @code{vm-folder-directory}.

@vindex dired-vm-read-only-folders
If you give this command a prefix argument, it will visit the folder
read-only.  This only works in VM 5, not VM 4.

If the variable @code{dired-vm-read-only-folders} is t, @code{dired-vm}
will visit all folders read-only.  If it is neither @code{nil} nor
@code{t}, e.g., the symbol @code{'if-file-read-only}, only files not
writable by you are visited read-only.  This is the recommended value if
you run VM 5.

@item dired-rmail
@findex dired-rmail
Run Rmail on this file (assumed to be mail folder in Rmail/BABYL format).

@end table

@c subsection Narrow and Widen in a Dired Buffer

@node Dired Local Variables, Making Relative Symbolic Links in Dired, Multiple Dired Directories, Tree Dired Extra
@section Local Variables for Dired Directories

@cindex Local Variables for Dired Directories
@vindex dired-local-variables-file
When Dired visits a directory, it looks for a file whose name is the
value of variable @code{dired-local-variables-file} (default:
@file{.dired}).  If such a file is found, Dired will temporarily insert
it into the Dired buffer and run @code{hack-local-variables}.
@xref{File Variables,Local Variables in Files,Local Variables in
Files,emacs,The GNU Emacs Manual}.  You can set
@code{dired-local-variables-file} to @code{nil} to suppress this.

For example, put

@example
Local Variables:
dired-actual-switches: "-lat"
dired-sort-mode: " by date"
End:
@end example

into a @file{.dired} file of a directory to sort by date only in that
directory.  Note that since @code{dired-hack-local-variables} is run
inside @code{dired-mode-hook} the modeline has already been set, so you
have to update that for yourself by setting @code{dired-sort-mode} in
addition to changing the switches.

@node Making Relative Symbolic Links in Dired, Letting Dired Guess What Shell Command to Apply, Dired Local Variables, Tree Dired Extra
@section Making Relative Symbolic Links in Dired

In GNU Emacs version 18, the built-in function @code{make-symbolic-link}
always calls @code{expand-file-name} on its arguments, so relative
symlinks (e.g.  @samp{foo -> ../bar/foo}) are impossible to create.

Dired Extra uses @code{call-process} and @samp{ln -s} for a workaround.

@table @code

@item dired-make-symbolic-link
@findex dired-make-symbolic-link
Arguments @var{name1} @var{name2} and optional
@var{ok-if-already-exists}.  Create file @var{name2}, a symbolic link
pointing to @var{name1} (which may be any string whatsoever and is
passed untouched to @samp{ln -s}).  @var{ok-if-already-exists} means that
@var{name2} will be overwritten if it already exists.  If it is an
integer, user will be asked about this.  On error, signals a file-error.

@item dired-make-relative-symlink
@findex dired-make-relative-symlink
Three arguments: @var{file1} @var{file2} and optional
@var{ok-if-already-exists}.  Make a symbolic link @var{file2} (pointing
to @var{file1}).  The link is relative (if possible), for example

@example
(dired-make-relative-symlink "/vol/tex/bin/foo"
                             "/vol/local/bin/foo")
@end example

@noindent
results in a link

@example
/vol/local/bin/foo -> ../../tex/bin/foo 
@end example

@item dired-do-relsymlink
@findex dired-do-relsymlink
(binding @kbd{S}) Symbolically link all marked (or next @var{N}) files
into a directory, or make a symbolic link to the current file.  This
creates relative symbolic links like

@example
    foo -> ../bar/foo
@end example

@noindent
not absolute ones like
@example
    foo -> /ugly/path/that/may/change/any/day/bar/foo
@end example

@item dired-do-relsymlink-regexp
@findex dired-do-relsymlink-regexp
(@kbd{%S}) Symbolically link all marked files containing @var{regexp} to
@var{newname}, using relative (not absolute) names.  See functions
@code{dired-rename-regexp} and @code{dired-do-relsymlink} for more info.

@end table

@node Letting Dired Guess What Shell Command to Apply, dired-trns.el, Making Relative Symbolic Links in Dired, Tree Dired Extra
@section Letting Dired Guess What Shell Command to Apply

Based upon the name of a filename, Dired tries to guess what shell
command you might want to apply to it.  For example, if you have point
on a file named @file{foo.tar} and you press @kbd{!}, Dired will guess
you want to @samp{tar xvf} it and suggest that as the default shell
command.

If you are using the @file{gmhist} package (@xref{Dired Minibuffer
History}), the default will be mentioned in brackets and you can type
@kbd{M-p} to get the default into the minibuffer so that you can edit
it, e.g., changing @samp{tar xvf} to @samp{tar tvf}.  If there are
several commands for a given file, e.g., @samp{xtex} and @samp{dvips}
for a @file{.dvi} file, you can type @kbd{M-p} several times to see each
of the matching commands.

Dired only tries to guess a command for a single file, never for a list
of marked files.

@table @code

@item dired-auto-shell-command-alist-default
@vindex dired-auto-shell-command-alist-default

Predefined rules for shell commands.  Set this to nil to turn guessing off.
The elements of @code{dired-auto-shell-command-alist} (defined by the
user) will override these rules.@refill

@item dired-auto-shell-command-alist
@vindex dired-auto-shell-command-alist

If non-nil, an alist of file regexps and their suggested commands
overriding the predefined rules in
@code{dired-auto-shell-command-alist-default}.@refill

Each element of the alist looks like

@example
(@var{regexp} @var{command}@dots{})
@end example

where each @var{command} can either be a string or a lisp expression
that evaluates to a string.  If several @var{COMMAND}s are given, all
will temporarily be pushed on the history.

These rules take precedence over the predefined rules in the variable
@code{dired-auto-shell-command-alist-default} (to which they are
prepended when @file{dired-x} is loaded).

You can set this variable in your @file{~/.emacs}.  For example,
to add rules for @samp{.foo} and @samp{.bar} file extensions, write

@example
(setq dired-auto-shell-command-alist
      (list
       (list "\\.foo$" "@var{foo-command}");; fixed rule
       ;; possibly more rules...
       (list "\\.bar$";; rule with condition test
              '(if @var{condition}
                   "@var{bar-command-1}"
                 "@var{bar-command-2}"))))
@end example

@noindent
This will override any predefined rules for the same extensions.

@item dired-guess-have-gnutar
@vindex dired-guess-have-gnutar

Default: @code{nil}

If non-nil, name of the GNU tar executable (e.g., @samp{"tar"} or
@samp{"gnutar"}).  GNU tar's @samp{z} switch is used for compressed tar
files.  If you don't have GNU tar, set this to nil: a pipe using
@samp{zcat} is then used.

@end table

@node dired-trns.el, dired-cd.el, Letting Dired Guess What Shell Command to Apply, Tree Dired Extra
@section Filename Transformers for Dired Shell Commands

@cindex Transformer
@cindex Basename of a file, how to use in Dired shell commands
@cindex Extension of a file, how to use in Dired shell commands
File name @dfn{transformers} are functions that take a filename (a string)
as an argument and transform it into some other string (e.g., a filename
without an extension).  This package makes transformers available in
Dired shell commands.

For example, running the Dired shell command (type @kbd{!} or @kbd{M-x}
@code{dired-do-shell-command})@refill

@example
echo * [b] [db]
@end example

would list the full name, the basename, and the absolute basename of
each marked file.

Each transformer is associated with a dispatch character. The associations
are stored in a keymap for fast and easy lookup. The dispatch character
is used to activate the associated transformer function at a particular
position in a shell command issued in Dired.  The dispatch character
must be enclosed in brackets to distinguish it from normal letters.

To take advantage of this package, simply load it after loading Dired,
e.g., in your @code{dired-load-hook}.  You can then use transformers like
"[b]" for the basename in your Dired shell commands (see below).

You can define your own transformers using the macro @code{dired-trans-define}.

@table @code

@item dired-trans-define
@findex dired-trans-define
Macro that assigns the transformer function @code{(lambda (file)
@var{body})} to @var{char} (a character or string).  @var{body} must
return a string: the transformed file.
@end table

Several transformers are predefined:

@table @samp

@item *
returns the unmodified filename (equivalent to @samp{[dbe]}).

@item n
returns the Name component of a filename without directory information

@item d
returns the Directory component of a filename

@item b
returns the Basename of a filename, i.e., the name of the file without
directory and extension (see variable @code{dired-trans-re-ext})
A basename with directory component can be obtained by @samp{[db]}.

@item e
returns the Extension of a filename (i.e., whatever
@code{dired-trans-re-ext} splits off)

@item v
returns a file without directory and without @file{,v} suffixes if any.

@item z
returns a file without directory and without @file{.Z} suffixes if any.

@end table

@noindent
The following variables can be used to customize @file{dired-trns.el}:

@table @code

@item dired-trans-re-ext
@vindex dired-trans-re-ext
Default: @code{"\\.[^.]*\\(\\.Z\\)?$"}

The part of a filename matching this regexp will be viewed as extension.

@item dired-trans-starters
@vindex dired-trans-starters
Default: @code{"[#[]"}

User definable set of characters to be used to indicate the start of a
transformer sequence.

@item dired-trans-enders
@vindex dired-trans-enders
Default: @code{"[]# ]"}

User definable set of characters to be used to indicate the end of a
transformer sequence.

@end table

@node dired-cd.el, dired-nstd.el, dired-trns.el, Tree Dired Extra
@section Changing the Working Directory for Dired Shell Commands

The package @file{dired-cd.el} permits the working directory of the
Dired shell commands @kbd{!} (@code{dired-do-shell-command}) and @kbd{&}
(@code{dired-do-background-shell-command}) to be the files' subdirectory
under certain circumstances.  Loading this extension does not change the
behavior of Dired until the variables @code{dired-cd-same-subdir} and/or
@code{dired-cd-on-each} are non-nil.

@vindex dired-cd-same-subdir
If @code{dired-cd-same-subdir} is non-nil and if all the selected files
(marked, non-zero numeric argument, etc.) are in the same subdirectory,
then @code{dired-do-shell-command} and
@code{dired-do-background-shell-command} cause the shell to perform a
@samp{cd} into that directory before the commands are executed.  Also,
the selected filenames are provided to the command without any directory
components.

@vindex dired-cd-on-each
If @code{dired-cd-on-each} is non-nil and if the @samp{on-each} option
is specified (numeric argument of zero), then @kbd{!}
(@code{dired-do-shell-command}) and @kbd{&}
(@code{dired-mark-background-shell-command}) use a subshell to perform a
@samp{cd} into the subdirectory of each file before the commands on that
file are executed.  Also, each filename is provided to the command
without any directory components.  Note that this behavior occurs
regardless of whether the files are all in the same directory or not.

After the above @samp{cd} wrapping has occured, the existing
@code{dired-shell-stuff-it} is used to do the actual file-name quoting
and substitution into the command.  Thus, custom versions of this
procedure should work, e.g., the @samp{dired-trans} package will transform
commands correctly.  However, since filenames lack any directory
components, features that use the directory components will fail, e.g.
the @samp{[d]} transform specifier will be empty.

To use this package, load it in your @code{dired-load-hook}.  Do

@example
(setq dired-cd-same-subdir t)
@end example

@noindent
and perhaps

@example
(setq dired-cd-on-each t)
@end example

@noindent
in your @file{~/.emacs}.  By default, @code{dired-cd} doesn't change the
behavior of Dired when it is loaded.

@vindex dired-cd-same-subdir
If @code{dired-cd-same-subdir} is non-nil, then the shell commands
@samp{cd} to the appropriate directory if all the selected files are in
that directory; however, on-each behavior (with zero prefix argument) is
not changed.

@vindex dired-cd-on-each
If @code{dired-cd-on-each} is non-nil, then each instance of the command
for an on-each shell command runs in the file's directory regardless of
whether the files are all in the same directory.

@node dired-nstd.el, find-dired.el, dired-cd.el, Tree Dired Extra
@section Nested Dired format

[NO DOCUMENTATION YET]

This is still buggy, @xref{Dired Known Problems}.

@node find-dired.el,  , dired-nstd.el, Tree Dired Extra
@section Feeding Find Output to Dired

@cindex Find and Dired
The @code{find-dired} command runs the @samp{find} command in a buffer
and starts Dired on the inserted file lines, even while @samp{find} is
still running.  For example, with @samp{-type d} as argument, you will
get a Dired buffer that contains all subdirectories of a given
directory, but none of the other files.

Note that @samp{find} just gives you file lines, not inserted
subdirectories with associated headerlines as repeated use of the
@kbd{i} (@code{dired-maybe-insert-subdir}) command would.  Also, the
names contain slashes if they are in a subdirectory, which never occurs
in a normal Dired buffer.  Dired understands these names anyway and you
can for example type @kbd{f} on such lines as usual.  However, while
@samp{find} is still running you shouldn't type @kbd{i} to insert
subdirectories, since new @samp{find} output is always appended at the
end.  Use @kbd{f} or @kbd{o} instead to dired the specific subdirectory
in a new Dired buffer.  After @samp{find} has finished (as indicated by
a message and the modeline) all Dired commands work as usual.

@table @code

@item find-dired
@findex find-dired
Run @samp{find} on a directory @var{dir}, with find arguments
@var{args}, and go into dired-mode on a buffer of the output.  The
command run (after changing into @var{dir}) is
@example
find . \( @var{args} \) -ls
@end example

@item find-name-dired
@findex find-name-dired
Search @var{dir} recursively for files matching the globbing pattern
@var{pattern}, and run Dired on those files.  @var{pattern} is a shell
wildcard (not an Emacs regexp) and need not be quoted.  The command
run (after changing into @var{dir}) is
@example
    find . -name '@var{pattern}' -ls
@end example

@item find-grep-dired
@findex find-grep-dired
Find files in directory @var{dir} containing a regexp @var{arg} and
start Dired on output.  The command run (after changing into @var{dir})
is
@example
find . -exec grep -s @var{arg} @{@} \; -ls
@end example
@end table

@node Dired Internals, Dired Known Problems, Tree Dired Extra, Top
@appendix Dired Internals

This is a short introduction about how Dired's Tree and Mark features
work.  You are encouraged to read the code (@file{dired.el}) for more
information.

@menu
* Tree Dired Internals::	
* Dired Mark Internals::	
@end menu

@node Tree Dired Internals, Dired Mark Internals, Dired Internals, Dired Internals
@section Tree Dired Internals

@cindex Internals of Tree Dired
@cindex Tree Dired Internals
@vindex dired-subdir-alist
@vindex default-directory
In Tree Dired, instead of just one directory, all or part of the
directory @emph{tree} starting at the top level directory (the working
directory or @code{default-directory} of the buffer) may be in a
Dired buffer.  Each file line belongs to exactly one of those
subdirectories.  After the @code{ls} program has inserted its output,
Dired parses the buffer once to find out where the subdirectory
boundaries are and saves them in the variable @code{dired-subdir-alist}.
The beginning of the headerline inserted by @code{ls} serves as boundary
between subdirectories.

@kindex i
@findex dired-maybe-insert-subdir
Subsequent @kbd{i} (@code{dired-maybe-insert-subdir}) commands update this
alist and insert the appropriate headerline.  Each retrieval of the
filename on the current line first extracts the basename (assuming a
more or less standard @code{ls} output format), and then function
@code{dired-current-directory} looks up the current Dired directory in
@code{dired-subdir-alist}.  The lookup is keyed on buffer position, as
each buffer position is between exactly two subdirectory boundaries.  (The end
of the buffer serves as an implicit subdirectory boundary.)

@table @code

@item dired-subdir-alist
@vindex dired-subdir-alist
Association list of subdirectories and their buffer positions:

@example
((@var{lastdir} . @var{lastmarker}) @dots{} (@var{default-directory} . @var{firstmarker})).
@end example

The markers point right before the beginning of the line, so that they
separate subdirectories adjacent in the buffer.  The directories must be
in the form returned by @code{file-name-as-directory}.

@item dired-subdir-regexp
@vindex dired-subdir-regexp
Value: "^. \\([^ \n\r]+\\)\\(:\\)[\n\r]"

Regexp matching a maybe hidden subdirectory line in @samp{ls -lR}
output.  Subexpression 1 is subdirectory proper, no trailing colon.  The
match starts at the beginning of the line and ends after the end of the
line (@samp{\n} or @samp{\r}).  Subexpression 2 must end right before
the @samp{\n} or @code{\r}.  This is so that Dired can easily check
whether a subdirectory is hidden or not: hidden lines end with @samp{\r}
(@kbd{C-m}) instead of a newline.

This regexp used to be @code{"^. \\(/[^\n\r]*\\)\\(:\\)[\n\r]"},
allowing spaces, but disallowing relative filenames (which occur when
browsing ls -lR listing in virtual Dired mode, so I changed it).

Note that @code{"^. \\([^\n\r]+\\)\\(:\\)[\n\r]"} (desirable since it
allows both spaces and relative names) will not always work: if you have
a file that ends in a colon, its whole line (including permission bits,
date etc.) would be mistaken for a subdirectory headerline when parsing
@samp{ls -lR} output.

@code{dired-subdir-regexp} is only relevant for parsing @samp{ls -lR}
output.  If Dired inserts subdirectories itself (using
@code{dired-insert-subdir}), they will always be absolute and there is
no restriction on the format of filenames, e.g., they can contain
spaces.

@end table

@node Dired Mark Internals,  , Tree Dired Internals, Dired Internals
@section Dired Mark Internals

This is a short overview about how marking files and retrieving marked
files in Dired works.

@cindex Internal of Dired file marking
@cindex Dired file marking internals
@cindex File marking internals in Dired
@cindex Marking files in Dired, internals of
@code{ls} output is indented two spaces two make room for an optional
marker character in front of each file line.  Marking simply replaces the
first space with the marker character, usually @code{*} or, for
deletions, @code{D}.  Indenting just by one would leave the markers
adjacent to the permission bits.

@table @code

@item dired-mark-if
@findex dired-mark-if
The macro @code{dired-mark-if} is used internally to mark files matching
certain criteria. It takes two arguments, the @var{predicate}, a lisp
expression evaluating non-nil on file lines to be marked, and @var{msg},
a message to be displayed while scanning the buffer.  @var{msg} may be
nil to suppress the message.

@findex dired-mark-map
@item dired-mark-map
To operate on the marked files, all internal Dired functions ultimately
call the macro @code{dired-mark-map}.  It takes two arguments,
@var{body} and @var{arg}, plus an optional argument @var{show-progress}:

Perform @var{body} with point somewhere on each marked line (inside a
@code{save-excursion}) and return a list of @var{body}'s results.  If no
marked file could be found, execute @var{body} on the current line.

If @var{arg} is an integer, use the next @var{arg} (or previous
-@var{arg}, if @var{arg}<0) files instead of the marked files.  In that
case point is dragged along.  This is so that commands on the next ARG
(instead of the marked) files can be chained easily.  Note that for
positive ARG point is left on the first file not operated upon, for
negative on the last file operated upon

If @var{arg} is otherwise non-nil, use current file instead.

If optional third argument @var{show-progress} evaluates to non-nil, we
redisplay the Dired buffer after each file is processed.  No guarantee
is made about the position on the marked line.  @var{body} must ensure
this itself if it depends on this.  Search starts at the beginning of
the buffer, thus the @code{car} of the list corresponds to the line nearest to
the buffer's bottom.  This is also true for (positive and negative)
integer values of @var{arg}.  The @var{body} should not be too long as
it is expanded four times.@refill

@c This warning should no longer apply. sk  6-Sep-1991 16:28
@c Warning: @var{body} must not add new lines before point - this may cause
@c an endless loop.

@end table

@noindent
A common case is to retrieve the names of all marked files:

@table @code

@findex dired-mark-get-files
@item dired-mark-get-files
Return the marked files as list of strings.  The list is in the same
order as the buffer, that is, the car is the first marked file.  Values
returned are normally absolute pathnames.  Optional argument @var{localp}
equal to @code{no-dir} means return the filename proper only, with no
directory information; any other non-nil value means make them relative
to default-directory.  Optional second argument @var{arg} forces use of
other files.  If @var{arg} is an integer, use the next @var{arg} files.
If @var{arg} is otherwise non-nil, use the current file.

@end table

@node Dired Known Problems, Dired Variable Index, Dired Internals, Top
@appendix Known Problems with Dired

There are some problems with Dired that are either not Dired's fault,
hard to fix or not worth fixing.

@itemize @bullet

@item
Renaming directories usually works fine (all affected Dired and file
buffers are updated), but moving a directory between different
filesystems (those on different hard disks or different partitions) does
not work: it creates a plain target file containing the contents of the
original directory (inodes and filenames) or fails completely.

Unfortunately Emacs' builtin function @code{rename-file} does not give
you a clear error message like @samp{cross-device link attempted}, but
rather a spurious @code{(file-error "Removing old name" "not owner")},
at least in Emacs 18.55.

On some systems renaming a directory always fails (even within
the same filesystem) with the spurious @samp{not owner} error.
@c This was reported for HP-UX.
@c
@c On one system (IBM Rs6000 running AIX 3.1.3) date lossage was reported,
@c but this was not reproducible.

@item
If @file{foo} is a symlink to a non-existing file, @code{(file-exists-p
"foo")} returns nil.  Thus, Dired will overwite such (strange) kinds of
symlinks without noticing.

Dired could test both @code{file-symlink-p} and @code{file-exists-p},
but this would slow down all file operations to catch a very rare case.

@item
Copying a directory does not work - it results in a zero-length
target file.

This comes from Emacs' @code{copy-file} function, not from Dired.

If you really want to copy a directory (recursively), use `!' and
your favorite shell command to do it (e.g. cp -R or cp -r).

@item
Initial spaces in a filename are not recognized.  If I could be sure
that all @samp{ls} programs insert exactly one space between the time and
the filename, I could easily fix this.  But @samp{ls} programs tend to vary
in their amount of white space, and even with one @samp{ls} program there
is a difference between year and clocktime formats
@example
  drwxr-xr-x 2 ab027    thp           512 Aug 13 1990  thp/
  drwxr-xr-x 4 ab027    thp           512 Feb  3 21:59 ./
@end example
If your @samp{ls} supports the @samp{-b} switch and quotes spaces with
that switch, simply add @samp{b} to your @code{dired-listing-switches}.
@xref{Listing Files in Dired}.

Spaces anywhere but at the beginning do work.

@item
In general, only commands that may have targets outside of the
current directory tree update other buffers (copy, move and link
commands).

Especially, deletions, (un)compress, chmod/chgrp/chown update only
the current buffer.

@item
Some compress programs make output even if all goes well.  Dired
takes output as a sign of trouble and assumes that the subprocess
failed.

Redefine function @code{dired-check-process-checker} suitably to
look closer at the generated output.  In Emacs 19, the exit status
of compress will be checked.

@item
Aliases like @samp{rm -i} for @samp{rm} or @samp{ls -F} for @samp{ls}
can cause problems in Dired's (and Emacs') shell command.  (Aliases for
@samp{ls} only matter if you dired wildcards, because only then the shell is
used to run @samp{ls}.)  Csh expands aliases only for interactive shells, which
is probably what you want.  In Bash, you can achieve this by testing
@code{PS1} in your @file{~/.bashrc}:
@example
  # `.bashrc' file
  # this test fails when invoked by rsh
  if [ "$@{PS1-no@}" != "no" ]       # is this an interactive shell?
  then
	  . ~/.bash_alias          # if so, source aliases
  fi
@end example

@item
Directory names starting with @file{-} (a minus) may lose when they are
to be created or removed.  If you care about this, and your rmdir
and mkdir understand about @file{--} meaning end of options, change
@file{emacs-19.el} accordingly.

In Emacs 19 the @code{make-directory} and @code{remove-directory}
operations will be builtin, not implemented with @samp{rmdir} and
@samp{mkdir} subprocesses.

@item
@file{dired-nstd.el}: This is still buggy.  For example, after you've
compressed the last file it may not correctly return that file's
absolute pathname (@code{dired-current-directory} erronously returns nil
because of markers collapsed during redisplay), ultimately leading to
lisp errors.

@c Not longer a problem as of dired-version 5.242, sk 28-Jan-1992 11:17.
@c @item
@c Symbolic links to directories are sometimes strange.  On System V
@c derived systems (e.g., DG/UX, AIX/370), after
@c @example
@c mkdir dir; ln -s dir link
@c @end example
@c both @file{link} and @file{link/} are considered symbolic links by the
@c @samp{stat(2)} system call, while on BSD derived systems (e.g., Sun OS,
@c Mach, HP/UX, Ultrix) @file{link/} is considered a directory.  In
@c general, the BSD behaviour is preferable, at least for Dired.  On the
@c other systems it is cumbersome to get Dired to dereference those links.

@item
The regexp-using @kbd{%}-commands get into an endless loop if you
specify a regular expression that matches the empty string.

@item
Function @code{find-alternate-file} in Emacs 18.57 has a bug that causes
@kbd{C-x C-v RET} (which usually re-visits the current buffer) to fail
on Dired buffers.  This is fixed in the version in @file{emacs-19.el},
automatically loaded by Dired.

@item
It is not possible to resort the Dired buffer without reverting it. That
would be hard to implement (and slow to run) given that ls date format
would have to be parsed for @samp{ls -t} sorting order.

@end itemize

@node     Dired Variable Index, Dired Function Index, Dired Known Problems, Top
@unnumbered Dired Variable Index
@printindex vr

@node     Dired Function Index, Dired Key Index, Dired Variable Index, Top
@unnumbered Dired Function Index
@printindex fn

@node     Dired Key Index, Dired Concept Index, Dired Function Index, Top
@unnumbered Dired Key Index
@printindex ky

@node     Dired Concept Index,  , Dired Key Index, Top
@unnumbered Dired Concept Index
@printindex cp

@c @summarycontents
@contents

@bye

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.