;;; dired.el --- directory-browsing commands
-;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001
+;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001, 2003
;; Free Software Foundation, Inc.
;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
:type 'string
:group 'dired)
-; Don't use absolute paths as /bin should be in any PATH and people
+; Don't use absolute file names as /bin should be in any PATH and people
; may prefer /usr/local/gnu/bin or whatever. However, chown is
; usually not in PATH.
;;;###autoload
(defvar dired-chown-program
- (if (memq system-type '(hpux dgux usg-unix-v irix linux gnu/linux))
+ (if (memq system-type '(hpux dgux usg-unix-v irix linux gnu/linux cygwin))
"chown"
(if (file-exists-p "/usr/sbin/chown")
"/usr/sbin/chown"
(defvar dired-file-version-alist)
+;;;###autoload
(defvar dired-directory nil
"The directory name or wildcard spec that this Dired directory lists.
Local to each dired buffer. May be a list, in which case the car is the
'(".+" (dired-move-to-filename) nil (0 font-lock-function-name-face)))
;;
;; Symbolic links.
- (list dired-re-sym
+ (list dired-re-sym
'(".+" (dired-move-to-filename) nil (0 font-lock-keyword-face)))
;;
;; Files suffixed with `completion-ignored-extensions'.
(setq buffer (create-file-buffer (directory-file-name dirname)))))
(set-buffer buffer)
(if (not new-buffer-p) ; existing buffer ...
- (cond (switches ; ... but new switches
+ (cond (switches ; ... but new switches
;; file list may have changed
(setq dired-directory dir-or-list)
;; this calls dired-revert
- (dired-sort-other switches))
+ (dired-sort-other switches))
;; If directory has changed on disk, offer to revert.
((if (let ((attributes (file-attributes dirname))
(modtime (visited-file-modtime)))
(save-excursion
(set-buffer (cdr (car blist)))
(if (and (eq major-mode mode)
+ dired-directory ;; nil during find-alternate-file
(equal dirname
(expand-file-name
(if (consp dired-directory)
(or (dired-string-replace-match
"\\([^\\]\\|\\`\\)\"" file "\\1\\\\\"" nil t)
file)
- "\"")))))
+ "\"")))
+ ;; The above `read' will return a unibyte string if FILE
+ ;; contains eight-bit-control/graphic characters.
+ (if (and enable-multibyte-characters
+ (not (multibyte-string-p file)))
+ (setq file (string-to-multibyte file)))))
(and file (file-name-absolute-p file)
;; A relative file name can start with ~.
;; Don't treat it as absolute in this context.
(not (eq (aref file 0) ?~))
(setq already-absolute t))
- (and file buffer-file-coding-system
- (not file-name-coding-system)
- (not default-file-name-coding-system)
- (setq file (encode-coding-string file buffer-file-coding-system)))
(cond
((null file)
nil)
(replace-match newtext t literal string))))
(defun dired-make-absolute (file &optional dir)
- ;;"Convert FILE (a pathname relative to DIR) to an absolute pathname."
+ ;;"Convert FILE (a file name relative to DIR) to an absolute file name."
;; We can't always use expand-file-name as this would get rid of `.'
;; or expand in / instead default-directory if DIR=="".
;; This should be good enough for ange-ftp, but might easily be
;; The "[0-9]" below requires the previous column to end in a digit.
;; This avoids recognizing `1 may 1997' as a date in the line:
;; -r--r--r-- 1 may 1997 1168 Oct 19 16:49 README
- ;; The "[kMGTPEZY]?" below supports "ls -alh" output.
+ ;; The "[kKMGTPEZY]?" below supports "ls -alh" output.
;; The ".*" below finds the last match if there are multiple matches.
;; This avoids recognizing `jservice 10 1024' as a date in the line:
;; drwxr-xr-x 3 jservice 10 1024 Jul 2 1997 esg-host
- (concat ".*[0-9][kMGTPEZY]?" s
+ (concat ".*[0-9][kKMGTPEZY]?" s
"\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)"
s "+"))
"Regular expression to match up to the file name in a directory listing.
(defun dired-copy-filename-as-kill (&optional arg)
"Copy names of marked (or next ARG) files into the kill ring.
The names are separated by a space.
-With a zero prefix arg, use the complete pathname of each marked file.
-With \\[universal-argument], use the relative pathname of each marked file.
+With a zero prefix arg, use the absolute file name of each marked file.
+With \\[universal-argument], use the file name sans directory of each marked file.
If on a subdir headerline, use subdirname instead; prefix arg is ignored
in this case.
(substring pattern matched-in-pattern))
"\\'")))
-
+
(defun dired-advertise ()
;;"Advertise in variable `dired-buffers' that we dired `default-directory'."
(string-match (concat "^" (regexp-quote dir)) file)))
(defun dired-normalize-subdir (dir)
- ;; Prepend default-directory to DIR if relative path name.
- ;; dired-get-filename must be able to make a valid filename from a
+ ;; Prepend default-directory to DIR if relative file name.
+ ;; dired-get-filename must be able to make a valid file name from a
;; file and its directory DIR.
(file-name-as-directory
(if (file-name-absolute-p dir)
(defun dired-goto-file (file)
"Go to file line of FILE in this dired buffer."
;; Return value of point on success, else nil.
- ;; FILE must be an absolute pathname.
+ ;; FILE must be an absolute file name.
;; Loses if FILE contains control chars like "\007" for which ls
;; either inserts "?" or "\\007" into the buffer, so we won't find
;; it in the buffer.
(const :tag "Confirm for each top directory only" top))
:group 'dired)
-;; Match anything but `.' and `..'.
+;; Match anything but `.' and `..'.
(defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")
;; Delete file, possibly delete a directory and all its files.
(setq success-list (cons (buffer-name buf) success-list)))))
success-list))
-;; Delete the entry for FILE from
+;; Delete the entry for FILE from
(defun dired-delete-entry (file)
(save-excursion
(and (dired-goto-file file)
"auto save file")))
(defvar dired-garbage-files-regexp
- "\\.log$\\|\\.toc$\\|\\.dvi$\\|\\.bak$\\|\\.orig$\\|\\.rej$\\|.aux$"
+ (concat (regexp-opt
+ '(".log" ".toc" ".dvi" ".bak" ".orig" ".rej" ".aux"))
+ "\\'")
"*Regular expression to match \"garbage\" files for `dired-flag-garbage-files'.")
(defun dired-flag-garbage-files ()
(defun dired-unmark-all-files (mark &optional arg)
"Remove a specific mark (or any mark) from every file.
-After this command, type the mark character to remove,
+After this command, type the mark character to remove,
or type RET to remove all marks.
With prefix arg, query for each marked file.
Type \\[help-command] at that time for help."
;; Log a message or the contents of a buffer.
;; If LOG is a string and there are more args, it is formatted with
;; those ARGS. Usually the LOG string ends with a \n.
- ;; End each bunch of errors with (dired-log t):
+ ;; End each bunch of errors with (dired-log t):
;; this inserts the current time and buffer at the start of the page,
;; and \f (formfeed) at the end.
(let ((obuf (current-buffer)))
what to do with it. For directions, type \\[help-command] at that time.
NEWNAME may contain \\=\\<n> or \\& as in `query-replace-regexp'.
REGEXP defaults to the last regexp used.
-With a zero prefix arg, renaming by regexp affects the complete
- pathname - usually only the non-directory part of file names is used
- and changed."
+With a zero prefix arg, renaming by regexp affects the full file name;
+usually only the non-directory part of file names is used and changed."
t)
(autoload 'dired-do-copy-regexp "dired-aux"
(autoload 'dired-show-file-type "dired-aux"
"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."
+true then the type of the file linked to by FILE is printed instead."
t)
(autoload 'dired-run-shell-command "dired-aux")