summaryrefslogtreecommitdiff
path: root/lisp/dired-aux.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2000-07-10 07:02:03 +0000
committerMiles Bader <miles@gnu.org>2000-07-10 07:02:03 +0000
commitee6be958ad35fad124d85e455958c4766dc18b77 (patch)
treee6ba42fde579ff58d1701253b323caa2e7bbe5ca /lisp/dired-aux.el
parentf01fd03b41bb41d735b1b99348811e34cc684940 (diff)
downloademacs-ee6be958ad35fad124d85e455958c4766dc18b77.tar.gz
(dired-show-file-type): New function.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r--lisp/dired-aux.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 74c473ff7f0..8ff4128350d 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1,6 +1,6 @@
;;; dired-aux.el --- less commonly used parts of dired -*-byte-compile-dynamic: t;-*-
-;; Copyright (C) 1985, 1986, 1992, 1994, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1994, 1998, 2000 Free Software Foundation, Inc.
;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>.
;; Maintainer: FSF
@@ -1969,6 +1969,19 @@ with the command \\[tags-loop-continue]."
"sQuery replace in marked files (regexp): \nsQuery replace %s by: \nP")
(tags-query-replace from to delimited '(dired-get-marked-files)))
+;;;###autoload
+(defun dired-show-file-type (file &optional deref-symlinks)
+ "Print the type of FILE, according to the `file' command.
+If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is
+true then the type of the file linked to by FILE is printed instead."
+ (interactive (list (dired-get-filename t) current-prefix-arg))
+ (with-temp-buffer
+ (if deref-symlinks
+ (call-process "file" nil t t "-L" file)
+ (call-process "file" nil t t file))
+ (when (bolp)
+ (backward-delete-char 1))
+ (message (buffer-string))))
(provide 'dired-aux)