]> code.delx.au - gnu-emacs/blob - man/dired-x.texi
8-bit in multibyte buffers
[gnu-emacs] / man / dired-x.texi
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>
7 @c [Dodd's address no longer valid.]
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 Emacs
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
41 This documents the ``extra'' features for Dired Mode for GNU Emacs found in
42 the file @file{dired-x.el}.
43
44 Copyright @copyright{} 1993, 1994 Free Software Foundation, Inc.
45
46 Permission is granted to make and distribute verbatim copies of this
47 manual provided the copyright notice and this permission notice are
48 preserved on all copies.
49
50 Permission is granted to copy and distribute modified versions of
51 this manual under the conditions for verbatim copying, provided that
52 the entire resulting derived work is distributed under the terms of
53 a permission notice identical to this one.
54
55 Permission is granted to copy and distribute translations of this
56 manual into another language, under the above conditions for
57 modified versions, except that this permission notice may be stated
58 in a translation approved by the Free Software Foundation.
59
60 The file used to create this is called @file{dired-x.texi}, but the
61 original work that was altered to make that file was called
62 @file{dired.texi} written by Sebastian Kremer.
63
64 @ignore
65 Permission is granted to process this file through TeX and print the
66 results, provided the printed document carries copying permission
67 notice 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
79 @center @titlefont{For The GNU Emacs}
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
87 @c @center @t{dodd@@roebling.poly.edu}
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
92 Copyright @copyright{} 1993, 1994 Free Software Foundation
93
94 Permission is granted to make and distribute verbatim copies of
95 this manual provided the copyright notice and this permission notice
96 are preserved on all copies.
97
98 Permission is granted to copy and distribute modified versions of
99 this manual under the conditions for verbatim copying, provided that
100 the entire resulting derived work is distributed under the terms of
101 a permission notice identical to this one.
102
103 Permission is granted to copy and distribute translations of this
104 manual into another language, under the above conditions for
105 modified versions, except that this permission notice may be stated
106 in a translation approved by the Free Software Foundation.
107
108 The file used to create this is called @file{dired-x.texi}, but the
109 original 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
122 This documents the ``extra'' features for Dired Mode for GNU Emacs that are
123 provided by the file @file{dired-x.el}.
124
125 @itemize @bullet
126
127 @item
128 Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>
129
130 @c dired-x.el REVISION NUMBER
131 @item
132 For @file{dired-x.el} revision 2
133
134 @c @item
135 @c Revision of this manual: 2.52 (1994/08/09 16:51:31)
136
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}).
140
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}
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
173 This documents the @emph{extra} features for Dired Mode for GNU Emacs. It
174 is derived from version 1.191 of Sebastian Kremer's @file{dired-x.el}.
175
176 In adopting this @file{dired-x.el} to GNU Emacs v19 some material that has
177 been incorporated into @file{dired.el} and @file{dired-aux.el} of the GNU Emacs
178 19 distribution has been removed and some material was modified for agreement
179 with the functions in @file{dired.el} and @file{dired-aux.el}. For example,
180 the code using @code{gmhist} history functions was replaced with code using
181 the mini-buffer history now built into GNU Emacs. Finally, a few other
182 features have been added and a few more functions have been bound to keys.
183
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
196 Some features provided by Dired Extra
197
198 @enumerate
199 @item
200 Omitting of uninteresting files from dired listing.
201 @itemize @bullet
202 @xref{Omitting Files in Dired}.
203 @end itemize
204 @item
205 Local variables for dired directories.
206 @itemize @bullet
207 @xref{Local Variables}.
208 @end itemize
209 @item
210 Guessing shell commands in dired buffers.
211 @itemize @bullet
212 @xref{Shell Command Guessing}.
213 @end itemize
214 @item
215 Running dired command in non-dired buffers.
216 @itemize @bullet
217 @xref{Virtual Dired}.
218 @end itemize
219 @item
220 Finding a file mentioned in a buffer
221 @itemize @bullet
222 @xref{Find File At Point}.
223 @end itemize
224 @item
225 Commands using file marking.
226 @itemize @bullet
227 @xref{Advanced Mark Commands}.
228 @end itemize
229 @end enumerate
230
231 @noindent
232 @file{dired-x.el} binds some functions to keys in Dired Mode (@pxref{Key
233 Index}) and also binds @kbd{C-x C-j} and @kbd{C-x 4 C-j} @emph{globally} to
234 @code{dired-jump} (@pxref{Miscellaneous Commands}). It may also bind @kbd{C-x
235 C-f} and @kbd{C-x 4 C-f} to @code{dired-x-find-file} and
236 @code{dired-x-find-file-other-window}, respectively (@pxref{Find File At
237 Point}).
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
245 When loaded this code @emph{redefines} the following functions of GNU Emacs
246 from @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
260 and 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
269 @node Installation, Optional Installation Dired Jump, Technical Details, Top
270 @comment node-name, next, previous, up
271 @chapter Installation
272
273 @noindent
274 This manual describes the dired features provided by the file
275 @file{dired-x.el}. To take advantage of these features, you must load the
276 file and (optionally) set some variables.
277
278 @noindent
279 In your @file{.emacs} file in your home directory, or in the system-wide
280 initialization file @file{default.el} in the @file{site-lisp} directory, put
281
282 @example
283 (add-hook 'dired-load-hook
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 ))
290 (add-hook 'dired-mode-hook
291 (lambda ()
292 ;; Set dired-x buffer-local variables here. For example:
293 ;; (setq dired-omit-files-p t)
294 ))
295 @end example
296
297 @noindent
298 This will load @file{dired-x.el} when dired is first invoked (for example,
299 when you first do @kbd{C-x d}).
300
301 @ifinfo
302 @menu
303 * Optional Installation Dired Jump::
304 * Optional Installation File At Point::
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
314 In order to have @code{dired-jump} and @code{dired-jump-other-window}
315 (@pxref{Miscellaneous Commands}) work @emph{before} @code{dired} and
316 @code{dired-x} have been properly loaded the user should set-up an autoload
317 for 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" "\
327 Jump to dired buffer corresponding to current buffer.
328 If in a file, dired the current directory and move to file's line.
329 If in dired already, pop up a level and goto old directory's line.
330 In case the proper dired file line cannot be found, refresh the dired
331 buffer and try again." t nil)
332
333 (autoload (quote dired-jump-other-window) "dired" "\
334 Like \\[dired-jump] (dired-jump) but in other window." t nil)
335 @end example
336
337 Note 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
339 proper 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
346 before @code{dired} is loaded.
347
348 @node Optional Installation File At Point, , Optional Installation Dired Jump, Installation
349 @comment node-name, next, previous, up
350 @section Optional Installation File At Point
351
352 @cindex Binding @code{dired-x-find-file}
353 If you choose to have @file{dired-x.el} bind @code{dired-x-find-file} over
354 @code{find-file} (@pxref{Find File At Point}), then you will need to set
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
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 ))
367 @end example
368
369 Alternatively, you can set the variable @emph{before} @file{dired-x.el} is
370 loaded
371
372 @example
373 (add-hook 'dired-load-hook
374 (lambda ()
375 ;; Bind dired-x-find-file.
376 (setq dired-x-hands-off-my-keys nil)
377 (load "dired-x")
378 ))
379 @end example
380
381 @node Omitting Files in Dired, Omitting Variables, , Top
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
387 is useful for keeping Dired buffers free of ``uninteresting'' files (for
388 instance, auto-save, auxiliary, backup, and revision control files) so that
389 the user can concentrate on the interesting files. Like hidden files, omitted
390 files are never seen by Dired. Omitting differs from hiding in several
391 respects:
392
393 @itemize @bullet
394
395 @item
396 Omitting works on individual files, not on directories; an entire directory
397 cannot be omitted (though each of its files could be).
398
399 @item
400 Omitting is wholesale; if omitting is turned on for a dired buffer, then all
401 uninteresting files listed in that buffer are omitted. The user does not omit
402 (or unomit) files one at a time.
403
404 @item
405 Omitting can be automatic; uninteresting file lines in the buffer can be
406 removed before the user ever sees them.
407
408 @item
409 Marked 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
418 the files, but don't actually omit them.
419 @end table
420
421 @noindent
422 In order to make Dired Omit work you first need to load @file{dired-x.el}
423 inside @code{dired-load-hook} (@pxref{Installation}) and then set
424 @code{dired-omit-files-p} in some way (@pxref{Omitting Variables}).
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
439 The 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
446 Default: @code{nil}
447
448 @cindex How to make omitting the default in Dired
449 If non-@code{nil}, ``uninteresting'' files are not listed. Uninteresting
450 files are those whose filenames match regexp @code{dired-omit-files}, plus
451 those 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
458 inside your @code{dired-mode-hook} to have omitting initially turned on in
459 @emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to
460 unomit in that buffer.
461
462 To enable omitting automatically only in certain directories one can use Dired
463 Local Variables and put
464
465 @example
466 Local Variables:
467 dired-omit-files-p: t
468 End:
469 @end example
470
471 @noindent
472 into a file @file{.dired} (the default value of
473 @code{dired-local-variables-file}) in that directory (@pxref{Local Variables}).
474
475 @table @code
476 @findex dired-omit-here-always
477 @item dired-omit-here-always
478
479 This is an interactive function that creates a local variables file exactly
480 like 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
482 the directory listing (@pxref{Local Variables}).
483 @end table
484
485 @vindex dired-omit-files
486 @item dired-omit-files
487
488 Default: @code{"^#\\|\\.$"}
489
490 Filenames matching this buffer-local regexp will not be displayed.
491 This only has effect when @code{dired-omit-files-p} is t.
492
493 The default value omits the special directories @file{.} and @file{..} and
494 autosave files (plus other files ending in ``.'') (@pxref{Omitting Examples}).
495
496 @vindex dired-omit-extensions
497 @item dired-omit-extensions
498
499 Default: The elements of @code{completion-ignored-extensions} (as defined in
500 the file @file{loaddefs.el} of the GNU Emacs distribution),
501 @code{dired-latex-unclean-extensions}, @code{dired-bibtex-unclean-extensions}
502 and @code{dired-texinfo-unclean-extensions}.
503
504 If non-@code{nil}, a list of extensions (strings) to omit from Dired listings.
505 Its format is the same as that of @code{completion-ignored-extensions}.
506
507 @vindex dired-omit-localp
508 @item dired-omit-localp
509
510 Default: @code{'no-dir}
511
512 The @var{localp} argument @code{dired-omit-expunge} passes to
513 @code{dired-get-filename}. If it is @code{'no-dir}, omitting is much faster,
514 but you can only match against the non-directory part of the filename. Set it
515 to @code{nil} if you need to match the whole pathname or @code{t} to match the
516 pathname 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
521 Default: @kbd{C-o}
522
523 Temporary marker used by by Dired to implement omitting. Should never be used
524 as marker by the user or other packages. There is one exception to this rule:
525 by 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
533 anywhere 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
535 usually omitted files. Unfortunately the files you omitted manually this way
536 will 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
549 If 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
556 in the @code{dired-load-hook} (@pxref{Installation}). This assumes
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
565 If you use tib, the bibliography program for use with @TeX{} and La@TeX{}, you
566 might 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
574 in the @code{dired-load-hook} (@pxref{Installation}).
575
576 @item
577 @cindex Dot files, how to omit them in Dired
578 @cindex Omitting dot files in Dired
579 If you do not wish to see @samp{dot} files (files starting with a @samp{.}),
580 then put
581
582 @example
583 (setq dired-omit-files
584 (concat dired-omit-files "\\|^\\..+$"))
585 @end example
586
587 @noindent
588 in the @code{dired-load-hook} (@pxref{Installation}).
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
596 Loading @file{dired-x.el} will install Dired Omit by putting
597 @code{dired-omit-expunge} on your @code{dired-after-readin-hook}, and will
598 call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
599 in 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
609 When Dired visits a directory, it looks for a file whose name is the value of
610 variable @code{dired-local-variables-file} (default: @file{.dired}). If such
611 a file is found, Dired will temporarily insert it into the Dired buffer and
612 run @code{hack-local-variables}.
613
614 @noindent
615 For example, if the user puts
616
617 @example
618 Local Variables:
619 dired-actual-switches: "-lat"
620 dired-omit-files-p: t
621 End:
622 @end example
623
624 @noindent
625 into a file called @file{.dired} in a directory then when that directory is
626 viewed it will be
627
628 @enumerate
629 @item
630 sorted by date
631 @item
632 omitted automatically
633 @end enumerate
634
635 @noindent
636 You can set @code{dired-local-variables-file} to @code{nil} to suppress this.
637 The value of @code{dired-enable-local-variables} controls if and how these
638 local variables are read. This variable exists so that if may override the
639 default value of @code{enable-local-variables}.
640
641 @noindent
642 Please see the GNU Emacs Manual to learn more about local variables.
643 @xref{File Variables,Local Variables in Files,Local Variables in
644 Files,emacs,The GNU Emacs Manual}.
645
646 @noindent
647 The following variables affect Dired Local Variables
648
649 @table @code
650 @vindex dired-local-variables-file
651 @item dired-local-variables-file
652 Default: @code{".dired"}
653
654 If non-@code{nil}, filename for local variables for Dired. If Dired finds a
655 file with that name in the current directory, it will temporarily insert it
656 into the dired buffer and run `hack-local-variables'.
657
658 @vindex dired-enable-local-variables
659 @item dired-enable-local-variables
660 Default: @code{t}
661
662 Controls 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
664 lists are obeyed in the @code{dired-local-variables-file}; @code{nil} means
665 they are ignored; anything else means query. This variable temporarily
666 overrides the value of @code{enable-local-variables} when the Dired Local
667 Variables 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
675 Based upon the name of a filename, Dired tries to guess what shell
676 command you might want to apply to it. For example, if you have point
677 on a file named @file{foo.tar} and you press @kbd{!}, Dired will guess
678 you want to @samp{tar xvf} it and suggest that as the default shell
679 command.
680
681 The default will be mentioned in brackets and you can type @kbd{M-p} to get
682 the 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
684 file, 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
687 Dired only tries to guess a command for a single file, never for a list
688 of marked files.
689
690 @table @code
691 @item dired-guess-shell-alist-default
692 @vindex dired-guess-shell-alist-default
693 Predefined rules for shell commands. Set this to @code{nil} to turn guessing off.
694 The elements of @code{dired-guess-shell-alist-user} (defined by the
695 user) will override these rules.@refill
696
697 @item dired-guess-shell-alist-user
698 @vindex dired-guess-shell-alist-user
699 If non-@code{nil}, a user-defined alist of file regexps and their suggested
700 commands. These rules take precedence over the predefined rules in the
701 variable @code{dired-guess-shell-alist-default} (to which they are prepended)
702 when @code{dired-do-shell-command} is run).
703 @refill
704
705 Each element of the alist looks like
706
707 @example
708 (@var{regexp} @var{command}@dots{})
709 @end example
710
711 where each @var{command} can either be a string or a lisp expression
712 that evaluates to a string. If several @var{COMMAND}s are given, all
713 will temporarily be pushed on the history.
714
715 You can set this variable in your @file{~/.emacs}. For example,
716 to 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
730 This 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.
735 Default: @code{nil}
736
737 If 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.
739 If you don't have GNU tar, set this to @code{nil}: a pipe using @samp{zcat} is
740 then used.
741
742 @item dired-guess-shell-gzip-quiet
743 @vindex dired-guess-shell-gzip-quiet
744 @cindex GNU zip.
745 Default: @code{t}
746
747 A non-@code{nil} value means that @code{-q} is passed to gzip overriding a
748 verbose GNU zip's @env{GZIP} environment variable.
749
750 @item dired-guess-shell-znew-switches nil
751 @vindex dired-guess-shell-znew-switches nil
752 @cindex GNU zip.
753 Default: @code{nil}
754
755 A 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
757 the .gz file.
758
759 @item dired-shell-command-history nil
760 @vindex dired-shell-command-history nil
761
762 History 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
772 Using @dfn{Virtual Dired} means putting a buffer with Dired-like
773 contents in Dired mode. The files described by the buffer contents need
774 not actually exist. This is useful if you want to peruse an @samp{ls -lR}
775 output file, for example one you got from an FTP server. You can use
776 all motion commands usually available in Dired. You can also use
777 it 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
782 Type @kbd{M-x dired-virtual} to put the current buffer into virtual
783 Dired mode. You will be prompted for the top level directory of this
784 buffer, with a default value guessed from the buffer contents. To
785 convert the virtual to a real Dired buffer again, type @kbd{g} (which
786 calls @code{dired-virtual-revert}) in the virtual Dired buffer and
787 answer @samp{y}. You don't have to do this, though: you can relist
788 single subdirectories using @kbd{l} (@code{dired-do-redisplay}) on the subdirectory
789 headerline, leaving the buffer in virtual Dired mode all the time.
790
791 @findex dired-virtual-mode
792 @vindex auto-mode-alist
793 The function @samp{dired-virtual-mode} is specially designed to turn on
794 virtual 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
803 The regexp is a bit more complicated than usual to exclude ".dired"
804 local 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
817 simultaneously. If optional NOSELECT is non-@code{nil} then just find the
818 files 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
820 else, type @kbd{C-x 1} first.
821
822 The current window is split across all files marked, as evenly as possible.
823 Remaining lines go to the bottom-most window. The number of files that can be
824 displayed this way is restricted by the height of the current window and the
825 variable @code{window-min-height}.
826 @end table
827
828 @table @code
829 @item dired-mark-extension
830 @findex dired-mark-extension
831 Mark all files with a certain extension for use in later commands. A @samp{.}
832 is not automatically prepended to the string entered.
833
834 When called from lisp, @var{extension} may also be a list of extensions
835 and an optional argument @var{marker-char} specifies the marker used.
836
837 @item dired-flag-extension
838 @findex dired-flag-extension
839 Flag 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
859 Flag dispensable files created by the @samp{patch} program for deletion. See
860 variable @code{dired-patch-unclean-extensions}.
861
862 @item dired-clean-tex
863 @findex dired-clean-tex
864 Flag dispensable files created by @TeX{}, La@TeX{}, and @samp{texinfo} for
865 deletion. See the following variables (@pxref{Advanced Cleaning Variables}):
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
880 Flag dispensable files created by @TeX{}, La@TeX{}, @samp{texinfo}, and ".dvi"
881 files 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
890 variable @code{dired-omit-extensions}, @pxref{Omitting Variables})
891
892 @table @code
893 @item dired-patch-unclean-extensions
894 @vindex dired-patch-unclean-extensions
895 Default: @code{'(".rej" ".orig")}
896
897 List of extensions of dispensable files created by the @samp{patch} program.
898
899 @item dired-tex-unclean-extensions
900 @vindex dired-tex-unclean-extensions
901 Default: @code{'(".toc" ".log" ".aux")}
902
903 List of extensions of dispensable files created by @TeX{}.
904
905 @item dired-texinfo-unclean-extensions
906 @vindex dired-texinfo-unclean-extensions
907 Default: @code{'(".cp" ".cps" ".fn" ".fns" ".ky" ".kys"}
908 @code{".pg" ".pgs" ".tp" ".tps" ".vr" ".vrs")}
909
910 List of extensions of dispensable files created by @samp{texinfo}.
911
912 @item dired-latex-unclean-extensions
913 @vindex dired-latex-unclean-extensions
914 Default: @code{'(".idx" ".lof" ".lot" ".glo")}
915
916 List of extensions of dispensable files created by La@TeX{}.
917
918 @item dired-bibtex-unclean-extensions
919 @vindex dired-bibtex-unclean-extensions
920 Default: @code{'(".blg" ".bbl")}
921
922 List 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
937 non-@code{nil}. With a prefix argument, unflag those files instead.
938
939 The @var{predicate} is a lisp expression that can refer to the following
940 symbols:
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,
946 with @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
955 will 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
967 For example, use
968 @example
969 (equal 0 size)
970 @end example
971 to mark all zero length files.
972
973 To find out all not yet compiled Emacs lisp files in a directory, dired
974 all @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
979 to 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
989 An Emacs buffer can have but one working directory, stored in the
990 buffer-local variable @code{default-directory}. A Dired buffer may have
991 several subdirectories inserted, but still has but one working
992 directory: that of the top level Dired directory in that buffer. For
993 some commands it is appropriate that they use the current Dired
994 directory instead of @code{default-directory}, e.g., @code{find-file} and
995 @code{compile}.
996
997 A general mechanism is provided for special handling of the working
998 directory in special major modes:
999
1000 @table @code
1001 @item default-directory-alist
1002 @vindex default-directory-alist
1003 Default: @code{((dired-mode . (dired-current-directory)))}
1004
1005 Alist of major modes and their opinion on @code{default-directory}, as a
1006 lisp expression to evaluate. A resulting value of @code{nil} is ignored
1007 in favor of @code{default-directory}.
1008
1009 @item default-directory
1010 @findex default-directory
1011 Function with usage like variable @code{default-directory}, but knows about the
1012 special 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
1023 the buffer you are viewing (e.g., a mail buffer, a news article, a README
1024 file, etc.) or to test if that file exists. You can then modify this in the
1025 minibuffer after snatching the filename.
1026
1027 When 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
1032 In 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}
1034 (@pxref{Optional Installation File At Point}).
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
1042 to @kbd{C-x C-f}) unless a prefix argument is passed to the function in which
1043 case it will use the filename at point as a guess for the file to visit.
1044
1045 For example, if the buffer you were reading contained the words
1046
1047 @example
1048 Available via anonymous ftp in
1049
1050 /roebling.poly.edu:/pub/lisp/crypt++.el.gz
1051 @end example
1052
1053 then you could move your cursor to the line containing the ftp address and
1054 type @kbd{C-u C-x C-f} (the @kbd{C-u} is a universal argument). The
1055 minibuffer would read
1056
1057 @example
1058 Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gz
1059 @end example
1060
1061 with the point after the last @code{/}. If you hit return emacs will visit
1062 the 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
1070 prefix 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
1074 If 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
1076 should 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
1079 default value of this variable is @kbd{t}; by default, the binding is not
1080 done. See @xref{Optional Installation File At Point}.
1081
1082 @item dired-x-bind-find-file
1083 @findex dired-x-bind-find-file
1084 A function, which can be called interactively or in your @file{~/.emacs} file,
1085 that 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
1095 Miscellaneous features not fitting anywhere else:
1096
1097 @table @code
1098 @item dired-find-subdir
1099 @vindex dired-find-subdir
1100 Default: @code{nil}
1101
1102 If non-@code{nil}, Dired does not make a new buffer for a directory if it can
1103 be found (perhaps as subdirectory) in some existing Dired buffer.
1104
1105 If there are several Dired buffers for a directory, the most recently
1106 used is chosen.
1107
1108 Dired avoids switching to the current buffer, so that if you have a
1109 normal and a wildcard buffer for the same directory, @kbd{C-x d RET}
1110 will 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.
1123 This commands reads its argument with completion over the names of the
1124 inserted 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
1133 of the marked (or next @var{N}) files into the kill ring, as if you had
1134 killed them with @kbd{C-w}. With a zero prefix argument @var{N}=0, use the
1135 complete pathname of each file. With a raw (just @kbd{C-u}) prefix argument,
1136 use the relative pathname of each marked file. As a special case, if no
1137 prefix argument is given and point is on a directory headerline, it
1138 gives you the name of that directory, without looking for marked files.
1139
1140 @vindex dired-marked-files
1141 The list of names is also stored onto the variable @code{dired-marked-files}
1142 for use, e.g., in the @kbd{M-:} (@code{eval-expression}) command.
1143
1144 As this command also displays what was pushed onto the kill ring you can
1145 use it to display the list of currently marked files in the
1146 echo area (unless you happen to be on a subdirectory headerline).
1147
1148 You can then feed the file name to other Emacs commands with @kbd{C-y}.
1149 For example, say you want to rename a long filename to a slightly
1150 different name. First type @kbd{w} to push the old name onto the kill
1151 ring. Then type @kbd{R} to rename it and use @kbd{C-y} inside @kbd{R}'s
1152 minibuffer 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
1159 files become unmarked and vice versa. Files marked with other flags
1160 (such as `D') are not affected. The special directories `.' and `..'
1161 are 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-!
1169 Like function @code{shell-command}, but in the current Dired directory.
1170 Bound 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.
1176 Bound to @kbd{C-x C-j}. Jump back to dired: If in a file, dired the current
1177 directory and move to file's line. If in Dired already, pop up a level and
1178 goto old directory's line. In case the proper Dired file line cannot be
1179 found, 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
1184 Bound to @kbd{C-x 4 C-j}. Like @code{dired-jump}, but to other window.
1185
1186 These functions can be autoloaded so they work even though @file{dired-x.el}
1187 has not been loaded yet (@pxref{Optional Installation Dired Jump}).
1188
1189 @vindex dired-bind-jump
1190 If the variable @code{dired-bind-jump} is @code{nil}, @code{dired-jump} will not be
1191 bound 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
1198 Bound to @kbd{V} if @code{dired-bind-vm} is t. Run VM on this file (assumed
1199 to be a UNIX mail folder).
1200
1201 @vindex dired-vm-read-only-folders
1202 If you give this command a prefix argument, it will visit the folder
1203 read-only. This only works in VM~5, not VM~4.
1204
1205 If the variable @code{dired-vm-read-only-folders} is t, @code{dired-vm} will
1206 visit all folders read-only. If it is neither @code{nil} nor @code{t}, e.g.,
1207 the symbol @code{'if-file-read-only}, only files not writable by you are
1208 visited read-only. This is the recommended value if you run VM 5.
1209
1210 @vindex dired-bind-vm
1211 If 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
1217 Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}. Run Rmail on this
1218 file (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
1224 Bound to @kbd{I}. Run Info on this file (assumed to be a file in Info
1225 format).
1226
1227 @vindex dired-bind-info
1228 If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
1229 not be bound to I.
1230
1231 @item dired-man
1232 @cindex Running man.
1233 @kindex N
1234 @findex dired-man
1235 Bound to @kbd{N}. Run man on this file (assumed to be a file in nroff
1236 format).
1237
1238 @vindex dired-bind-man
1239 If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
1240 be bound to N.
1241
1242 @item dired-do-relative-symlink
1243 @cindex Relative symbolic links.
1244 @kindex Y
1245 @findex dired-do-relative-symlink
1246 Bound to @kbd{Y}. Relative symlink all marked (or next ARG) files into a
1247 directory, or make a relative symbolic link to the current file. This creates
1248 relative symbolic links like
1249
1250 foo -> ../bar/foo
1251
1252 not 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
1259 Bound to @kbd{%Y}. Relative symlink all marked files containing REGEXP to
1260 NEWNAME. See functions `dired-do-rename-regexp' and `dired-do-relsymlink' for
1261 more 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
1271 If you encounter a bug in this package, wish to suggest an
1272 enhancement, 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
1279 to 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.
1281 This command also inserts information that the Dired X maintainer can use to
1282 recreate your exact setup, making it easier to verify your bug or social
1283 maladjustment.
1284
1285 Lawrence R. Dodd
1286 @c <dodd@@roebling.poly.edu>
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
1303 @node Variable Index, , Key Index, Top
1304 @comment node-name, next, previous, up
1305 @unnumbered Variable Index
1306 @printindex vr
1307
1308 @setchapternewpage odd
1309 @c @summarycontents
1310 @contents
1311
1312 @bye
1313 @c dired-x.texi ends here.