;;; 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
(concat (if dired-one-file op1 operation) " %s to: ")
(dired-dwim-target-directory)
op-symbol arg rfn-list)))
- (into-dir (cond ((null how-to) (file-directory-p target))
+ (into-dir (cond ((null how-to)
+ ;; Allow DOS/Windows users to change the letter
+ ;; case of a directory. If we don't test these
+ ;; conditions up front, file-directory-p below
+ ;; will return t because the filesystem is
+ ;; case-insensitive, and Emacs will try to move
+ ;; foo -> foo/foo, which fails.
+ (if (and (memq system-type '(ms-dos windows-nt))
+ (eq op-symbol 'move)
+ dired-one-file
+ (string= (downcase
+ (expand-file-name (car fn-list)))
+ (downcase
+ (expand-file-name target)))
+ (not (string=
+ (file-name-nondirectory (car fn-list))
+ (file-name-nondirectory target))))
+ nil
+ (file-directory-p target)))
((eq how-to t) nil)
(t (funcall how-to target)))))
(if (and (consp into-dir) (functionp (car into-dir)))
and new copies of these files are made in that directory
with the same names that the files currently have."
(interactive "P")
-n (let ((dired-recursive-copies dired-recursive-copies))
+ (let ((dired-recursive-copies dired-recursive-copies))
(dired-do-create-files 'copy (function dired-copy-file)
- (if dired-copy-preserve-time "Copy [-p]" "Copy")
- arg dired-keep-marker-copy
- nil dired-copy-how-to-fn)))
+ (if dired-copy-preserve-time "Copy [-p]" "Copy")
+ arg dired-keep-marker-copy
+ nil dired-copy-how-to-fn)))
;;;###autoload
(defun dired-do-symlink (&optional arg)
;; insert message so that the user sees the `Mark set' message.
(push-mark opoint)))
+;;;###autoload
(defun dired-insert-subdir (dirname &optional switches no-error-if-not-dir-p)
"Insert this subdirectory into the same dired buffer.
If it is already present, overwrites previous entry,
(tags-search regexp '(dired-get-marked-files)))
;;;###autoload
-(defun dired-do-query-replace (from to &optional delimited)
+(defun dired-do-query-replace-regexp (from to &optional delimited)
"Do `query-replace-regexp' of FROM with TO, on all marked files.
Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
If you exit (\\[keyboard-quit] or ESC), you can resume the query replace
"sQuery replace in marked files (regexp): \nsQuery replace %s by: \nP")
(tags-query-replace from to delimited '(dired-get-marked-files)))
\f
+;;;###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)