summaryrefslogtreecommitdiff
path: root/doc/misc/dired-x.texi
blob: 754ccf4065cc995e8f651cd13b9156d72a54c433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
\input texinfo  @comment -*-texinfo-*-

@c dired-x.texi --- Sebastian Kremer's Extra DIRED hacked up for GNU Emacs
@c
@c Author: Sebastian Kremer <sk@thp.uni-koeln.de>
@c      Lawrence R. Dodd <dodd@roebling.poly.edu>
@c [Dodd's address no longer valid.]

@comment %**start of header (This is for running Texinfo on a region.)
@setfilename ../../info/dired-x.info
@settitle Dired Extra User's Manual
@include docstyle.texi

@include emacsver.texi

@iftex
@finalout
@end iftex
@c @setchapternewpage odd               % For book style double sided manual.
@comment %**end of header (This is for running Texinfo on a region.)

@copying
Copyright @copyright{} 1994--1995, 1999, 2001--2022 Free Software
Foundation, Inc.

@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below.  A copy of the license
is included in the section entitled ``GNU Free Documentation License''.

(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
modify this GNU manual.''
@end quotation
@end copying

@dircategory Emacs misc features
@direntry
* Dired-X: (dired-x).           Dired Extra Features.
@end direntry

@c      @smallbook
@tex
\overfullrule=0pt
%\global\baselineskip 30pt      % For printing in double spaces
@end tex

@titlepage
@sp 6
@center @titlefont{Dired Extra}
@sp 2
@center @titlefont{For The GNU Emacs}
@sp 1
@center @titlefont{Directory Editor}
@sp 4
@center Lawrence R@. Dodd
@c @center @t{dodd@@roebling.poly.edu}
@sp 5
@center (Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>)
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage

@contents


@ifnottex

@node Top
@top Dired Extra

@noindent
This documents the ``extra'' features for GNU Emacs's Dired Mode that are
provided by the file @file{dired-x.el}.

@itemize @bullet

@item
Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>

@item
For @file{dired-x.el} as distributed with GNU Emacs @value{EMACSVER}.

@end itemize

@insertcopying

@menu
* Introduction::
* Installation::
* Omitting Files in Dired::
* Shell Command Guessing::
* Virtual Dired::
* Advanced Mark Commands::
* Multiple Dired Directories::
* Find File At Point::
* Miscellaneous Commands::
* Bugs::

* GNU Free Documentation License::
* Concept Index::
* Command Index::
* Key Index::
* Variable Index::

@end menu

@end ifnottex

@node Introduction
@chapter Introduction

This documents some @emph{extra} features for GNU Emacs's Dired Mode
that are provided by @file{dired-x.el} (derived from Sebastian Kremer's
original @file{dired-x.el}).

@ifnottex
@menu
* Features::
* Technical Details::
@end menu
@end ifnottex

@node Features
@section Features
@cindex Dired-x features

Some features provided by Dired Extra:

@enumerate
@item
Omitting uninteresting files from Dired listing
(@pxref{Omitting Files in Dired}).
@item
Guessing shell commands in Dired buffers
(@pxref{Shell Command Guessing}).
@item
Running Dired command in non-Dired buffers
(@pxref{Virtual Dired}).
@item
Finding a file mentioned in a buffer
(@pxref{Find File At Point}).
@item
Commands using file marking
(@pxref{Advanced Mark Commands}).
@end enumerate

@noindent
@file{dired-x.el} binds some functions to keys in Dired Mode (@pxref{Key
Index}).  Optionally, it also binds @kbd{C-x C-f} and @kbd{C-x 4 C-f}
to @code{dired-x-find-file} and @code{dired-x-find-file-other-window},
respectively (@pxref{Find File At Point}).

@node Technical Details
@section Technical Details
@cindex modified functions
@cindex @file{dired-aux.el}

When @file{dired-x.el} is loaded, some standard Dired functions from
@file{dired.el} and @file{dired-aux.el} offer additional features.
@code{dired-add-entry} obeys Dired Omit mode (@pxref{Omitting Files in
Dired}), if it is active.  @code{dired-find-buffer-nocreate} and
@code{dired-initial-position} respect the value of
@code{dired-find-subdir} (@pxref{Miscellaneous Commands}).
@code{dired-clean-up-after-deletion} respects the value of
@code{dired-clean-up-buffers-too}.  @code{dired-read-shell-command} uses
@code{dired-guess-shell-command} (@pxref{Shell Command Guessing}) to
offer a smarter default command.

@node Installation
@chapter Installation

@noindent
This manual describes the Dired features provided by the file
@file{dired-x.el}.  To take advantage of these features, you must load the
file and (optionally) set some variables.

@noindent
In your @file{~/.emacs} file, or in the system-wide initialization file
@file{default.el} in the @file{site-lisp} directory, put

@example
(with-eval-after-load 'dired
  (require 'dired-x)
  ;; Set dired-x global variables here.  For example:
  ;; (setq dired-guess-shell-gnutar "gtar")
  ;; (setq dired-x-hands-off-my-keys nil)
  ))
(add-hook 'dired-mode-hook
          (lambda ()
            ;; Set dired-x buffer-local variables here.  For example:
            ;; (dired-omit-mode 1)
            ))
@end example

@noindent
This will load @file{dired-x.el} when Dired is first invoked (for example,
when you first type @kbd{C-x d}).

@ifnottex
@menu
* Optional Installation File At Point::
@end menu
@end ifnottex

@node Optional Installation File At Point
@section Optional Installation File At Point

@cindex binding @code{dired-x-find-file}
If you choose to have @file{dired-x.el} bind @code{dired-x-find-file} over
@code{find-file} (@pxref{Find File At Point}), then you will need to set
@code{dired-x-hands-off-my-keys}.  To do this, either set it
@emph{before} @file{dired-x.el} is loaded, or use @kbd{M-x customize-variable},
or call @code{dired-x-bind-find-file} after changing the value.

@example
(with-eval-after-load 'dired
  ;; Bind dired-x-find-file.
  (setq dired-x-hands-off-my-keys nil)
  (require 'dired-x))
@end example

@node Omitting Files in Dired
@chapter Omitting Files in Dired

@cindex omitting Files in Dired
@cindex uninteresting files
@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.  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 C-x M-o
@kindex C-x M-o
@findex dired-omit-mode
(@code{dired-omit-mode}) Toggle between displaying and omitting
``uninteresting'' files.
@item * O
@kindex * O
@findex dired-mark-omitted
(@code{dired-mark-omitted}) Mark ``uninteresting'' files.
@end table

@noindent
In order to make Dired Omit work you need to load @file{dired-x}
after loading @file{dired} (@pxref{Installation}) and then evaluate
@code{(dired-omit-mode 1)} in some way (@pxref{Omitting Variables}).

@ifnottex
@menu
* Omitting Variables::
* Omitting Examples::
* Omitting Technical::
@end menu
@end ifnottex

@node Omitting Variables
@section Omitting Variables

@cindex customizing file omitting
The following variables can be used to customize omitting.

@cindex how to make omitting the default in Dired
@defvar dired-omit-mode
If non-@code{nil}, ``uninteresting'' files are not listed.
The default is @code{nil}.
Uninteresting files are files whose names match regexp
@code{dired-omit-files}, plus files whose names end with extension in
@code{dired-omit-extensions}.  @kbd{C-x M-o} (@code{dired-omit-mode})
toggles its value, which is buffer-local.  Put

@example
(dired-omit-mode 1)
@end example

@noindent
inside your @code{dired-mode-hook} to have omitting initially turned on in
@emph{every} Dired buffer (@pxref{Installation}).  You can then use
@kbd{C-x M-o} to unomit in that buffer.

To enable omitting automatically only in certain directories you can add
a directory local setting
(@pxref{Directory Variables,,,emacs,The GNU Emacs manual}) for Dired mode

@example
((dired-mode . ((dired-omit-mode . t))))
@end example

@noindent
to a @file{.dir-locals.el} file in that directory.  You can use the
command @code{add-dir-local-variable} to do this.
@end defvar

@defvar dired-omit-files
This buffer-local variable's value is a regexp, a string.  Files whose
names match this regexp will not be displayed.  This only has effect
when @code{dired-omit-mode}'s value is @code{t}.

The default value omits the special directories @file{.} and @file{..}  and
autosave files (plus other files ending in @file{.}) (@pxref{Omitting Examples}).
@end defvar

@defvar dired-omit-extensions
If non-@code{nil}, this variable's value is a list of extensions
(strings) to omit from Dired listings.  Its format is the same as that
of @code{completion-ignored-extensions}.  The default value is the
elements of @code{completion-ignored-extensions},
@code{dired-latex-unclean-extensions},
@code{dired-bibtex-unclean-extensions} and
@code{dired-texinfo-unclean-extensions}.
@end defvar

@defvar dired-omit-case-fold
Default:  @code{filesystem}
This variable controls whether file-name matching is case-insensitive.
By default, when @code{dired-omit-case-fold} is set to @code{filesystem},
@code{dired-omit-mode} will match filenames and extensions
case-sensitively on Dired buffers visiting case-sensitive filesystems,
and case-insensitively on case-insensitive filesystems.  Set it to
@code{nil} to be always case-sensitive, and to @code{t} to be always
case-insensitive.
@end defvar

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

@cindex omitting additional files
@defvar dired-omit-marker-char
Temporary marker used by Dired to implement omitting.  Should never be used
as marker by the user or other packages.  There is one exception to this rule:
by adding

@example
(setq dired-mark-keys "\C-o")
;; i.e., the value of dired-omit-marker-char
;; (which is not defined yet)
@end example

@noindent
to your @file{~/.emacs}, you can bind the @kbd{C-o} key to insert a
@kbd{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.
The default value is @kbd{C-o}.
@end defvar

@node Omitting Examples
@section Examples of Omitting Various File Types

@itemize @bullet

@item
@cindex RCS files, how to omit them in Dired
@cindex omitting RCS files in Dired
If you wish to avoid seeing RCS files and the @file{RCS} directory, then use

@example
(setq dired-omit-files
      (concat dired-omit-files "\\|^RCS$\\|,v$"))
@end example

@noindent
after loading @file{dired-x} (@pxref{Installation}).  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.

@item
@cindex tib files, how to omit them in Dired
@cindex omitting tib files in Dired
If you use @code{tib}, the bibliography program for use with @TeX{} and
@LaTeX{}, and you
want to omit the @file{INDEX} and the @file{*-t.tex} files, then use

@example
(setq dired-omit-files
      (concat dired-omit-files "\\|^INDEX$\\|-t\\.tex$"))
@end example

@noindent
after loading @file{dired-x} (@pxref{Installation}).

@item
@cindex dot files, how to omit them in Dired
@cindex omitting dot files in Dired
If you do not wish to see @samp{dot} files (files starting with a @file{.}),
then use

@example
(setq dired-omit-files
      (concat dired-omit-files "\\|^\\..+$"))
@end example

@noindent
after loading @file{dired-x} (@pxref{Installation}).  (Of course, a
better way to achieve this particular goal is simply to omit @samp{-a} from
@code{dired-listing-switches}.)

@end itemize

@node Omitting Technical
@section Some Technical Details of Omitting

Loading @file{dired-x.el} will install Dired Omit by putting
@code{dired-omit-expunge} on your @code{dired-after-readin-hook}, and will
call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
in your @code{dired-mode-hook}.

@node Shell Command Guessing
@chapter Shell Command Guessing
@cindex guessing shell commands for files.

Based upon the name of a file, 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.

The default is mentioned in brackets and you can type @kbd{M-n} to get
the default into the minibuffer and then edit it, e.g., to change
@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-n} 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.

The following variables control guessing of shell commands:

@defvar dired-guess-shell-alist-default
This variable specifies the predefined rules for guessing shell
commands suitable for certain files.  Set this to @code{nil} to turn
guessing off.  The elements of @code{dired-guess-shell-alist-user}
(defined by the user) will override these rules.
@end defvar

@defvar dired-guess-shell-alist-user
If non-@code{nil}, this variables specifies the user-defined alist of
file regexps and their suggested commands.  These rules take
precedence over the predefined rules in the variable
@code{dired-guess-shell-alist-default} (to which they are prepended)
when @code{dired-do-shell-command} is run).  The default is
@code{nil}.

Each element of the alist looks like

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

@noindent
where each @var{command} can either be a string or a Lisp expression
that evaluates to a string.  If several commands are given, all of
them will temporarily be pushed onto the history.

A @samp{*} in the shell command stands for the file name that matched
@var{regexp}.  When Emacs invokes the @var{command}, it replaces each
instance of @samp{*} with the matched file name.

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-guess-shell-alist-user
      (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.
@end defvar

@defvar dired-guess-shell-case-fold-search
If this variable is non-@code{nil},
@code{dired-guess-shell-alist-default} and
@code{dired-guess-shell-alist-user} are matched case-insensitively.
The default is @code{t}.
@end defvar

@cindex passing GNU Tar its @samp{z} switch.
@defvar dired-guess-shell-gnutar
If this variable is non-@code{nil}, it specifies the name of the GNU
Tar executable (e.g., @file{tar} or @file{gnutar}).  GNU Tar's
@samp{z} switch is used for compressed archives.  If you don't have
GNU Tar, set this to @code{nil}: a pipe using @command{zcat} is then
used instead.  The default is @code{nil}.
@end defvar

@cindex @code{gzip}
@defvar dired-guess-shell-gzip-quiet
A non-@code{nil} value of this variable means that @samp{-q} is passed
to @command{gzip}, possibly overriding a verbose option in the @env{GZIP}
environment variable.  The default is @code{t}.
@end defvar

@cindex @code{znew}
@defvar dired-guess-shell-znew-switches nil
This variable specifies a string of switches passed to @command{znew}.
An example is @samp{-K} which will make @command{znew} keep a @file{.Z}
file when it is smaller than the @file{.gz} file.  The default is
@code{nil}: no additional switches are passed to @command{znew}.
@end defvar

@defvar dired-shell-command-history nil
This variable holds the history list for commands that read
dired-shell commands.
@end defvar

@node Virtual Dired
@chapter Virtual Dired

@cindex virtual Dired
@cindex perusing @code{ls} listings
@cindex @command{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 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 edit all
@file{*.dired} files automatically 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

@noindent
The regexp is a bit more complicated than usual to exclude @file{.dired}
local-variable files.

@node Advanced Mark Commands
@chapter Advanced Mark Commands

@table @kbd
@item F
@kindex F
@cindex visiting several files at once
@cindex simultaneous visiting of several files
@findex dired-do-find-marked-files
(@code{dired-do-find-marked-files}) Find all marked files at once displaying
them simultaneously.  If optional @var{noselect} is non-@code{nil} then just
find the
files but do not select.  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 marked, as evenly as possible.
Remaining lines go to the bottom-most 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 automatically prepended to the string entered when not present.
If invoked with prefix argument @kbd{C-u}, this command unmarks files instead.
If called with the @kbd{C-u C-u} prefix, asks for a character to use
as the marker, and marks files with it.

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-mark-suffix
@findex dired-mark-suffix
Mark all files with a certain suffix for use in later commands.  A @samp{.}
is not automatically prepended to the string entered, you must type it
explicitly.  This is different from @code{dired-mark-extension} which prepends
a @samp{.} if not present.
If invoked with prefix argument @kbd{C-u}, this command unmarks files instead.
If called with the @kbd{C-u C-u} prefix, asks for a character to use
as the marker, and marks files with it.

When called from Lisp, @var{suffix} may also be a list of suffixes
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.
@end table

@ifnottex
@menu
* Advanced Cleaning Functions::
* Advanced Cleaning Variables::
* Special Marking Function::
@end menu
@end ifnottex

@node Advanced Cleaning Functions
@section Advanced Cleaning Functions

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

@item dired-clean-tex
@findex dired-clean-tex
Flag dispensable files created by @TeX{}, @LaTeX{}, and @samp{texinfo} for
deletion.  See the following variables (@pxref{Advanced Cleaning Variables}):

@itemize @bullet
@item
@code{dired-tex-unclean-extensions}
@item
@code{dired-texinfo-unclean-extensions}
@item
@code{dired-latex-unclean-extensions}
@item
@code{dired-bibtex-unclean-extensions}
@end itemize

@item dired-very-clean-tex
@findex dired-very-clean-tex
Flag dispensable files created by @TeX{}, @LaTeX{}, @samp{texinfo},
and @file{*.dvi} files for deletion.
@end table

@node Advanced Cleaning Variables
@section Advanced Cleaning Variables

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

@defvar dired-patch-unclean-extensions
This variable specifies the list of extensions of dispensable files
created by the @samp{patch} program.  The default is @w{@code{(".rej"
".orig")}}.
@end defvar

@defvar dired-tex-unclean-extensions
This variable specifies the list of extensions of dispensable files
created by @TeX{}.  The default is @w{@code{(".toc" ".log" ".aux")}}.
@end defvar

@defvar dired-texinfo-unclean-extensions
This variable holds the list of extensions of dispensable files
created by @samp{texinfo}.  The default is @w{@code{(".cp" ".cps" ".fn"
".fns" ".ky" ".kys"} @code{".pg" ".pgs" ".tp" ".tps" ".vr" ".vrs")}}
@end defvar

@defvar dired-latex-unclean-extensions
This variable specifies the list of extensions of dispensable files
created by @LaTeX{}.  The default is @w{@code{(".idx" ".lof" ".lot"
".glo")}}.
@end defvar

@defvar dired-bibtex-unclean-extensions
This variable specifies the list of extensions of dispensable files
created by Bib@TeX{}.  The default is @w{@code{(".blg" ".bbl")}}.
@end defvar

@node Special Marking Function
@section Special Marking Function

@table @kbd
@item M-(
@kindex M-(
@findex dired-mark-sexp
@cindex lisp expression, marking files with in Dired
@cindex mark file by Lisp expression
Mark files for which @var{predicate} returns non-@code{nil}
(@code{dired-mark-sexp}).  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 @code{""}
@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.

@end table

@node Multiple Dired Directories
@chapter 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 it still has only 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}.

@findex dired-smart-shell-command
@findex shell-command
@kindex M-!
The command @code{dired-smart-shell-command}, bound to @kbd{M-!} in
Dired buffers, is like @code{shell-command}, but it runs with
@code{default-directory} bound to the current Dired directory.

@node Find File At Point
@chapter Find File At Point
@cindex visiting a file mentioned in a buffer
@cindex finding a file at point

@file{dired-x} provides a method of visiting or editing a file mentioned in
the buffer you are viewing (e.g., a mail buffer, a news article, a
@file{README} file, etc.)@: or to test if that file exists.  You can then modify
this in the minibuffer after snatching the file name.

When installed @file{dired-x} will substitute @code{dired-x-find-file} for
@code{find-file} (normally bound to @kbd{C-x C-f}) and
@code{dired-x-find-file-other-window} for @code{find-file-other-window}
(normally bound to @kbd{C-x 4 C-f}).

In order to use this feature, you will need to set
@code{dired-x-hands-off-my-keys} to @code{nil} before loading @file{dired-x}
(@pxref{Optional Installation File At Point}).

@table @code
@item dired-x-find-file
@findex dired-x-find-file
@kindex C-x C-f

@code{dired-x-find-file} behaves exactly like @code{find-file} (normally bound
to @kbd{C-x C-f}) unless a prefix argument is passed to the function in which
case it will use the file name at point as a guess for the file to visit.

For example, if the buffer you were reading contained the words

@example
Available via anonymous ftp in

   /roebling.poly.edu:/pub/lisp/crypt++.el.gz
@end example

@noindent
then you could move your cursor to the line containing the ftp address and
type @kbd{C-u C-x C-f} (the @kbd{C-u} is a universal argument).  The
minibuffer would read

@example
Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gz
@end example

@noindent
with the point after the last @code{/}.  If you hit @key{RET}, emacs will visit
the file at that address.  This also works with files on your own computer.

@item dired-x-find-file-other-window
@findex dired-x-find-file-other-window
@kindex C-x 4 C-f

@code{dired-x-find-file-other-window} behaves exactly like
@code{find-file-other-window} (normally bound to @kbd{C-x 4 C-f}) unless a
prefix argument is used.  See @code{dired-x-find-file} for more information.

@item dired-x-hands-off-my-keys
@vindex dired-x-hands-off-my-keys
If set to @code{t}, then it means that @file{dired-x} should @emph{not} bind
@code{dired-x-find-file} over @code{find-file} on keyboard.  Similarly, it
should not bind @code{dired-x-find-file-other-window} over
@code{find-file-other-window}.  If you change this variable after
@file{dired-x.el} is loaded then do @kbd{M-x dired-x-bind-find-file}.  The
default value of this variable is @code{t}; by default, the binding is not
done.  @xref{Optional Installation File At Point}.

@item dired-x-bind-find-file
@findex dired-x-bind-find-file
A function, which can be called interactively or in your @file{~/.emacs} file,
that uses the value of @code{dired-x-hands-off-my-keys} to determine if
@code{dired-x-find-file} should be bound over @code{find-file} and
@code{dired-x-find-file-other-window} bound over
@code{find-file-other-window}.  @xref{Optional Installation File At Point}.
@end table

@node Miscellaneous Commands
@chapter Miscellaneous Commands

Miscellaneous features not fitting anywhere else:

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

If non-@code{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 @key{RET}}
will toggle between those two.
@end table

@table @kbd
@findex dired-goto-subdir
@kindex M-G
@item M-G
(@code{dired-goto-subdir}) Go to the header line of an inserted directory.
This command reads its argument, with completion derived from the names of the
inserted subdirectories.
@end table

@table @code

@item dired-vm
@cindex reading mail.
@kindex V
@findex dired-vm
Bound to @kbd{V} if @code{dired-bind-vm} is @code{t}.  Run VM on this
file (assumed to be a UNIX mail folder).

@vindex dired-vm-read-only-folders
If you give this command a prefix argument, it will visit the folder
read-only.

If the variable @code{dired-vm-read-only-folders} is @code{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.

@vindex dired-bind-vm
If the variable @code{dired-bind-vm} is @code{t}, @code{dired-vm} will be bound
to @kbd{V}.  Otherwise, @code{dired-bind-rmail} will be bound.

@item dired-rmail
@cindex reading mail.
@findex dired-rmail
Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}.  Run Rmail on this
file (assumed to be mail folder in Rmail format).

@item dired-info
@kindex I
@cindex running info.
@findex dired-info
Bound to @kbd{I}.  Run Info on this file (assumed to be a file in Info
format).

@vindex dired-bind-info
If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
not be bound to @kbd{I}.

@item dired-man
@cindex running man.
@kindex N
@findex dired-man
Bound to @kbd{N}.  Run man on this file (assumed to be a file in @code{nroff}
format).

@vindex dired-bind-man
If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
be bound to @kbd{N}.

@item dired-do-relsymlink
@cindex relative symbolic links.
@kindex Y
@findex dired-do-relsymlink
Bound to @kbd{Y}.  Relative symlink all marked (or next ARG) files into a
directory, or make a relative 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
@kindex %Y
@findex dired-do-relsymlink-regexp
Bound to @kbd{%Y}.  Relative symlink all marked files containing
@var{regexp} to @var{newname}.  See functions
@code{dired-do-rename-regexp} and @code{dired-do-relsymlink} for more
info.
@end table

@node Bugs
@chapter Bugs
@cindex bugs

@noindent
If you encounter a bug in this package, or wish to suggest an
enhancement, then please use @kbd{M-x report-emacs-bug} to report it.

@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include doclicense.texi

@node     Concept Index
@unnumbered Concept Index
@printindex cp

@node     Command Index
@unnumbered Function Index
@printindex fn

@node     Key Index
@unnumbered Key Index
@printindex ky

@node     Variable Index
@unnumbered Variable Index
@printindex vr

@bye