;;; dired.el --- directory-browsing commands
-;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001
+;; Free Software Foundation, Inc.
;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
;; Maintainer: FSF
;; Non-Posix systems don't always have dired-free-space-program,
;; but might have an equivalent system call.
(if (fboundp 'file-system-info)
- (insert
- (format "%.0f"
- (/ (nth 2 (file-system-info dir-or-list)) 1024)))
+ (let ((beg (point))
+ (fsinfo (file-system-info dir-or-list)))
+ (if fsinfo
+ (insert
+ (format "%.0f" (/ (nth 2 fsinfo) 1024)))
+ ;; file-system-info failed; delete " free ".
+ (delete-region (- beg 7) beg)))
(let ((beg (point)))
(condition-case nil
(if (zerop (call-process dired-free-space-program nil t nil
(while (< (point) end)
(condition-case nil
(if (dired-move-to-filename)
- (put-text-property (point)
- (save-excursion
- (dired-move-to-end-of-filename)
- (point))
- 'mouse-face 'highlight))
+ (add-text-properties
+ (point)
+ (save-excursion
+ (dired-move-to-end-of-filename)
+ (point))
+ '(mouse-face highlight
+ help-echo "mouse-2: visit this file in other window")))
(error nil))
(forward-line 1))))
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)
;; weiand: changed: month ends potentially with . or , or .,
;;old (month (concat l l "+ *"))
(month (concat l l "+[.]?,? *"))
- ;; Recognize any non-ASCII character.
+ ;; Recognize any non-ASCII character.
;; The purpose is to match a Kanji character.
(k "[^\0-\177]")
;; (k "[^\x00-\x7f\x80-\xff]")
;;old (dd "[ 0-3][0-9]")
(dd "[ 0-3][0-9][.]?")
(HH:MM "[ 0-2][0-9]:[0-5][0-9]")
+ (seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
+ (zone "[-+][0-2][0-9][0-5][0-9]")
+ (iso-mm-dd "[01][0-9]-[0-3][0-9]")
+ (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
+ (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
+ "\\|" yyyy "-" iso-mm-dd " ?\\)"))
(western (concat "\\(" month s dd "\\|" dd s month "\\)"
;; weiand: changed: year potentially unaligned
;;old s "\\(" HH:MM "\\|" s yyyy "\\|" yyyy s "\\)"))
- s "\\(" HH:MM
+ s "\\(" HH:MM
"\\|" yyyy s s "?"
"\\|" s "?" yyyy
"\\)"))
- (japanese (concat mm k s dd k s "\\(" s HH:MM "\\|" yyyy k "\\)")))
+ (japanese
+ (concat mm k s dd k "?" s "+" "\\(" HH:MM "\\|" yyyy k "?" "\\)")))
;; 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 ".*" 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]" s "\\(" western "\\|" japanese "\\)" s))
+ (concat ".*[0-9][kMGTPEZY]?"
+ s "\\(" western "\\|" japanese "\\|" iso "\\)" s))
"Regular expression to match up to the file name in a directory listing.
The default value is designed to recognize dates and times
regardless of the language.")
(with-current-buffer (get-buffer-create bufname)
(erase-buffer)
(dired-format-columns-of-files files)
- (remove-text-properties (point-min) (point-max) '(mouse-face)))
+ (remove-text-properties (point-min) (point-max)
+ '(mouse-face nil help-echo nil)))
(save-window-excursion
(dired-pop-to-buffer bufname)
(apply function args))))
(dired-sort-set-modeline)
(revert-buffer))
+;; Some user code loads dired especially for this.
(defun dired-replace-in-string (regexp newtext string)
;; Replace REGEXP with NEWTEXT everywhere in STRING and return result.
;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized.
(autoload 'dired-diff "dired-aux"
"Compare file at point with file FILE using `diff'.
-FILE defaults to the file at the mark.
+FILE defaults to the file at the mark. (That's the mark set by
+\\[set-mark-command], not by Dired's \\[dired-mark] command.)
The prompted-for file is the first file given to `diff'."
t)