*** empty log message ***
[bpt/emacs.git] / man / dired-x.texi
CommitLineData
6bf7aab6
DL
1\input texinfo @comment -*-texinfo-*-
2
3@c dired-x.texi --- Sebastian Kremer's Extra DIRED hacked up for GNU Emacs19
4@c
5@c Author: Sebastian Kremer <sk@thp.uni-koeln.de>
6@c Lawrence R. Dodd <dodd@roebling.poly.edu>
25489206 7@c [Dodd's address no longer valid.]
6bf7aab6
DL
8@c Version: 2.52
9@c Date: 1994/08/09 16:51:31
10@c Keywords: dired extensions
11@c dired-x.el REVISION NUMBER: 2
12
13@c State: Released
14@c Ident: dired-x.texi,v 2.52 1994/08/09 16:51:31 dodd Released
15
16@comment %**start of header (This is for running Texinfo on a region.)
17@c FOR GNU EMACS USE ../info/dired-x BELOW
18@setfilename ../info/dired-x
19@c dired-x.el REVISION NUMBER
20@settitle Dired Extra Version 2 User's Manual
21
22@dircategory Editors
23@direntry
24* Dired-X: (dired-x). Dired Extra Features.
25@end direntry
26
27@iftex
28@finalout
29@end iftex
30@c @setchapternewpage odd % For book style double sided manual.
31@comment %**end of header (This is for running Texinfo on a region.)
32@c @smallbook
33@tex
34\overfullrule=0pt
35%\global\baselineskip 30pt % For printing in double spaces
36@end tex
37
38@ifinfo
39@node Copyright, Top, (dir), (dir)
40@comment node-name, next, previous, up
25489206 41This documents the ``extra'' features for Dired Mode for GNU Emacs found in
6bf7aab6
DL
42the file @file{dired-x.el}.
43
44Copyright @copyright{} 1993, 1994 Free Software Foundation, Inc.
45
46Permission is granted to make and distribute verbatim copies of this
47manual provided the copyright notice and this permission notice are
48preserved on all copies.
49
50Permission is granted to copy and distribute modified versions of
51this manual under the conditions for verbatim copying, provided that
52the entire resulting derived work is distributed under the terms of
53a permission notice identical to this one.
54
55Permission is granted to copy and distribute translations of this
56manual into another language, under the above conditions for
57modified versions, except that this permission notice may be stated
58in a translation approved by the Free Software Foundation.
59
60The file used to create this is called @file{dired-x.texi}, but the
61original work that was altered to make that file was called
62@file{dired.texi} written by Sebastian Kremer.
63
64@ignore
65Permission is granted to process this file through TeX and print the
66results, provided the printed document carries copying permission
67notice identical to this one except for the removal of this paragraph
68(this paragraph not being relevant to the printed manual).
69
70@end ignore
71@end ifinfo
72
73@c
74@titlepage
75@sp 6
76@c dired-x.el REVISION NUMBER
77@center @titlefont{Dired Extra Version 2}
78@sp 2
25489206 79@center @titlefont{For The GNU Emacs}
6bf7aab6
DL
80@sp 1
81@center @titlefont{Directory Editor}
82@sp 4
83@center Manual Revision: 2.52
84@center 1994/08/09 16:51:31
85@sp 5
86@center Lawrence R@. Dodd
25489206 87@c @center @t{dodd@@roebling.poly.edu}
6bf7aab6
DL
88@sp 5
89@center (Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>)
90@page
91@vskip 0pt plus 1filll
92Copyright @copyright{} 1993, 1994 Free Software Foundation
93
94Permission is granted to make and distribute verbatim copies of
95this manual provided the copyright notice and this permission notice
96are preserved on all copies.
97
98Permission is granted to copy and distribute modified versions of
99this manual under the conditions for verbatim copying, provided that
100the entire resulting derived work is distributed under the terms of
101a permission notice identical to this one.
102
103Permission is granted to copy and distribute translations of this
104manual into another language, under the above conditions for
105modified versions, except that this permission notice may be stated
106in a translation approved by the Free Software Foundation.
107
108The file used to create this is called @file{dired-x.texi}, but the
109original work that was altered to make that file was called
110@file{dired.texi} written by Sebastian Kremer.
111
112@end titlepage
113
114@page
115
116@ifinfo
117
118@node Top, Introduction, Copyright, (dir)
119@comment node-name, next, previous, up
120
121@noindent
25489206 122This documents the ``extra'' features for Dired Mode for GNU Emacs that are
6bf7aab6
DL
123provided by the file @file{dired-x.el}.
124
125@itemize @bullet
126
127@item
128Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>
129
130@c dired-x.el REVISION NUMBER
131@item
132For @file{dired-x.el} revision 2
133
25489206
DL
134@c @item
135@c Revision of this manual: 2.52 (1994/08/09 16:51:31)
6bf7aab6 136
25489206
DL
137@c @item
138@c Bugs to Lawrence R. Dodd <dodd@@roebling.poly.edu>. @emph{Please} type
139@c @kbd{M-x dired-x-submit-report} to submit a bug report (@pxref{Bugs}).
6bf7aab6 140
25489206
DL
141@c @item
142@c You can obtain a copy of this package via anonymous ftp in
143@c @t{/roebling.poly.edu:/pub/packages/dired-x.tar.gz}
6bf7aab6
DL
144
145@end itemize
146
147@menu
148* Introduction::
149* Installation::
150* Omitting Files in Dired::
151* Local Variables::
152* Shell Command Guessing::
153* Virtual Dired::
154* Advanced Mark Commands::
155* Multiple Dired Directories::
156* Find File At Point::
157* Miscellaneous Commands::
158* Bugs::
159
160* Concept Index::
161* Command Index::
162* Key Index::
163* Variable Index::
164
165@end menu
166
167@end ifinfo
168
169@node Introduction, Features, Top, Top
170@comment node-name, next, previous, up
171@chapter Introduction
172
25489206
DL
173This documents the @emph{extra} features for Dired Mode for GNU Emacs. It
174is derived from version 1.191 of Sebastian Kremer's @file{dired-x.el}.
6bf7aab6
DL
175
176In adopting this @file{dired-x.el} to GNU Emacs v19 some material that has
177been incorporated into @file{dired.el} and @file{dired-aux.el} of the GNU Emacs
17819 distribution has been removed and some material was modified for agreement
179with the functions in @file{dired.el} and @file{dired-aux.el}. For example,
180the code using @code{gmhist} history functions was replaced with code using
25489206 181the mini-buffer history now built into GNU Emacs. Finally, a few other
6bf7aab6
DL
182features have been added and a few more functions have been bound to keys.
183
6bf7aab6
DL
184@ifinfo
185@menu
186* Features::
187* Technical Details::
188@end menu
189@end ifinfo
190
191@node Features, Technical Details, Introduction, Introduction
192@comment node-name, next, previous, up
193@section Features
194@cindex Features
195
196Some features provided by Dired Extra
197
198@enumerate
199@item
200Omitting of uninteresting files from dired listing.
201@itemize @bullet
4563d12e 202@xref{Omitting Files in Dired}.
6bf7aab6
DL
203@end itemize
204@item
205Local variables for dired directories.
206@itemize @bullet
4563d12e 207@xref{Local Variables}.
6bf7aab6
DL
208@end itemize
209@item
210Guessing shell commands in dired buffers.
211@itemize @bullet
4563d12e 212@xref{Shell Command Guessing}.
6bf7aab6
DL
213@end itemize
214@item
215Running dired command in non-dired buffers.
216@itemize @bullet
4563d12e 217@xref{Virtual Dired}.
6bf7aab6
DL
218@end itemize
219@item
220Finding a file mentioned in a buffer
221@itemize @bullet
4563d12e 222@xref{Find File At Point}.
6bf7aab6
DL
223@end itemize
224@item
225Commands using file marking.
226@itemize @bullet
4563d12e 227@xref{Advanced Mark Commands}.
6bf7aab6
DL
228@end itemize
229@end enumerate
230
231@noindent
4563d12e 232@file{dired-x.el} binds some functions to keys in Dired Mode (@pxref{Key
6bf7aab6 233Index}) and also binds @kbd{C-x C-j} and @kbd{C-x 4 C-j} @emph{globally} to
4563d12e 234@code{dired-jump} (@pxref{Miscellaneous Commands}). It may also bind @kbd{C-x
6bf7aab6 235C-f} and @kbd{C-x 4 C-f} to @code{dired-x-find-file} and
4563d12e 236@code{dired-x-find-file-other-window}, respectively (@pxref{Find File At
6bf7aab6
DL
237Point}).
238
239@node Technical Details, Installation, Features, Introduction
240@comment node-name, next, previous, up
241@section Technical Details
242@cindex Redefined functions
243@cindex @file{dired-aux.el}
244
245When loaded this code @emph{redefines} the following functions of GNU Emacs
246from @file{dired.el}
247
248@itemize @bullet
249@item
250@code{dired-clean-up-after-deletion}
251@item
252@code{dired-find-buffer-nocreate}
253@item
254@code{dired-initial-position}
255@item
256@code{dired-up-directory}
257@end itemize
258
259@noindent
260and the following functions from @file{dired-aux.el}
261
262@itemize @bullet
263@item
264@code{dired-add-entry}
265@item
266@code{dired-read-shell-command}
267@end itemize
268
6bf7aab6
DL
269@node Installation, Optional Installation Dired Jump, Technical Details, Top
270@comment node-name, next, previous, up
271@chapter Installation
272
273@noindent
274This manual describes the dired features provided by the file
275@file{dired-x.el}. To take advantage of these features, you must load the
276file and (optionally) set some variables.
277
278@noindent
279In your @file{.emacs} file in your home directory, or in the system-wide
280initialization file @file{default.el} in the @file{site-lisp} directory, put
281
282@example
283(add-hook 'dired-load-hook
bed44076
SM
284 (lambda ()
285 (load "dired-x")
286 ;; Set dired-x global variables here. For example:
287 ;; (setq dired-guess-shell-gnutar "gtar")
288 ;; (setq dired-x-hands-off-my-keys nil)
289 ))
6bf7aab6 290(add-hook 'dired-mode-hook
bed44076
SM
291 (lambda ()
292 ;; Set dired-x buffer-local variables here. For example:
293 ;; (setq dired-omit-files-p t)
294 ))
6bf7aab6
DL
295@end example
296
297@noindent
298This will load @file{dired-x.el} when dired is first invoked (for example,
299when you first do @kbd{C-x d}).
300
301@ifinfo
302@menu
303* Optional Installation Dired Jump::
304* Optional Installation File At Point::
6bf7aab6
DL
305@end menu
306@end ifinfo
307
308@node Optional Installation Dired Jump, Optional Installation File At Point, Installation, Installation
309@comment node-name, next, previous, up
310@section Optional Installation Dired Jump
311
312@cindex Autoloading @code{dired-jump} and @code{dired-jump-other-window}
313
314In order to have @code{dired-jump} and @code{dired-jump-other-window}
4563d12e 315(@pxref{Miscellaneous Commands}) work @emph{before} @code{dired} and
6bf7aab6
DL
316@code{dired-x} have been properly loaded the user should set-up an autoload
317for these functions. In your @file{.emacs} file put
318
319@example
320;;; Autoload `dired-jump' and `dired-jump-other-window'.
321;;; We autoload from FILE dired.el. This will then load dired-x.el
322;;; and hence define `dired-jump' and `dired-jump-other-window'.
323(define-key global-map "\C-x\C-j" 'dired-jump)
324(define-key global-map "\C-x4\C-j" 'dired-jump-other-window)
325
326(autoload (quote dired-jump) "dired" "\
327Jump to dired buffer corresponding to current buffer.
328If in a file, dired the current directory and move to file's line.
329If in dired already, pop up a level and goto old directory's line.
330In case the proper dired file line cannot be found, refresh the dired
331buffer and try again." t nil)
332
333(autoload (quote dired-jump-other-window) "dired" "\
334Like \\[dired-jump] (dired-jump) but in other window." t nil)
335@end example
336
337Note that in recent releases of GNU Emacs 19 (i.e., 19.25 or later) the file
338@file{../lisp/loaddefs.el} of the Emacs distribution already contains the
339proper auto-loading for @code{dired-jump} so you need only put
340
341@example
342(define-key global-map "\C-x\C-j" 'dired-jump)
343@end example
344
345@noindent in your @file{.emacs} file in order to have @kbd{C-x C-j} work
346before @code{dired} is loaded.
347
25489206 348@node Optional Installation File At Point, , Optional Installation Dired Jump, Installation
6bf7aab6
DL
349@comment node-name, next, previous, up
350@section Optional Installation File At Point
351
352@cindex Binding @code{dired-x-find-file}
353If you choose to have @file{dired-x.el} bind @code{dired-x-find-file} over
4563d12e 354@code{find-file} (@pxref{Find File At Point}), then you will need to set
6bf7aab6
DL
355@code{dired-x-hands-off-my-keys} and make a call to the function
356@code{dired-x-bind-find-file} in the @code{dired-load-hook}:
357
358@example
359(add-hook 'dired-load-hook
bed44076
SM
360 (lambda ()
361 (load "dired-x")
362 ;; Bind dired-x-find-file.
363 (setq dired-x-hands-off-my-keys nil)
364 ;; Make sure our binding preference is invoked.
365 (dired-x-bind-find-file)
366 ))
6bf7aab6
DL
367@end example
368
369Alternatively, you can set the variable @emph{before} @file{dired-x.el} is
370loaded
371
372@example
373(add-hook 'dired-load-hook
bed44076
SM
374 (lambda ()
375 ;; Bind dired-x-find-file.
376 (setq dired-x-hands-off-my-keys nil)
377 (load "dired-x")
378 ))
6bf7aab6
DL
379@end example
380
25489206 381@node Omitting Files in Dired, Omitting Variables, , Top
6bf7aab6
DL
382@comment node-name, next, previous, up
383@chapter Omitting Files in Dired
384
385@cindex Omitting Files in Dired
386@dfn{Omitting} a file means removing it from the directory listing. Omitting
387is useful for keeping Dired buffers free of ``uninteresting'' files (for
388instance, auto-save, auxiliary, backup, and revision control files) so that
389the user can concentrate on the interesting files. Like hidden files, omitted
390files are never seen by Dired. Omitting differs from hiding in several
391respects:
392
393@itemize @bullet
394
395@item
396Omitting works on individual files, not on directories; an entire directory
397cannot be omitted (though each of its files could be).
398
399@item
400Omitting is wholesale; if omitting is turned on for a dired buffer, then all
401uninteresting files listed in that buffer are omitted. The user does not omit
402(or unomit) files one at a time.
403
404@item
405Omitting can be automatic; uninteresting file lines in the buffer can be
406removed before the user ever sees them.
407
408@item
409Marked files are never omitted.
410@end itemize
411
412@table @kbd
413@item M-o
414@kindex M-o
415@findex dired-omit-toggle
416(@code{dired-omit-toggle}) Toggle between displaying and omitting
417``uninteresting'' files. With a prefix argument, don't toggle and just mark
418the files, but don't actually omit them.
419@end table
420
421@noindent
422In order to make Dired Omit work you first need to load @file{dired-x.el}
4563d12e
DL
423inside @code{dired-load-hook} (@pxref{Installation}) and then set
424@code{dired-omit-files-p} in some way (@pxref{Omitting Variables}).
6bf7aab6
DL
425
426@ifinfo
427@menu
428* Omitting Variables::
429* Omitting Examples::
430* Omitting Technical::
431@end menu
432@end ifinfo
433
434@node Omitting Variables, Omitting Examples, Omitting Files in Dired, Omitting Files in Dired
435@comment node-name, next, previous, up
436
437@section Omitting Variables
438
439The following variables can be used to customize omitting.
440
441@table @code
442
443@vindex dired-omit-files-p
444@item dired-omit-files-p
445
446Default: @code{nil}
447
448@cindex How to make omitting the default in Dired
449If non-@code{nil}, ``uninteresting'' files are not listed. Uninteresting
450files are those whose filenames match regexp @code{dired-omit-files}, plus
451those ending with extensions in @code{dired-omit-extensions}. @kbd{M-o}
452(@code{dired-omit-toggle}) toggles its value, which is buffer-local. Put
453
454@example
455(setq dired-omit-files-p t)
456@end example
457
458inside your @code{dired-mode-hook} to have omitting initially turned on in
4563d12e 459@emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to
6bf7aab6
DL
460unomit in that buffer.
461
462To enable omitting automatically only in certain directories one can use Dired
463Local Variables and put
464
465@example
466Local Variables:
467dired-omit-files-p: t
468End:
469@end example
470
471@noindent
472into a file @file{.dired} (the default value of
4563d12e 473@code{dired-local-variables-file}) in that directory (@pxref{Local Variables}).
6bf7aab6
DL
474
475@table @code
476@findex dired-omit-here-always
477@item dired-omit-here-always
478
479This is an interactive function that creates a local variables file exactly
480like the example above (if it does not already exist) in the file
481@code{dired-local-variables-file} in the current directory and then refreshes
4563d12e 482the directory listing (@pxref{Local Variables}).
6bf7aab6
DL
483@end table
484
485@vindex dired-omit-files
486@item dired-omit-files
487
488Default: @code{"^#\\|\\.$"}
489
490Filenames matching this buffer-local regexp will not be displayed.
491This only has effect when @code{dired-omit-files-p} is t.
492
493The default value omits the special directories @file{.} and @file{..} and
4563d12e 494autosave files (plus other files ending in ``.'') (@pxref{Omitting Examples}).
6bf7aab6
DL
495
496@vindex dired-omit-extensions
497@item dired-omit-extensions
498
499Default: The elements of @code{completion-ignored-extensions} (as defined in
500the file @file{loaddefs.el} of the GNU Emacs distribution),
501@code{dired-latex-unclean-extensions}, @code{dired-bibtex-unclean-extensions}
502and @code{dired-texinfo-unclean-extensions}.
503
504If non-@code{nil}, a list of extensions (strings) to omit from Dired listings.
505Its format is the same as that of @code{completion-ignored-extensions}.
506
507@vindex dired-omit-localp
508@item dired-omit-localp
509
510Default: @code{'no-dir}
511
512The @var{localp} argument @code{dired-omit-expunge} passes to
513@code{dired-get-filename}. If it is @code{'no-dir}, omitting is much faster,
514but you can only match against the non-directory part of the filename. Set it
515to @code{nil} if you need to match the whole pathname or @code{t} to match the
516pathname relative to the buffer's top-level directory.
517
518@item dired-omit-marker-char
519@vindex dired-omit-marker-char
520@cindex Omitting additional files
521Default: @kbd{C-o}
522
523Temporary marker used by by Dired to implement omitting. Should never be used
524as marker by the user or other packages. There is one exception to this rule:
525by doing
526
527@example
528(setq dired-mark-keys "\C-o")
529;; i.e., the value of dired-omit-marker-char
530;; (which is not defined yet)
531@end example
532
533anywhere in your @file{~/.emacs}, you will bind the @kbd{C-o} key to insert a
534@kbd{C-o} marker, thus causing these files to be omitted in addition to the
535usually omitted files. Unfortunately the files you omitted manually this way
536will show up again after reverting the buffer, unlike the others.
537
538@end table
539
540@node Omitting Examples, Omitting Technical, Omitting Variables, Omitting Files in Dired
541@comment node-name, next, previous, up
542@section Examples of Omitting Various File Types
543
544@itemize @bullet
545
546@item
547@cindex RCS files, how to omit them in Dired
548@cindex Omitting RCS files in Dired
549If you wish to avoid seeing RCS files and the RCS directory, then put
550
551@example
552(setq dired-omit-files
553 (concat dired-omit-files "\\|^RCS$\\|,v$"))
554@end example
555@noindent
4563d12e 556in the @code{dired-load-hook} (@pxref{Installation}). This assumes
6bf7aab6
DL
557@code{dired-omit-localp} has its default value of @code{'no-dir} to make the
558@code{^}-anchored matches work. As a slower alternative, with
559@code{dired-omit-localp} set to @code{nil}, you can use @code{/} instead of
560@code{^} in the regexp.
561
562@item
563@cindex Tib files, how to omit them in Dired
564@cindex Omitting tib files in Dired
565If you use tib, the bibliography program for use with @TeX{} and La@TeX{}, you
566might want to omit the @file{INDEX} and the @file{-t.tex} files, then put
567
568@example
569(setq dired-omit-files
570 (concat dired-omit-files "\\|^INDEX$\\|-t\\.tex$"))
571@end example
572
573@noindent
4563d12e 574in the @code{dired-load-hook} (@pxref{Installation}).
6bf7aab6
DL
575
576@item
577@cindex Dot files, how to omit them in Dired
578@cindex Omitting dot files in Dired
579If you do not wish to see @samp{dot} files (files starting with a @samp{.}),
580then put
581
582@example
583(setq dired-omit-files
584 (concat dired-omit-files "\\|^\\..+$"))
585@end example
586
587@noindent
4563d12e 588in the @code{dired-load-hook} (@pxref{Installation}).
6bf7aab6
DL
589
590@end itemize
591
592@node Omitting Technical, Local Variables, Omitting Examples, Omitting Files in Dired
593@comment node-name, next, previous, up
594@section Some Technical Details of Omitting
595
596Loading @file{dired-x.el} will install Dired Omit by putting
597@code{dired-omit-expunge} on your @code{dired-after-readin-hook}, and will
598call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
599in your @code{dired-mode-hook}.
600
601@node Local Variables, Shell Command Guessing, Omitting Technical, Top
602@comment node-name, next, previous, up
603@chapter Local Variables for Dired Directories
604
605@cindex Local Variables for Dired Directories
606@vindex dired-local-variables-file
607@vindex dired-enable-local-variables
608@noindent
609When Dired visits a directory, it looks for a file whose name is the value of
610variable @code{dired-local-variables-file} (default: @file{.dired}). If such
611a file is found, Dired will temporarily insert it into the Dired buffer and
612run @code{hack-local-variables}.
613
614@noindent
615For example, if the user puts
616
617@example
618Local Variables:
619dired-actual-switches: "-lat"
620dired-omit-files-p: t
621End:
622@end example
623
624@noindent
625into a file called @file{.dired} in a directory then when that directory is
626viewed it will be
627
628@enumerate
629@item
630sorted by date
631@item
632omitted automatically
633@end enumerate
634
635@noindent
636You can set @code{dired-local-variables-file} to @code{nil} to suppress this.
637The value of @code{dired-enable-local-variables} controls if and how these
638local variables are read. This variable exists so that if may override the
639default value of @code{enable-local-variables}.
640
641@noindent
642Please see the GNU Emacs Manual to learn more about local variables.
643@xref{File Variables,Local Variables in Files,Local Variables in
644Files,emacs,The GNU Emacs Manual}.
645
646@noindent
647The following variables affect Dired Local Variables
648
649@table @code
650@vindex dired-local-variables-file
651@item dired-local-variables-file
652Default: @code{".dired"}
653
654If non-@code{nil}, filename for local variables for Dired. If Dired finds a
655file with that name in the current directory, it will temporarily insert it
656into the dired buffer and run `hack-local-variables'.
657
658@vindex dired-enable-local-variables
659@item dired-enable-local-variables
660Default: @code{t}
661
662Controls use of local-variables lists in dired. The value can be @code{t},
663@code{nil}, or something else. A value of @code{t} means local-variables
664lists are obeyed in the @code{dired-local-variables-file}; @code{nil} means
665they are ignored; anything else means query. This variable temporarily
666overrides the value of @code{enable-local-variables} when the Dired Local
667Variables are hacked.
668@end table
669
670@node Shell Command Guessing, Virtual Dired, Local Variables, Top
671@comment node-name, next, previous, up
672@chapter Shell Command Guessing
673@cindex Guessing shell commands for files.
674
675Based upon the name of a filename, Dired tries to guess what shell
676command you might want to apply to it. For example, if you have point
677on a file named @file{foo.tar} and you press @kbd{!}, Dired will guess
678you want to @samp{tar xvf} it and suggest that as the default shell
679command.
680
681The default will be mentioned in brackets and you can type @kbd{M-p} to get
682the default into the minibuffer so that you can edit it, e.g., changing
683@samp{tar xvf} to @samp{tar tvf}. If there are several commands for a given
684file, e.g., @samp{xtex} and @samp{dvips} for a @file{.dvi} file, you can type
685@kbd{M-p} several times to see each of the matching commands.
686
687Dired only tries to guess a command for a single file, never for a list
688of marked files.
689
690@table @code
691@item dired-guess-shell-alist-default
692@vindex dired-guess-shell-alist-default
693Predefined rules for shell commands. Set this to @code{nil} to turn guessing off.
694The elements of @code{dired-guess-shell-alist-user} (defined by the
695user) will override these rules.@refill
696
697@item dired-guess-shell-alist-user
698@vindex dired-guess-shell-alist-user
699If non-@code{nil}, a user-defined alist of file regexps and their suggested
700commands. These rules take precedence over the predefined rules in the
701variable @code{dired-guess-shell-alist-default} (to which they are prepended)
702when @code{dired-do-shell-command} is run).
703@refill
704
705Each element of the alist looks like
706
707@example
708(@var{regexp} @var{command}@dots{})
709@end example
710
711where each @var{command} can either be a string or a lisp expression
712that evaluates to a string. If several @var{COMMAND}s are given, all
713will temporarily be pushed on the history.
714
715You can set this variable in your @file{~/.emacs}. For example,
716to add rules for @samp{.foo} and @samp{.bar} file extensions, write
717
718@example
719(setq dired-guess-shell-alist-user
720 (list
721 (list "\\.foo$" "@var{foo-command}");; fixed rule
722 ;; possibly more rules...
723 (list "\\.bar$";; rule with condition test
724 '(if @var{condition}
725 "@var{bar-command-1}"
726 "@var{bar-command-2}"))))
727@end example
728
729@noindent
730This will override any predefined rules for the same extensions.
731
732@item dired-guess-shell-gnutar
733@vindex dired-guess-shell-gnutar
734@cindex Passing GNU tar its `z' switch.
735Default: @code{nil}
736
737If non-@code{nil}, name of the GNU tar executable (e.g., @samp{"tar"} or
738@samp{"gnutar"}). GNU tar's @samp{z} switch is used for compressed tar files.
739If you don't have GNU tar, set this to @code{nil}: a pipe using @samp{zcat} is
740then used.
741
742@item dired-guess-shell-gzip-quiet
743@vindex dired-guess-shell-gzip-quiet
744@cindex GNU zip.
745Default: @code{t}
746
747A non-@code{nil} value means that @code{-q} is passed to gzip overriding a
0a2ea235 748verbose GNU zip's @env{GZIP} environment variable.
6bf7aab6
DL
749
750@item dired-guess-shell-znew-switches nil
751@vindex dired-guess-shell-znew-switches nil
752@cindex GNU zip.
753Default: @code{nil}
754
755A string of switches passed to GNU zip's @file{znew}. An example is
756@samp{"-K"} which will make @file{znew} keep a .Z file when it is smaller than
757the .gz file.
758
759@item dired-shell-command-history nil
760@vindex dired-shell-command-history nil
761
762History list for commands that read dired-shell commands.
763@end table
764
765@node Virtual Dired, Advanced Mark Commands, Shell Command Guessing, Top
766@comment node-name, next, previous, up
767@chapter Virtual Dired
768
769@cindex Virtual Dired
770@cindex Perusing ls listings
771@cindex ls listings, how to peruse them in Dired
772Using @dfn{Virtual Dired} means putting a buffer with Dired-like
773contents in Dired mode. The files described by the buffer contents need
774not actually exist. This is useful if you want to peruse an @samp{ls -lR}
775output file, for example one you got from an FTP server. You can use
776all motion commands usually available in Dired. You can also use
777it to save a Dired buffer in a file and resume it in a later session.
778
779@findex dired-virtual
780@kindex g
781@findex dired-virtual-revert
782Type @kbd{M-x dired-virtual} to put the current buffer into virtual
783Dired mode. You will be prompted for the top level directory of this
784buffer, with a default value guessed from the buffer contents. To
785convert the virtual to a real Dired buffer again, type @kbd{g} (which
786calls @code{dired-virtual-revert}) in the virtual Dired buffer and
787answer @samp{y}. You don't have to do this, though: you can relist
788single subdirectories using @kbd{l} (@code{dired-do-redisplay}) on the subdirectory
789headerline, leaving the buffer in virtual Dired mode all the time.
790
791@findex dired-virtual-mode
792@vindex auto-mode-alist
793The function @samp{dired-virtual-mode} is specially designed to turn on
794virtual Dired mode from the @code{auto-mode-alist}. To edit all
795@file{*.dired} files automatically in virtual Dired mode, put this into your
796@file{~/.emacs}:
797
798@example
799(setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode)
800 auto-mode-alist))
801@end example
802
803The regexp is a bit more complicated than usual to exclude ".dired"
804local variable files.
805
806@node Advanced Mark Commands, Advanced Cleaning Functions, Virtual Dired, Top
807@comment node-name, next, previous, up
808@chapter Advanced Mark Commands
809
810@table @kbd
811@item F
812@kindex F
813@cindex Visiting several files at once
814@cindex Simultaneous visiting of several files
815@findex dired-do-find-marked-files
816(@code{dired-do-find-marked-files}) Find all marked files at once displaying
817simultaneously. If optional NOSELECT is non-@code{nil} then just find the
818files but do not select. If you want to keep the dired buffer displayed, type
819@kbd{C-x 2} first. If you want just the marked files displayed and nothing
820else, type @kbd{C-x 1} first.
821
822The current window is split across all files marked, as evenly as possible.
823Remaining lines go to the bottom-most window. The number of files that can be
824displayed this way is restricted by the height of the current window and the
825variable @code{window-min-height}.
826@end table
827
828@table @code
829@item dired-mark-extension
830@findex dired-mark-extension
831Mark all files with a certain extension for use in later commands. A @samp{.}
832is not automatically prepended to the string entered.
833
834When called from lisp, @var{extension} may also be a list of extensions
835and an optional argument @var{marker-char} specifies the marker used.
836
837@item dired-flag-extension
838@findex dired-flag-extension
839Flag all files with a certain extension for deletion. A @samp{.} is
840@emph{not} automatically prepended to the string entered.
841@end table
842
843@ifinfo
844@menu
845* Advanced Cleaning Functions::
846* Advanced Cleaning Variables::
847* Special Marking Function::
848@end menu
849@end ifinfo
850
851@node Advanced Cleaning Functions, Advanced Cleaning Variables, Advanced Mark Commands, Advanced Mark Commands
852@comment node-name, next, previous, up
853
854@section Advanced Cleaning Functions
855
856@table @code
857@item dired-clean-patch
858@findex dired-clean-patch
859Flag dispensable files created by the @samp{patch} program for deletion. See
860variable @code{dired-patch-unclean-extensions}.
861
862@item dired-clean-tex
863@findex dired-clean-tex
864Flag dispensable files created by @TeX{}, La@TeX{}, and @samp{texinfo} for
4563d12e 865deletion. See the following variables (@pxref{Advanced Cleaning Variables}):
6bf7aab6
DL
866
867@itemize @bullet
868@item
869@code{dired-tex-unclean-extensions}
870@item
871@code{dired-texinfo-unclean-extensions}
872@item
873@code{dired-latex-unclean-extensions}
874@item
875@code{dired-bibtex-unclean-extensions}
876@end itemize
877
878@item dired-very-clean-tex
879@findex dired-very-clean-tex
880Flag dispensable files created by @TeX{}, La@TeX{}, @samp{texinfo}, and ".dvi"
881files for deletion.
882@end table
883
884@node Advanced Cleaning Variables, Special Marking Function, Advanced Cleaning Functions, Advanced Mark Commands
885@comment node-name, next, previous, up
886
887@section Advanced Cleaning Variables
888
889@noindent Variables used by the above cleaning commands (and in the default value for
4563d12e 890variable @code{dired-omit-extensions}, @pxref{Omitting Variables})
6bf7aab6
DL
891
892@table @code
893@item dired-patch-unclean-extensions
894@vindex dired-patch-unclean-extensions
895Default: @code{'(".rej" ".orig")}
896
897List of extensions of dispensable files created by the @samp{patch} program.
898
899@item dired-tex-unclean-extensions
900@vindex dired-tex-unclean-extensions
901Default: @code{'(".toc" ".log" ".aux")}
902
903List of extensions of dispensable files created by @TeX{}.
904
905@item dired-texinfo-unclean-extensions
906@vindex dired-texinfo-unclean-extensions
907Default: @code{'(".cp" ".cps" ".fn" ".fns" ".ky" ".kys"}
908@code{".pg" ".pgs" ".tp" ".tps" ".vr" ".vrs")}
909
910List of extensions of dispensable files created by @samp{texinfo}.
911
912@item dired-latex-unclean-extensions
913@vindex dired-latex-unclean-extensions
914Default: @code{'(".idx" ".lof" ".lot" ".glo")}
915
916List of extensions of dispensable files created by La@TeX{}.
917
918@item dired-bibtex-unclean-extensions
919@vindex dired-bibtex-unclean-extensions
920Default: @code{'(".blg" ".bbl")}
921
922List of extensions of dispensable files created by Bib@TeX{}.
923@end table
924
925@node Special Marking Function, Multiple Dired Directories, Advanced Cleaning Variables, Advanced Mark Commands
926@comment node-name, next, previous, up
927
928@section Special Marking Function
929
930@table @kbd
931@item M-(
932@kindex M-(
933@findex dired-mark-sexp
934@cindex Lisp expression, marking files with in Dired
935@cindex Mark file by lisp expression
936(@code{dired-mark-sexp}) Mark files for which @var{predicate} returns
937non-@code{nil}. With a prefix argument, unflag those files instead.
938
939The @var{predicate} is a lisp expression that can refer to the following
940symbols:
941@table @code
942@item inode
943[@i{integer}] the inode of the file (only for @samp{ls -i} output)
944@item s
945[@i{integer}] the size of the file for @samp{ls -s} output (usually in blocks or,
946with @samp{-k}, in KBytes)
947@item mode
948[@i{string}] file permission bits, e.g., @samp{"-rw-r--r--"}
949@item nlink
950[@i{integer}] number of links to file
951@item uid
952[@i{string}] owner
953@item gid
954[@i{string}] group (If the gid is not displayed by @samp{ls}, this
955will still be set (to the same as uid))
956@item size
957[@i{integer}] file size in bytes
958@item time
959[@i{string}] the time that @samp{ls} displays, e.g., @samp{"Feb 12 14:17"}
960@item name
961[@i{string}] the name of the file
962@item sym
963[@i{string}] if file is a symbolic link, the linked-to name, else @samp{""}
964@end table
965
966@noindent
967For example, use
968@example
969(equal 0 size)
970@end example
971to mark all zero length files.
972
973To find out all not yet compiled Emacs lisp files in a directory, dired
974all @file{.el} files in the lisp directory using the wildcard
975@samp{*.el}. Then use @kbd{M-(} with
976@example
977(not (file-exists-p (concat name "c")))
978@end example
979to mark all @file{.el} files without a corresponding @file{.elc} file.
980
981@end table
982
983@node Multiple Dired Directories, Find File At Point, Special Marking Function, Top
984@comment node-name, next, previous, up
985@chapter Multiple Dired Directories and Non-Dired Commands
986
987@cindex Multiple Dired directories
988@cindex Working directory
989An Emacs buffer can have but one working directory, stored in the
990buffer-local variable @code{default-directory}. A Dired buffer may have
991several subdirectories inserted, but still has but one working
992directory: that of the top level Dired directory in that buffer. For
993some commands it is appropriate that they use the current Dired
994directory instead of @code{default-directory}, e.g., @code{find-file} and
995@code{compile}.
996
997A general mechanism is provided for special handling of the working
998directory in special major modes:
999
1000@table @code
1001@item default-directory-alist
1002@vindex default-directory-alist
1003Default: @code{((dired-mode . (dired-current-directory)))}
1004
1005Alist of major modes and their opinion on @code{default-directory}, as a
1006lisp expression to evaluate. A resulting value of @code{nil} is ignored
1007in favor of @code{default-directory}.
1008
1009@item default-directory
1010@findex default-directory
1011Function with usage like variable @code{default-directory}, but knows about the
1012special cases in variable @code{default-directory-alist}.
1013@end table
1014
1015@node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top
1016@comment node-name, next, previous, up
1017
1018@section Find File At Point
1019@cindex Visiting a file mentioned in a buffer
1020@cindex Finding a file at point
1021
1022@file{dired-x} provides a method of visiting or editing a file mentioned in
1023the buffer you are viewing (e.g., a mail buffer, a news article, a README
1024file, etc.) or to test if that file exists. You can then modify this in the
1025minibuffer after snatching the filename.
1026
1027When installed @file{dired-x} will substitute @code{dired-x-find-file} for
1028@code{find-file} (normally bound to @kbd{C-x C-f}) and
1029@code{dired-x-find-file-other-window} for @code{find-file-other-window}
1030(normally bound to @kbd{C-x 4 C-f}).
1031
1032In order to use this feature, you will need to set
1033@code{dired-x-hands-off-my-keys} to @code{nil} inside @code{dired-load-hook}
4563d12e 1034(@pxref{Optional Installation File At Point}).
6bf7aab6
DL
1035
1036@table @code
1037@item dired-x-find-file
1038@findex dired-x-find-file
1039@kindex C-x C-f
1040
1041@code{dired-x-find-file} behaves exactly like @code{find-file} (normally bound
1042to @kbd{C-x C-f}) unless a prefix argument is passed to the function in which
1043case it will use the filename at point as a guess for the file to visit.
1044
1045For example, if the buffer you were reading contained the words
1046
1047@example
1048Available via anonymous ftp in
1049
1050 /roebling.poly.edu:/pub/lisp/crypt++.el.gz
1051@end example
1052
1053then you could move your cursor to the line containing the ftp address and
1054type @kbd{C-u C-x C-f} (the @kbd{C-u} is a universal argument). The
1055minibuffer would read
1056
1057@example
1058Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gz
1059@end example
1060
1061with the point after the last @code{/}. If you hit return emacs will visit
1062the file at that address. This also works with files on your own computer.
1063
1064@item dired-x-find-file-other-window
1065@findex dired-x-find-file-other-window
1066@kindex C-x 4 C-f
1067
1068@code{dired-x-find-file-other-window} behaves exactly like
1069@code{find-file-other-window} (normally bound to @kbd{C-x 4 C-f}) unless a
1070prefix argument is used. See @code{dired-x-find-file} for more information.
1071
1072@item dired-x-hands-off-my-keys
1073@vindex dired-x-hands-off-my-keys
1074If set to @code{t}, then it means that @file{dired-x} should @emph{not} bind
1075@code{dired-x-find-file} over @code{find-file} on keyboard. Similarly, it
1076should not bind @code{dired-x-find-file-other-window} over
1077@code{find-file-other-window}. If you change this variable after
1078@file{dired-x.el} is loaded then do @kbd{M-x dired-x-bind-find-file}. The
1079default value of this variable is @kbd{t}; by default, the binding is not
1080done. See @xref{Optional Installation File At Point}.
1081
1082@item dired-x-bind-find-file
1083@findex dired-x-bind-find-file
1084A function, which can be called interactively or in your @file{~/.emacs} file,
1085that uses the value of @code{dired-x-hands-off-my-keys} to determine if
1086@code{dired-x-find-file} should be bound over @code{find-file} and
1087@code{dired-x-find-file-other-window} bound over
1088@code{find-file-other-window}. See @xref{Optional Installation File At Point}.
1089@end table
1090
1091@node Miscellaneous Commands, Bugs, Find File At Point, Top
1092@comment node-name, next, previous, up
1093@chapter Miscellaneous Commands
1094
1095Miscellaneous features not fitting anywhere else:
1096
1097@table @code
1098@item dired-find-subdir
1099@vindex dired-find-subdir
1100Default: @code{nil}
1101
1102If non-@code{nil}, Dired does not make a new buffer for a directory if it can
1103be found (perhaps as subdirectory) in some existing Dired buffer.
1104
1105If there are several Dired buffers for a directory, the most recently
1106used is chosen.
1107
1108Dired avoids switching to the current buffer, so that if you have a
1109normal and a wildcard buffer for the same directory, @kbd{C-x d RET}
1110will toggle between those two.
1111@end table
1112
1113@table @kbd
1114@findex dired-goto-file
1115@kindex M-g
1116@item M-g
1117(@code{dired-goto-file}) Goto file line of a file (or directory).
1118
1119@findex dired-goto-subdir
1120@kindex M-G
1121@item M-G
1122(@code{dired-goto-subdir}) Goto headerline of an inserted directory.
1123This commands reads its argument with completion over the names of the
1124inserted subdirectories.
1125@end table
1126
1127@table @kbd
1128@item w
1129@cindex Adding to the kill ring in dired.
1130@kindex w
1131@findex dired-copy-filename-as-kill
1132(@code{dired-copy-filename-as-kill}) The @kbd{w} command puts the names
1133of the marked (or next @var{N}) files into the kill ring, as if you had
1134killed them with @kbd{C-w}. With a zero prefix argument @var{N}=0, use the
1135complete pathname of each file. With a raw (just @kbd{C-u}) prefix argument,
1136use the relative pathname of each marked file. As a special case, if no
1137prefix argument is given and point is on a directory headerline, it
1138gives you the name of that directory, without looking for marked files.
1139
1140@vindex dired-marked-files
1141The list of names is also stored onto the variable @code{dired-marked-files}
1142for use, e.g., in the @kbd{M-:} (@code{eval-expression}) command.
1143
1144As this command also displays what was pushed onto the kill ring you can
1145use it to display the list of currently marked files in the
1146echo area (unless you happen to be on a subdirectory headerline).
1147
1148You can then feed the file name to other Emacs commands with @kbd{C-y}.
1149For example, say you want to rename a long filename to a slightly
1150different name. First type @kbd{w} to push the old name onto the kill
1151ring. Then type @kbd{R} to rename it and use @kbd{C-y} inside @kbd{R}'s
1152minibuffer prompt to insert the old name at a convenient place.
1153
1154@item T
1155@kindex T
1156@cindex Toggling marks.
1157@findex dired-do-toggle
1158(@code{dired-do-toggle}) Toggle marks. That is, currently marked
1159files become unmarked and vice versa. Files marked with other flags
1160(such as `D') are not affected. The special directories `.' and `..'
1161are never toggled.
1162@end table
1163
1164@table @code
1165@item dired-smart-shell-command
1166@findex dired-smart-shell-command
1167@findex shell-command
1168@kindex M-!
1169Like function @code{shell-command}, but in the current Dired directory.
1170Bound to @kbd{M-!} in Dired buffers.
1171
1172@item dired-jump
1173@findex dired-jump
1174@kindex C-x C-j
1175@cindex Jumping to dired listing containing file.
1176Bound to @kbd{C-x C-j}. Jump back to dired: If in a file, dired the current
1177directory and move to file's line. If in Dired already, pop up a level and
1178goto old directory's line. In case the proper Dired file line cannot be
1179found, refresh the Dired buffer and try again.
1180
1181@item dired-jump-other-window
1182@findex dired-jump-other-window
1183@kindex C-x 4 C-j
1184Bound to @kbd{C-x 4 C-j}. Like @code{dired-jump}, but to other window.
1185
1186These functions can be autoloaded so they work even though @file{dired-x.el}
4563d12e 1187has not been loaded yet (@pxref{Optional Installation Dired Jump}).
6bf7aab6
DL
1188
1189@vindex dired-bind-jump
1190If the variable @code{dired-bind-jump} is @code{nil}, @code{dired-jump} will not be
1191bound to @kbd{C-x C-j} and @code{dired-jump-other-window} will not be bound to
1192@kbd{C-x 4 C-j}.
1193
1194@item dired-vm
1195@cindex Reading mail.
1196@kindex V
1197@findex dired-vm
1198Bound to @kbd{V} if @code{dired-bind-vm} is t. Run VM on this file (assumed
1199to be a UNIX mail folder).
1200
1201@vindex dired-vm-read-only-folders
1202If you give this command a prefix argument, it will visit the folder
1203read-only. This only works in VM~5, not VM~4.
1204
1205If the variable @code{dired-vm-read-only-folders} is t, @code{dired-vm} will
1206visit all folders read-only. If it is neither @code{nil} nor @code{t}, e.g.,
1207the symbol @code{'if-file-read-only}, only files not writable by you are
1208visited read-only. This is the recommended value if you run VM 5.
1209
1210@vindex dired-bind-vm
1211If the variable @code{dired-bind-vm} is t, @code{dired-vm} will be bound to
1212@kbd{V}. Otherwise, @code{dired-bind-rmail} will be bound.
1213
1214@item dired-rmail
1215@cindex Reading mail.
1216@findex dired-rmail
1217Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}. Run Rmail on this
1218file (assumed to be mail folder in Rmail/BABYL format).
1219
1220@item dired-info
1221@kindex I
1222@cindex Running info.
1223@findex dired-info
1224Bound to @kbd{I}. Run Info on this file (assumed to be a file in Info
1225format).
1226
1227@vindex dired-bind-info
1228If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
1229not be bound to I.
1230
1231@item dired-man
1232@cindex Running man.
1233@kindex N
1234@findex dired-man
1235Bound to @kbd{N}. Run man on this file (assumed to be a file in nroff
1236format).
1237
1238@vindex dired-bind-man
1239If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
1240be bound to N.
1241
1242@item dired-do-relative-symlink
1243@cindex Relative symbolic links.
1244@kindex Y
1245@findex dired-do-relative-symlink
1246Bound to @kbd{Y}. Relative symlink all marked (or next ARG) files into a
1247directory, or make a relative symbolic link to the current file. This creates
1248relative symbolic links like
1249
1250 foo -> ../bar/foo
1251
1252not absolute ones like
1253
1254 foo -> /ugly/path/that/may/change/any/day/bar/foo
1255
1256@item dired-do-relative-symlink-regexp
1257@kindex %Y
1258@findex dired-do-relative-symlink-regexp
1259Bound to @kbd{%Y}. Relative symlink all marked files containing REGEXP to
1260NEWNAME. See functions `dired-do-rename-regexp' and `dired-do-relsymlink' for
1261more info.
1262@end table
1263
1264@node Bugs, Concept Index, Miscellaneous Commands, Top
1265@comment node-name, next, previous, up
1266@chapter Bugs
1267@cindex Bugs
1268@findex dired-x-submit-report
1269
1270@noindent
1271If you encounter a bug in this package, wish to suggest an
1272enhancement, or want to make a smart remark, then type
1273
1274@example
1275@kbd{M-x dired-x-submit-report}
1276@end example
1277
1278@noindent
1279to set up an outgoing mail buffer, with the proper address to the
1280@file{dired-x.el} maintainer automatically inserted in the @samp{To:@:} field.
1281This command also inserts information that the Dired X maintainer can use to
1282recreate your exact setup, making it easier to verify your bug or social
1283maladjustment.
1284
25489206
DL
1285Lawrence R. Dodd
1286@c <dodd@@roebling.poly.edu>
6bf7aab6
DL
1287
1288@node Concept Index, Command Index, Bugs, Top
1289@comment node-name, next, previous, up
1290@unnumbered Concept Index
1291@printindex cp
1292
1293@node Command Index, Key Index, Concept Index, Top
1294@comment node-name, next, previous, up
1295@unnumbered Function Index
1296@printindex fn
1297
1298@node Key Index, Variable Index, Command Index, Top
1299@comment node-name, next, previous, up
1300@unnumbered Key Index
1301@printindex ky
1302
25489206 1303@node Variable Index, , Key Index, Top
6bf7aab6
DL
1304@comment node-name, next, previous, up
1305@unnumbered Variable Index
1306@printindex vr
1307
1308@c @summarycontents
1309@contents
1310
1311@bye
1312@c dired-x.texi ends here.