aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-03-23 07:38:57 +0000
committerJuri Linkov2004-03-23 07:38:57 +0000
commitecd69427b6748edef5e288599793c602a5850655 (patch)
tree589318c7d49b5417571b2dbc3390846b63ee8282
parentcc8b577edeb9d85647019d1acb9f875cccd164c4 (diff)
downloademacs-ecd69427b6748edef5e288599793c602a5850655.tar.gz
emacs-ecd69427b6748edef5e288599793c602a5850655.zip
(dired-guess-shell-alist-default): Add choices for
extracting files into subdirectory. Add tbz and dz. Fix regexps. Add extensions .[0-9] for man and nroff, and .pod for perldoc. (dired-man): Use dired-guess-shell-command. (dired-guess-shell-case-fold-search): Change defvar to defcustom. Change default nil to t.
-rw-r--r--lisp/dired-x.el88
1 files changed, 70 insertions, 18 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 3e645cb8a8b..fc30428e562 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -7,7 +7,7 @@
7;; Date: 1994/08/18 19:27:42 7;; Date: 1994/08/18 19:27:42
8;; Keywords: dired extensions files 8;; Keywords: dired extensions files
9 9
10;; Copyright (C) 1993, 1994, 1997, 2001, 2003 Free Software Foundation, Inc. 10;; Copyright (C) 1993, 1994, 1997, 2001, 2003, 2004 Free Software Foundation, Inc.
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -887,9 +887,17 @@ dired."
887 887
888(defvar dired-guess-shell-alist-default 888(defvar dired-guess-shell-alist-default
889 (list 889 (list
890 (list "\\.tar$" '(if dired-guess-shell-gnutar 890 (list "\\.tar$"
891 (concat dired-guess-shell-gnutar " xvf") 891 '(if dired-guess-shell-gnutar
892 "tar xvf")) 892 (concat dired-guess-shell-gnutar " xvf")
893 "tar xvf")
894 ;; Extract files into a separate subdirectory
895 '(if dired-guess-shell-gnutar
896 (concat "mkdir " (file-name-sans-extension file)
897 "; " dired-guess-shell-gnutar " -C "
898 (file-name-sans-extension file) " -xvf")
899 (concat "mkdir " (file-name-sans-extension file)
900 "; tar -C " (file-name-sans-extension file) " -xvf")))
893 901
894 ;; REGEXPS for compressed archives must come before the .Z rule to 902 ;; REGEXPS for compressed archives must come before the .Z rule to
895 ;; be recognized: 903 ;; be recognized:
@@ -907,32 +915,68 @@ dired."
907 '(if dired-guess-shell-gnutar 915 '(if dired-guess-shell-gnutar
908 (concat dired-guess-shell-gnutar " zxvf") 916 (concat dired-guess-shell-gnutar " zxvf")
909 (concat "gunzip -qc * | tar xvf -")) 917 (concat "gunzip -qc * | tar xvf -"))
918 ;; Extract files into a separate subdirectory
919 '(if dired-guess-shell-gnutar
920 (concat "mkdir " (file-name-sans-extension file)
921 "; " dired-guess-shell-gnutar " -C "
922 (file-name-sans-extension file) " -zxvf")
923 (concat "mkdir " (file-name-sans-extension file)
924 "; gunzip -qc * | tar -C "
925 (file-name-sans-extension file) " -xvf -"))
910 ;; Optional decompression. 926 ;; Optional decompression.
911 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q" ""))) 927 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q" "")))
928
912 ;; bzip2'ed archives 929 ;; bzip2'ed archives
913 (list "\\.tar\\.bz2$" 930 (list "\\.t\\(ar\\.bz2\\|bz\\)$"
914 "bunzip2 -c * | tar xvf -" 931 "bunzip2 -c * | tar xvf -"
932 ;; Extract files into a separate subdirectory
933 '(concat "mkdir " (file-name-sans-extension file)
934 "; bunzip2 -c * | tar -C "
935 (file-name-sans-extension file) " -xvf -")
915 ;; Optional decompression. 936 ;; Optional decompression.
916 "bunzip2") 937 "bunzip2")
917 938
918 '("\\.shar.Z$" "zcat * | unshar") 939 '("\\.shar\\.Z$" "zcat * | unshar")
919 '("\\.shar.g?z$" "gunzip -qc * | unshar") 940 '("\\.shar\\.g?z$" "gunzip -qc * | unshar")
920 941
921 '("\\.e?ps$" "ghostview" "xloadimage" "lpr") 942 '("\\.e?ps$" "ghostview" "xloadimage" "lpr")
922 (list "\\.e?ps.g?z$" "gunzip -qc * | ghostview -" 943 (list "\\.e?ps\\.g?z$" "gunzip -qc * | ghostview -"
923 ;; Optional decompression. 944 ;; Optional decompression.
924 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) 945 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
925 (list "\\.e?ps.Z$" "zcat * | ghostview -" 946 (list "\\.e?ps\\.Z$" "zcat * | ghostview -"
926 ;; Optional conversion to gzip format. 947 ;; Optional conversion to gzip format.
927 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") 948 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
928 " " dired-guess-shell-znew-switches)) 949 " " dired-guess-shell-znew-switches))
950
929 '("\\.patch$" "cat * | patch") 951 '("\\.patch$" "cat * | patch")
930 '("\\.patch.g?z$" "gunzip -qc * | patch") 952 (list "\\.patch\\.g?z$" "gunzip -qc * | patch"
931 (list "\\.patch.Z$" "zcat * | patch" 953 ;; Optional decompression.
954 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
955 (list "\\.patch\\.Z$" "zcat * | patch"
932 ;; Optional conversion to gzip format. 956 ;; Optional conversion to gzip format.
933 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") 957 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
934 " " dired-guess-shell-znew-switches)) 958 " " dired-guess-shell-znew-switches))
935 959
960 ;; The following four extensions are useful with dired-man ("N" key)
961 (list "\\.[0-9]$" '(progn (require 'man)
962 (if (Man-support-local-filenames)
963 "man -l"
964 "cat * | tbl | nroff -man -h")))
965 (list "\\.[0-9]\\.g?z$" '(progn (require 'man)
966 (if (Man-support-local-filenames)
967 "man -l"
968 "gunzip -qc * | tbl | nroff -man -h"))
969 ;; Optional decompression.
970 '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
971 (list "\\.[0-9]\\.Z$" '(progn (require 'man)
972 (if (Man-support-local-filenames)
973 "man -l"
974 "zcat * | tbl | nroff -man -h"))
975 ;; Optional conversion to gzip format.
976 '(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
977 " " dired-guess-shell-znew-switches))
978 '("\\.pod$" "perldoc" "pod2man * | nroff -man")
979
936 '("\\.dvi$" "xdvi" "dvips") ; preview and printing 980 '("\\.dvi$" "xdvi" "dvips") ; preview and printing
937 '("\\.au$" "play") ; play Sun audiofiles 981 '("\\.au$" "play") ; play Sun audiofiles
938 '("\\.mpg$" "mpeg_play") 982 '("\\.mpg$" "mpeg_play")
@@ -945,7 +989,7 @@ dired."
945 '("\\.gif$" "xloadimage") ; view gif pictures 989 '("\\.gif$" "xloadimage") ; view gif pictures
946 '("\\.tif$" "xloadimage") 990 '("\\.tif$" "xloadimage")
947 '("\\.png$" "display") ; xloadimage 4.1 doesn't grok PNG 991 '("\\.png$" "display") ; xloadimage 4.1 doesn't grok PNG
948 '("\\.jpg$" "xloadimage") 992 '("\\.jpe?g$" "xloadimage")
949 '("\\.fig$" "xfig") ; edit fig pictures 993 '("\\.fig$" "xfig") ; edit fig pictures
950 '("\\.out$" "xgraph") ; for plotting purposes. 994 '("\\.out$" "xgraph") ; for plotting purposes.
951 '("\\.tex$" "latex" "tex") 995 '("\\.tex$" "latex" "tex")
@@ -953,14 +997,18 @@ dired."
953 '("\\.pdf$" "xpdf") ; edit PDF files 997 '("\\.pdf$" "xpdf") ; edit PDF files
954 998
955 ;; Some other popular archivers. 999 ;; Some other popular archivers.
1000 (list "\\.zip$" "unzip"
1001 ;; Extract files into a separate subdirectory
1002 '(concat "unzip" (if dired-guess-shell-gzip-quiet " -q")
1003 " -d " (file-name-sans-extension file)))
956 '("\\.zoo$" "zoo x//") 1004 '("\\.zoo$" "zoo x//")
957 '("\\.zip$" "unzip")
958 '("\\.lzh$" "lharc x") 1005 '("\\.lzh$" "lharc x")
959 '("\\.arc$" "arc x") 1006 '("\\.arc$" "arc x")
960 '("\\.shar$" "unshar") 1007 '("\\.shar$" "unshar")
961 1008
962 ;; Compression. 1009 ;; Compression.
963 (list "\\.g?z$" '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) 1010 (list "\\.g?z$" '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
1011 (list "\\.dz$" "dictunzip")
964 (list "\\.bz2$" "bunzip2") 1012 (list "\\.bz2$" "bunzip2")
965 (list "\\.Z$" "uncompress" 1013 (list "\\.Z$" "uncompress"
966 ;; Optional conversion to gzip format. 1014 ;; Optional conversion to gzip format.
@@ -998,9 +1046,11 @@ You can set this variable in your ~/.emacs. For example, to add rules for
998 :group 'dired-x 1046 :group 'dired-x
999 :type '(alist :key-type regexp :value-type (repeat sexp))) 1047 :type '(alist :key-type regexp :value-type (repeat sexp)))
1000 1048
1001(defvar dired-guess-shell-case-fold-search nil 1049(defcustom dired-guess-shell-case-fold-search t
1002 "*If non-nil, `dired-guess-shell-alist-default' and 1050 "If non-nil, `dired-guess-shell-alist-default' and
1003`dired-guess-shell-alist-user' are matched case-insensitively.") 1051`dired-guess-shell-alist-user' are matched case-insensitively."
1052 :group 'dired-x
1053 :type 'boolean)
1004 1054
1005(defun dired-guess-default (files) 1055(defun dired-guess-default (files)
1006 "Guess a shell commands for FILES. Return command or list of commands. 1056 "Guess a shell commands for FILES. Return command or list of commands.
@@ -1278,8 +1328,10 @@ NOSELECT the files are merely found but not selected."
1278Uses ../lisp/man.el of \\[manual-entry] fame." 1328Uses ../lisp/man.el of \\[manual-entry] fame."
1279 (interactive) 1329 (interactive)
1280 (require 'man) 1330 (require 'man)
1281 (let ((file (dired-get-filename)) 1331 (let* ((file (dired-get-filename))
1282 (manual-program "nroff -man -h")) 1332 (manual-program (replace-regexp-in-string "\\*" "%s"
1333 (dired-guess-shell-command
1334 "Man command: " (list file)))))
1283 (Man-getpage-in-background file))) 1335 (Man-getpage-in-background file)))
1284 1336
1285;;; Run Info on files. 1337;;; Run Info on files.