aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKarl Heuer1994-04-06 00:51:43 +0000
committerKarl Heuer1994-04-06 00:51:43 +0000
commit9572a9dd074eb67c2dfa5f19d409c1028f5d72b8 (patch)
tree09f53a430d6617a917724eb44b6fb0d71f286562 /lisp
parente2ec008d003a2492bc375b059d653b955296e047 (diff)
downloademacs-9572a9dd074eb67c2dfa5f19d409c1028f5d72b8.tar.gz
emacs-9572a9dd074eb67c2dfa5f19d409c1028f5d72b8.zip
New version from maintainer.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired-x.el297
1 files changed, 182 insertions, 115 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 9ea749223ba..ee2d2c7abb0 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -3,8 +3,8 @@
3;; Author: Sebastian Kremer <sk@thp.uni-koeln.de> 3;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
4;; Lawrence R. Dodd <dodd@roebling.poly.edu> 4;; Lawrence R. Dodd <dodd@roebling.poly.edu>
5;; Maintainer: Lawrence R. Dodd <dodd@roebling.poly.edu> 5;; Maintainer: Lawrence R. Dodd <dodd@roebling.poly.edu>
6;; Version: 2.14 6;; Version: 2.27
7;; Date: 1994/01/03 15:47:50 7;; Date: 1994/04/05 12:45:30
8;; Keywords: dired extensions 8;; Keywords: dired extensions
9 9
10;; Copyright (C) 1993, 1994 Free Software Foundation 10;; Copyright (C) 1993, 1994 Free Software Foundation
@@ -25,29 +25,32 @@
25;; along with GNU Emacs; see the file COPYING. If not, write to 25;; along with GNU Emacs; see the file COPYING. If not, write to
26;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 26;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 27
28;;; Commentary: 28;;; Commentary:
29 29
30;;; This is Sebastian Kremer's dired-x.el (Dired Extra), version 1.191, hacked 30;;; This is Sebastian Kremer's excellent dired-x.el (Dired Extra), version
31;;; up for GNU Emacs 19. Redundant or conflicting material has been removed 31;;; 1.191, hacked up for GNU Emacs 19. Redundant or conflicting material
32;;; or renamed in order to work properly with dired of GNU Emacs. All 32;;; has been removed or renamed in order to work properly with dired of
33;;; suggestions or comments are most welcomed. There is also a texinfo file. 33;;; GNU Emacs 19. All suggestions or comments are most welcomed.
34;;;
35;;; *Please* see the info pages.
34 36
35;;; BUGS: Type M-x dired-x-submit-report and a report will be generated. 37;;; BUGS: Type M-x dired-x-submit-report and a report will be generated.
36 38
37;;; INSTALLATION: In your ~/.emacs, 39;;; INSTALLATION: In your ~/.emacs,
38;;; 40;;;
39;;; (add-hook 'dired-load-hook 41;;; (add-hook 'dired-load-hook
40;;; (function (lambda () 42;;; (function (lambda ()
41;;; (load "dired-x") 43;;; (load "dired-x")
42;;; ;; Set variables here. For example: 44;;; ;; Set variables here. For example:
43;;; ;; (setq dired-guess-shell-gnutar "gtar") 45;;; ;; (setq dired-guess-shell-gnutar "gtar")
46;;; ;; (setq dired-omit-files-p t)
44;;; ))) 47;;; )))
45;;; 48;;;
46;;; At load time dired-x.el will install itself, redefine some functions, 49;;; At load time dired-x.el will install itself, redefine some functions, and
47;;; and bind some dired keys. See also the info pages. 50;;; bind some dired keys. *Please* see the info pages for more details.
48 51
49;;; User defined variables: 52;;; User defined variables:
50;;; 53;;;
51;;; dired-bind-vm 54;;; dired-bind-vm
52;;; dired-vm-read-only-folders 55;;; dired-vm-read-only-folders
53;;; dired-bind-jump 56;;; dired-bind-jump
@@ -64,28 +67,29 @@
64;;; dired-omit-files-p 67;;; dired-omit-files-p
65;;; dired-omit-files 68;;; dired-omit-files
66;;; dired-omit-extensions 69;;; dired-omit-extensions
67;;; 70;;;
68;;; To find out more about these variables, load this file, put your cursor at 71;;; To find out more about these variables, load this file, put your cursor at
69;;; the end of any of the variable names, and hit C-h v [RET]. 72;;; the end of any of the variable names, and hit C-h v [RET]. *Please* see
73;;; the info pages for more details.
70 74
71;;; When loaded this code redefines the following functions of GNU Emacs 75;;; When loaded this code redefines the following functions of GNU Emacs
72;;; 76;;;
73;;; Function Found in this file of GNU Emacs 77;;; Function Found in this file of GNU Emacs
74;;; -------- ------------------------------- 78;;; -------- -------------------------------
75;;; dired-clean-up-after-deletion ../lisp/dired.el 79;;; dired-clean-up-after-deletion ../lisp/dired.el
76;;; dired-find-buffer-nocreate ../lisp/dired.el 80;;; dired-find-buffer-nocreate ../lisp/dired.el
77;;; dired-initial-position ../lisp/dired.el 81;;; dired-initial-position ../lisp/dired.el
78;;; dired-up-directory ../lisp/dired.el 82;;; dired-up-directory ../lisp/dired.el
79;;; 83;;;
80;;; dired-add-entry ../lisp/dired-aux.el 84;;; dired-add-entry ../lisp/dired-aux.el
81;;; dired-read-shell-command ../lisp/dired-aux.el 85;;; dired-read-shell-command ../lisp/dired-aux.el
82;;; 86;;;
83;;; One drawback is that dired-x.el will load dired-aux.el as soon as dired is 87;;; One drawback is that dired-x.el will load dired-aux.el as soon as dired is
84;;; loaded. Thus, the advantage of separating out non-essential dired stuff 88;;; loaded. Thus, the advantage of separating out non-essential dired stuff
85;;; into dired-aux.el and only loading when necessary will be lost. Please 89;;; into dired-aux.el and only loading when necessary will be lost. Please
86;;; note also that some of the comments in dired.el and dired-aux.el are 90;;; note also that some of the comments in dired.el and dired-aux.el are
87;;; Kremer's that referred to the old dired-x.el. This now should be 91;;; Kremer's that referred to the old dired-x.el. This now should be referring
88;;; referring to this program. (This is a good reason to call this dired-x.el 92;;; to this program. (This is also a good reason to call this dired-x.el
89;;; instead of dired-x19.el.) 93;;; instead of dired-x19.el.)
90 94
91 95
@@ -93,15 +97,33 @@
93 97
94;;; LOAD. 98;;; LOAD.
95 99
100;;; This is a no-op if dired-x is being loaded via `dired-load-hook'. It is
101;;; here in case the user has autoloaded dired-x via the dired-jump key binding
102;;; (instead of autoloading to dired as is suggested in the info-pages).
103
104;;; WARNING: The copy of dired.el in GNU Emacs versions earlier than 19.20 had
105;;; the `provide' *after* the `run-hooks'. In such a case, loading dired below
106;;; will cause an infinite loop. To prevent this we test the value of the GNU
107;;; Emacs major version number before requiring dired.
108
109(if (string< "19.19"
110 ;; Compare with major version number (i.e., 19.22 not 19.22.11).
111 (substring emacs-version 0
112 (and (string-match "^[0-9]*\\.[0-9]*" emacs-version)
113 (match-end 0))))
114 (require 'dired))
115
96;;; We will redefine some functions and also need some macros so we need to 116;;; We will redefine some functions and also need some macros so we need to
97;;; load dired stuff of GNU Emacs. Since dired-aux.el does not `provide' 117;;; load dired stuff of GNU Emacs. Since dired-aux.el (at least up to GNU
98;;; itself, we do it here. This avoids the possibility recursive loading 118;;; Emacs 19.22) does not `provide' itself, we do it here. This avoids the
99;;; because of the nasty `eval-when-compile' in dired-aux.el. 119;;; possibility recursive loading because of the nasty `eval-when-compile' that
120;;; is in dired-aux.el.
100 121
101(and (not (featurep 'dired-aux)) 122(and (not (featurep 'dired-aux))
102 (load "dired-aux" nil t) 123 (load "dired-aux" nil t)
124 (not (featurep 'dired-aux))
103 (provide 'dired-aux)) 125 (provide 'dired-aux))
104 126
105;;;; User-defined variables. 127;;;; User-defined variables.
106 128
107(defvar dired-bind-vm nil 129(defvar dired-bind-vm nil
@@ -190,7 +212,7 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used.")
190(if dired-bind-info 212(if dired-bind-info
191 (define-key dired-mode-map "I" 'dired-info)) 213 (define-key dired-mode-map "I" 'dired-info))
192 214
193;;; GLOBAL BINDING. 215;;; GLOBAL BINDING.
194(if dired-bind-jump 216(if dired-bind-jump
195 (progn 217 (progn
196 (define-key global-map "\C-x\C-j" 'dired-jump) 218 (define-key global-map "\C-x\C-j" 'dired-jump)
@@ -233,7 +255,7 @@ For more features, see variables
233 dired-guess-shell-gzip-quiet 255 dired-guess-shell-gzip-quiet
234 dired-guess-shell-znew-switches 256 dired-guess-shell-znew-switches
235 dired-guess-shell-alist-user 257 dired-guess-shell-alist-user
236 dired-clean-up-buffers-too 258 dired-clean-up-buffers-too
237 259
238See also functions 260See also functions
239 261
@@ -283,13 +305,13 @@ See also functions
283 (while buf-list 305 (while buf-list
284 (save-excursion (kill-buffer (car buf-list))) 306 (save-excursion (kill-buffer (car buf-list)))
285 (setq buf-list (cdr buf-list))))))) 307 (setq buf-list (cdr buf-list)))))))
286 ;; Anything else? 308 ;; Anything else?
287 ) 309 )
288 310
289 311
290;;;; EXTENSION MARKING FUNCTIONS. 312;;;; EXTENSION MARKING FUNCTIONS.
291 313
292;;; Mark files with some extension. 314;;; Mark files with some extension.
293(defun dired-mark-extension (extension &optional marker-char) 315(defun dired-mark-extension (extension &optional marker-char)
294 "Mark all files with a certain extension for use in later commands. 316 "Mark all files with a certain extension for use in later commands.
295A `.' is not automatically prepended to the string entered." 317A `.' is not automatically prepended to the string entered."
@@ -341,20 +363,27 @@ See variable `dired-patch-unclean-extensions'."
341 (dired-flag-extension dired-patch-unclean-extensions)) 363 (dired-flag-extension dired-patch-unclean-extensions))
342 364
343(defun dired-clean-tex () 365(defun dired-clean-tex ()
344 "Flag dispensable files created by tex etc. for deletion. 366 "Flag dispensable files created by [La]TeX etc. for deletion.
345See variable `dired-texinfo-unclean-extensions', `dired-latex-unclean-extensions', 367See variables `dired-texinfo-unclean-extensions',
346`dired-bibtex-unclean-extensions' and `dired-texinfo-unclean-extensions'." 368`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and
369`dired-texinfo-unclean-extensions'."
347 (interactive) 370 (interactive)
348 (dired-flag-extension (append dired-texinfo-unclean-extensions 371 (dired-flag-extension (append dired-texinfo-unclean-extensions
349 dired-latex-unclean-extensions 372 dired-latex-unclean-extensions
350 dired-bibtex-unclean-extensions 373 dired-bibtex-unclean-extensions
351 dired-tex-unclean-extensions))) 374 dired-tex-unclean-extensions)))
352 375
353(defun dired-clean-dvi () 376(defun dired-very-clean-tex ()
354 "Flag dispensable `.dvi' files from tex etc. for deletion." 377 "Flag dispensable files created by [La]TeX *and* \".dvi\" for deletion.
378See variables `dired-texinfo-unclean-extensions',
379`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and
380`dired-texinfo-unclean-extensions'."
355 (interactive) 381 (interactive)
356 (dired-flag-extension ".dvi")) 382 (dired-flag-extension (append dired-texinfo-unclean-extensions
357 383 dired-latex-unclean-extensions
384 dired-bibtex-unclean-extensions
385 dired-tex-unclean-extensions
386 (list ".dvi"))))
358 387
359;;;; JUMP. 388;;;; JUMP.
360 389
@@ -373,7 +402,7 @@ buffer and try again."
373 (dired-up-directory other-window) 402 (dired-up-directory other-window)
374 (or (dired-goto-file dir) 403 (or (dired-goto-file dir)
375 ;; refresh and try again 404 ;; refresh and try again
376 (progn 405 (progn
377 (dired-insert-subdir (file-name-directory dir)) 406 (dired-insert-subdir (file-name-directory dir))
378 (dired-goto-file dir)))) 407 (dired-goto-file dir))))
379 (if other-window 408 (if other-window
@@ -381,8 +410,12 @@ buffer and try again."
381 (dired dir)) 410 (dired dir))
382 (if file 411 (if file
383 (or (dired-goto-file file) 412 (or (dired-goto-file file)
413 ;; Toggle omitting, if necessary, and try again.
414 (progn
415 (dired-omit-toggle t)
416 (dired-goto-file file))
384 ;; refresh and try again 417 ;; refresh and try again
385 (progn 418 (progn
386 (dired-insert-subdir (file-name-directory file)) 419 (dired-insert-subdir (file-name-directory file))
387 (dired-goto-file file))))))) 420 (dired-goto-file file)))))))
388 421
@@ -391,8 +424,8 @@ buffer and try again."
391 (interactive) 424 (interactive)
392 (dired-jump t)) 425 (dired-jump t))
393 426
394;;; REDEFINE. 427;;; REDEFINE.
395;;; This replaces the version in dired.el 428;;; This replaces the version in dired.el
396;;; It simply adds the OTHER-WINDOW option to the one in dired.el. 429;;; It simply adds the OTHER-WINDOW option to the one in dired.el.
397(defun dired-up-directory (&optional other-window) 430(defun dired-up-directory (&optional other-window)
398 "Run dired on parent directory of current directory. 431 "Run dired on parent directory of current directory.
@@ -441,7 +474,7 @@ As always, hidden subdirs are not affected."
441 474
442 475
443;;;; COPY NAMES OF MARKED FILES INTO KILL-RING. 476;;;; COPY NAMES OF MARKED FILES INTO KILL-RING.
444 477
445(defun dired-copy-filename-as-kill (&optional arg) 478(defun dired-copy-filename-as-kill (&optional arg)
446 "Copy names of marked (or next ARG) files into the kill ring. 479 "Copy names of marked (or next ARG) files into the kill ring.
447The names are separated by a space. 480The names are separated by a space.
@@ -573,7 +606,7 @@ Second optional argument LOCALP is as in `dired-get-filename'."
573 (and fn (string-match regexp fn)))) 606 (and fn (string-match regexp fn))))
574 msg))) 607 msg)))
575 608
576;;; REDEFINE. 609;;; REDEFINE.
577(defun dired-omit-new-add-entry (filename &optional marker-char) 610(defun dired-omit-new-add-entry (filename &optional marker-char)
578 ;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for 611 ;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
579 ;; files that are going to be omitted anyway. 612 ;; files that are going to be omitted anyway.
@@ -600,7 +633,7 @@ Second optional argument LOCALP is as in `dired-get-filename'."
600 ;; omitting is not turned on at all 633 ;; omitting is not turned on at all
601 (dired-omit-old-add-entry filename marker-char))) 634 (dired-omit-old-add-entry filename marker-char)))
602 635
603;;; REDEFINE. 636;;; REDEFINE.
604;;; Redefine dired-aux.el's version of `dired-add-entry' 637;;; Redefine dired-aux.el's version of `dired-add-entry'
605;;; Save old defun if not already done: 638;;; Save old defun if not already done:
606(or (fboundp 'dired-omit-old-add-entry) 639(or (fboundp 'dired-omit-old-add-entry)
@@ -770,21 +803,21 @@ cases in variable `default-directory-alist' (which see)."
770 803
771;;;; LOCAL VARIABLES FOR DIRED BUFFERS. 804;;;; LOCAL VARIABLES FOR DIRED BUFFERS.
772 805
773;;; Brief Description: 806;;; Brief Description:
774;;; 807;;;
775;;; * `dired-extra-startup' is part of the `dired-mode-hook'. 808;;; * `dired-extra-startup' is part of the `dired-mode-hook'.
776;;; 809;;;
777;;; * `dired-extra-startup' calls `dired-hack-local-variables' 810;;; * `dired-extra-startup' calls `dired-hack-local-variables'
778;;; 811;;;
779;;; * `dired-hack-local-variables' checks the value of 812;;; * `dired-hack-local-variables' checks the value of
780;;; `dired-local-variables-file' 813;;; `dired-local-variables-file'
781;;; 814;;;
782;;; * Check if `dired-local-variables-file' is a non-nil string and is a 815;;; * Check if `dired-local-variables-file' is a non-nil string and is a
783;;; filename found in the directory of the Dired Buffer being created. 816;;; filename found in the directory of the Dired Buffer being created.
784;;; 817;;;
785;;; * If `dired-local-variables-file' satisfies the above, then temporarily 818;;; * If `dired-local-variables-file' satisfies the above, then temporarily
786;;; include it in the Dired Buffer at the bottom. 819;;; include it in the Dired Buffer at the bottom.
787;;; 820;;;
788;;; * Set `enable-local-variables' temporarily to the user variable 821;;; * Set `enable-local-variables' temporarily to the user variable
789;;; `dired-enable-local-variables' and run `hack-local-variables' on the 822;;; `dired-enable-local-variables' and run `hack-local-variables' on the
790;;; Dired Buffer. 823;;; Dired Buffer.
@@ -816,13 +849,13 @@ information on local variables. See also `dired-enable-local-variables'.")
816 ;; Make sure that the modeline shows the proper information. 849 ;; Make sure that the modeline shows the proper information.
817 (dired-sort-set-modeline) 850 (dired-sort-set-modeline)
818 ;; Delete this stuff: `eobp' is used to find last subdir by dired.el. 851 ;; Delete this stuff: `eobp' is used to find last subdir by dired.el.
819 (delete-region opoint (point-max))))) 852 (delete-region opoint (point-max)))))
820 853
821(defun dired-omit-here-always () 854(defun dired-omit-here-always ()
822 "Creates `dired-local-variables-file' for omitting and reverts directory. 855 "Creates `dired-local-variables-file' for omitting and reverts directory.
823Sets dired-omit-file-p to t in a local variables file that is readable by 856Sets dired-omit-file-p to t in a local variables file that is readable by
824dired." 857dired."
825 (interactive) 858 (interactive)
826 (if (file-exists-p dired-local-variables-file) 859 (if (file-exists-p dired-local-variables-file)
827 (message "File `./%s' already exists." dired-local-variables-file) 860 (message "File `./%s' already exists." dired-local-variables-file)
828 861
@@ -841,24 +874,24 @@ dired."
841 874
842;;;; GUESS SHELL COMMAND. 875;;;; GUESS SHELL COMMAND.
843 876
844;;; Brief Description: 877;;; Brief Description:
845;;; 878;;;
846;;; `dired-do-shell-command' is bound to `!' by dired.el. 879;;; `dired-do-shell-command' is bound to `!' by dired.el.
847;;; 880;;;
848;;; * Redefine `dired-do-shell-command' so it calls 881;;; * Redefine `dired-do-shell-command' so it calls
849;;; `dired-guess-shell-command'. 882;;; `dired-guess-shell-command'.
850;;; 883;;;
851;;; * `dired-guess-shell-command' calls `dired-guess-default' with list of 884;;; * `dired-guess-shell-command' calls `dired-guess-default' with list of
852;;; marked files. 885;;; marked files.
853;;; 886;;;
854;;; * Parse `dired-guess-shell-alist-user' and 887;;; * Parse `dired-guess-shell-alist-user' and
855;;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP 888;;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP
856;;; that matches the first file in the file list. 889;;; that matches the first file in the file list.
857;;; 890;;;
858;;; * If the REGEXP matches all the entries of the file list then evaluate 891;;; * If the REGEXP matches all the entries of the file list then evaluate
859;;; COMMAND, which is either a string or an elisp expression returning a 892;;; COMMAND, which is either a string or an elisp expression returning a
860;;; string. COMMAND may be a list of commands. 893;;; string. COMMAND may be a list of commands.
861;;; 894;;;
862;;; * Return this command to `dired-guess-shell-command' which prompts user 895;;; * Return this command to `dired-guess-shell-command' which prompts user
863;;; with it. The list of commands are temporaily put into the history list. 896;;; with it. The list of commands are temporaily put into the history list.
864;;; If a command is used successfully then it is stored permanently in 897;;; If a command is used successfully then it is stored permanently in
@@ -868,7 +901,7 @@ dired."
868(defvar dired-shell-command-history nil 901(defvar dired-shell-command-history nil
869 "History list for commands that read dired-shell commands.") 902 "History list for commands that read dired-shell commands.")
870 903
871;;; Default list of shell commands. 904;;; Default list of shell commands.
872 905
873;;; NOTE: Use `gunzip -c' instead of `zcat' on `.gz' files. Some do not 906;;; NOTE: Use `gunzip -c' instead of `zcat' on `.gz' files. Some do not
874;;; install GNU zip's version of zcat. 907;;; install GNU zip's version of zcat.
@@ -905,7 +938,7 @@ dired."
905 (list "\\.ps.g?z$" "gunzip -qc * | ghostview -" 938 (list "\\.ps.g?z$" "gunzip -qc * | ghostview -"
906 ;; Optional decompression. 939 ;; Optional decompression.
907 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) 940 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
908 (list "\\.ps.Z$" "zcat * | ghostview -" 941 (list "\\.ps.Z$" "zcat * | ghostview -"
909 ;; Optional conversion to gzip format. 942 ;; Optional conversion to gzip format.
910 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") 943 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
911 " " dired-guess-shell-znew-switches)) 944 " " dired-guess-shell-znew-switches))
@@ -917,7 +950,7 @@ dired."
917 " " dired-guess-shell-znew-switches)) 950 " " dired-guess-shell-znew-switches))
918 951
919 '("\\.dvi$" "xdvi" "dvips") ; preview and printing 952 '("\\.dvi$" "xdvi" "dvips") ; preview and printing
920 '("\\.au$" "play") ; play Sun audiofiles 953 '("\\.au$" "play") ; play Sun audiofiles
921 '("\\.mpg$" "mpeg_play") 954 '("\\.mpg$" "mpeg_play")
922 '("\\.uu$" "uudecode") ; for uudecoded files 955 '("\\.uu$" "uudecode") ; for uudecoded files
923 '("\\.hqx$" "mcvert") 956 '("\\.hqx$" "mcvert")
@@ -947,7 +980,7 @@ dired."
947 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") 980 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
948 " " dired-guess-shell-znew-switches)) 981 " " dired-guess-shell-znew-switches))
949 ) 982 )
950 983
951 "Default alist used for shell command guessing. 984 "Default alist used for shell command guessing.
952See `dired-guess-shell-alist-user'") 985See `dired-guess-shell-alist-user'")
953 986
@@ -979,8 +1012,8 @@ You can set this variable in your ~/.emacs. For example, to add rules for
979 1012
980(defun dired-guess-default (files) 1013(defun dired-guess-default (files)
981 1014
982 ;; Guess a shell commands for FILES. Return command or list of commands. 1015 ;; Guess a shell commands for FILES. Return command or list of commands.
983 ;; See `dired-guess-shell-alist-user'. 1016 ;; See `dired-guess-shell-alist-user'.
984 1017
985 (let* ((case-fold-search nil) ; case-sensitive matching 1018 (let* ((case-fold-search nil) ; case-sensitive matching
986 ;; Prepend the user's alist to the default alist. 1019 ;; Prepend the user's alist to the default alist.
@@ -1003,13 +1036,13 @@ You can set this variable in your ~/.emacs. For example, to add rules for
1003 (while (and flist 1036 (while (and flist
1004 (string-match regexp (car flist))) 1037 (string-match regexp (car flist)))
1005 (setq flist (cdr flist))) 1038 (setq flist (cdr flist)))
1006 1039
1007 ;; If flist is still non-nil, then do not guess since this means that not 1040 ;; If flist is still non-nil, then do not guess since this means that not
1008 ;; all the files in FILES were matched by the regexp. 1041 ;; all the files in FILES were matched by the regexp.
1009 (setq cmds (and (not flist) cmds)) 1042 (setq cmds (and (not flist) cmds))
1010 1043
1011 ;; Return commands or nil if flist is still non-nil. 1044 ;; Return commands or nil if flist is still non-nil.
1012 ;; Evaluate the commands in order that any logical testing will be done. 1045 ;; Evaluate the commands in order that any logical testing will be done.
1013 (cond ((not (cdr cmds)) 1046 (cond ((not (cdr cmds))
1014 (eval (car cmds))) ; single command 1047 (eval (car cmds))) ; single command
1015 (t 1048 (t
@@ -1069,7 +1102,7 @@ You can set this variable in your ~/.emacs. For example, to add rules for
1069 (cons val dired-shell-command-history)))))))) 1102 (cons val dired-shell-command-history))))))))
1070 1103
1071 1104
1072;;; REDEFINE. 1105;;; REDEFINE.
1073;;; Redefine dired-aux.el's version: 1106;;; Redefine dired-aux.el's version:
1074(defun dired-read-shell-command (prompt arg files) 1107(defun dired-read-shell-command (prompt arg files)
1075;; "Read a dired shell command prompting with PROMPT (using read-string). 1108;; "Read a dired shell command prompting with PROMPT (using read-string).
@@ -1168,26 +1201,26 @@ for more info."
1168 1201
1169;;;; VISIT ALL MARKED FILES SIMULTANEOUSLY. 1202;;;; VISIT ALL MARKED FILES SIMULTANEOUSLY.
1170 1203
1171;;; Brief Description: 1204;;; Brief Description:
1172;;; 1205;;;
1173;;; `dired-do-find-marked-files' is bound to `F' by dired-x.el. 1206;;; `dired-do-find-marked-files' is bound to `F' by dired-x.el.
1174;;; 1207;;;
1175;;; * Use `dired-get-marked-files' to collect the marked files in the current 1208;;; * Use `dired-get-marked-files' to collect the marked files in the current
1176;;; Dired Buffer into a list of filenames `FILE-LIST'. 1209;;; Dired Buffer into a list of filenames `FILE-LIST'.
1177;;; 1210;;;
1178;;; * Pass FILE-LIST to `dired-simultaneous-find-file' all with 1211;;; * Pass FILE-LIST to `dired-simultaneous-find-file' all with
1179;;; `dired-do-find-marked-files''s prefix argument NOSELECT. 1212;;; `dired-do-find-marked-files''s prefix argument NOSELECT.
1180;;; 1213;;;
1181;;; * `dired-simultaneous-find-file' runs through FILE-LIST decrementing the 1214;;; * `dired-simultaneous-find-file' runs through FILE-LIST decrementing the
1182;;; list each time. 1215;;; list each time.
1183;;; 1216;;;
1184;;; * If NOSELECT is non-nil then just run `find-file-noselect' on each 1217;;; * If NOSELECT is non-nil then just run `find-file-noselect' on each
1185;;; element of FILE-LIST. 1218;;; element of FILE-LIST.
1186;;; 1219;;;
1187;;; * If NOSELECT is nil then calculate the `size' of the window for each file 1220;;; * If NOSELECT is nil then calculate the `size' of the window for each file
1188;;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is 1221;;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is
1189;;; cognizant of the window-configuration. 1222;;; cognizant of the window-configuration.
1190;;; 1223;;;
1191;;; * If `size' is too small abort, otherwise run `find-file' on each element 1224;;; * If `size' is too small abort, otherwise run `find-file' on each element
1192;;; of FILE-LIST giving each a window of height `size'. 1225;;; of FILE-LIST giving each a window of height `size'.
1193 1226
@@ -1200,7 +1233,7 @@ Remaining lines go to bottom-most window. The number of files that can be
1200displayed this way is restricted by the height of the current window and 1233displayed this way is restricted by the height of the current window and
1201`window-min-height'. 1234`window-min-height'.
1202 1235
1203To keep dired buffer displayed, type \\[split-window-vertically] first. 1236To keep dired buffer displayed, type \\[split-window-vertically] first.
1204To display just marked files, type \\[delete-other-windows] first." 1237To display just marked files, type \\[delete-other-windows] first."
1205 1238
1206 (interactive "P") 1239 (interactive "P")
@@ -1214,7 +1247,7 @@ To display just marked files, type \\[delete-other-windows] first."
1214 ;; files that can be displayed this way is restricted by the height of the 1247 ;; files that can be displayed this way is restricted by the height of the
1215 ;; current window and the variable `window-min-height'. With non-nil 1248 ;; current window and the variable `window-min-height'. With non-nil
1216 ;; NOSELECT the files are merely found but not selected. 1249 ;; NOSELECT the files are merely found but not selected.
1217 1250
1218 ;; We don't make this function interactive because it is usually too clumsy 1251 ;; We don't make this function interactive because it is usually too clumsy
1219 ;; to specify FILE-LIST interactively unless via dired. 1252 ;; to specify FILE-LIST interactively unless via dired.
1220 1253
@@ -1250,26 +1283,56 @@ To display just marked files, type \\[delete-other-windows] first."
1250 1283
1251;;;; MISCELLANEOUS COMMANDS. 1284;;;; MISCELLANEOUS COMMANDS.
1252 1285
1253;;; Run man on files. 1286;;; Run man on files.
1254 1287
1255(defun dired-man () 1288(defun dired-man ()
1256 "Run man on this file." 1289 "Run man on this file. Display old buffer if buffer name matches filename.
1290Results displayed based on value of `Man-notify'. See that variable."
1257 (interactive) 1291 (interactive)
1258 (let* ((file (dired-get-filename)) 1292 (let* ((file (dired-get-filename))
1259 (man-buffer (generate-new-buffer 1293 (string (format "*man %s*" (file-name-nondirectory file)))
1260 (format "*man %s*" (file-name-nondirectory file))))) 1294 (Man-buffer (get-buffer string))
1261 (save-excursion 1295 (msg "Expanding manual page...cleaning...done"))
1262 (set-buffer man-buffer) 1296
1263 (message "Expanding manual page...") 1297 ;; If Man-buffer already exists and has not been modified, display it.
1264 (call-process shell-file-name nil t nil "-c" 1298 ;; Otherwise, create a fresh one.
1265 (concat " nroff -man -h " file)) 1299 (if (and Man-buffer
1266 (message "Expanding manual page...cleaning...") 1300 (save-excursion
1267 (call-process-region (point-min) (point-max) 1301 (set-buffer Man-buffer)
1268 shell-file-name t t nil "-c" " col -b") 1302 (not (buffer-modified-p))
1269 (goto-char (point-min)) 1303 buffer-read-only))
1270 (set-buffer-modified-p nil)) 1304
1271 (display-buffer man-buffer 'not-this-window)) 1305 (setq msg "Displaying pre-existing manual page.")
1272 (message "Expanding manual page...cleaning...done")) 1306
1307 ;; Create Man-buffer.
1308 (save-excursion
1309
1310 ;; Prepare buffer.
1311 (setq Man-buffer (get-buffer-create string))
1312 (set-buffer Man-buffer)
1313 (setq buffer-read-only nil)
1314 (erase-buffer)
1315
1316 ;; Expand and clean man page.
1317 (message "Expanding manual page...")
1318 (call-process shell-file-name nil t nil "-c"
1319 (concat " nroff -man -h " file))
1320 (message "Expanding manual page...cleaning...")
1321 (call-process-region (point-min) (point-max)
1322 shell-file-name t t nil "-c" " col -b")
1323 (goto-char (point-min))
1324
1325 ;; Reset buffer.
1326 (setq buffer-read-only t)
1327 (buffer-disable-undo (current-buffer))
1328 (set-buffer-modified-p nil)))
1329
1330 ;; Display results. Use display function of ../lisp/man.el whose behavior
1331 ;; is determined by user-defined variable Man-notify.
1332 (require 'man)
1333 (Man-notify-when-ready Man-buffer)
1334 ;; Overrides any message issued by above function.
1335 (message msg)))
1273 1336
1274;;; Run Info on files. 1337;;; Run Info on files.
1275 1338
@@ -1280,6 +1343,10 @@ To display just marked files, type \\[delete-other-windows] first."
1280 1343
1281;;; Run mail on mail folders. 1344;;; Run mail on mail folders.
1282 1345
1346;;; (and (not (fboundp 'vm-visit-folder))
1347;;; (defun vm-visit-folder (file &optional arg)
1348;;; nil))
1349
1283(defun dired-vm (&optional read-only) 1350(defun dired-vm (&optional read-only)
1284 "Run VM on this file. 1351 "Run VM on this file.
1285With prefix arg, visit folder read-only (this requires at least VM 5). 1352With prefix arg, visit folder read-only (this requires at least VM 5).
@@ -1316,7 +1383,7 @@ See also variable `dired-vm-read-only-folders'."
1316 (fset 'dired-old-find-buffer-nocreate 1383 (fset 'dired-old-find-buffer-nocreate
1317 (symbol-function 'dired-find-buffer-nocreate))) 1384 (symbol-function 'dired-find-buffer-nocreate)))
1318 1385
1319;;; REDEFINE. 1386;;; REDEFINE.
1320;;; Redefines dired.el's version of `dired-find-buffer-nocreate' 1387;;; Redefines dired.el's version of `dired-find-buffer-nocreate'
1321(defun dired-find-buffer-nocreate (dirname) 1388(defun dired-find-buffer-nocreate (dirname)
1322 (if dired-find-subdir 1389 (if dired-find-subdir
@@ -1370,7 +1437,7 @@ See also variable `dired-vm-read-only-folders'."
1370;;; (setq dired-buffers (delq elt dired-buffers))))) 1437;;; (setq dired-buffers (delq elt dired-buffers)))))
1371;;; result)) 1438;;; result))
1372 1439
1373;;; REDEFINE. 1440;;; REDEFINE.
1374;;; Redefines dired.el's version of `dired-initial-position' 1441;;; Redefines dired.el's version of `dired-initial-position'
1375(defun dired-initial-position (dirname) 1442(defun dired-initial-position (dirname)
1376 (end-of-line) 1443 (end-of-line)
@@ -1495,7 +1562,7 @@ test if that file exists. Use minibuffer after snatching the filename."
1495 ;; preference for looking backward when not directly on a symbol. Not 1562 ;; preference for looking backward when not directly on a symbol. Not
1496 ;; perfect - point must be in middle of or end of filename. 1563 ;; perfect - point must be in middle of or end of filename.
1497 1564
1498 (let ((filename-chars ".a-zA-Z0-9---_/:$") 1565 (let ((filename-chars ".a-zA-Z0-9---_/:$+")
1499 (bol (save-excursion (beginning-of-line) (point))) 1566 (bol (save-excursion (beginning-of-line) (point)))
1500 (eol (save-excursion (end-of-line) (point))) 1567 (eol (save-excursion (end-of-line) (point)))
1501 start end filename) 1568 start end filename)
@@ -1508,7 +1575,7 @@ test if that file exists. Use minibuffer after snatching the filename."
1508 (skip-chars-backward " \n\t\r({[]})") 1575 (skip-chars-backward " \n\t\r({[]})")
1509 (if (not (bobp)) 1576 (if (not (bobp))
1510 (backward-char 1))))) 1577 (backward-char 1)))))
1511 1578
1512 (if (string-match (concat "[" filename-chars "]") 1579 (if (string-match (concat "[" filename-chars "]")
1513 (char-to-string (following-char))) 1580 (char-to-string (following-char)))
1514 (progn 1581 (progn
@@ -1520,7 +1587,7 @@ test if that file exists. Use minibuffer after snatching the filename."
1520 1587
1521 (error "No file found around point!")) 1588 (error "No file found around point!"))
1522 1589
1523 ;; Return string. 1590 ;; Return string.
1524 (expand-file-name (buffer-substring start (point)))))) 1591 (expand-file-name (buffer-substring start (point))))))
1525 1592
1526 1593
@@ -1529,9 +1596,9 @@ test if that file exists. Use minibuffer after snatching the filename."
1529;;; This section is provided for reports. It uses Barry A. Warsaw's 1596;;; This section is provided for reports. It uses Barry A. Warsaw's
1530;;; reporter.el which is bundled with GNU Emacs v19. 1597;;; reporter.el which is bundled with GNU Emacs v19.
1531 1598
1532(defconst dired-x-version "2.14" 1599(defconst dired-x-version "2.27"
1533 "Revision number of dired-x.el -- dired extra for GNU Emacs v19. 1600 "Revision number of dired-x.el -- dired extra for GNU Emacs v19.
1534Type M-x dired-x-submit-report to send a bug report. Available via anonymous 1601Type \\[dired-x-submit-report] to send a bug report. Available via anonymous
1535ftp in 1602ftp in
1536 1603
1537 /roebling.poly.edu:/pub/packages/dired-x.tar.gz") 1604 /roebling.poly.edu:/pub/packages/dired-x.tar.gz")
@@ -1546,7 +1613,7 @@ ftp in
1546 "Name of file containing emacs lisp code.") 1613 "Name of file containing emacs lisp code.")
1547 1614
1548(defconst dired-x-variable-list 1615(defconst dired-x-variable-list
1549 (list 1616 (list
1550 'dired-bind-vm 1617 'dired-bind-vm
1551 'dired-vm-read-only-folders 1618 'dired-vm-read-only-folders
1552 'dired-bind-jump 1619 'dired-bind-jump
@@ -1586,7 +1653,7 @@ listing variables `dired-x-variable-list' in the message."
1586 (concat dired-x-maintainer ","))) ; salutation 1653 (concat dired-x-maintainer ","))) ; salutation
1587 1654
1588 ;; ...fail gracefully. 1655 ;; ...fail gracefully.
1589 (error 1656 (error
1590 (beep) 1657 (beep)
1591 (message "Sorry, reporter.el not found.")))) 1658 (message "Sorry, reporter.el not found."))))
1592 1659