]> code.delx.au - gnu-emacs/blobdiff - lisp/dired.el
(custom-set-variables): Set options with :require
[gnu-emacs] / lisp / dired.el
index 6be3bff0984a8a13e56cd6bd05ce348b1478eeb7..cc5f0bbca11fbb1b6a29c9e93fdfa2b3bd2c35bd 100644 (file)
@@ -1,6 +1,7 @@
 ;;; 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
@@ -689,9 +690,13 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
            ;; 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
@@ -731,11 +736,13 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
     (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))))
 
@@ -1432,6 +1439,9 @@ Optional arg NO-ERROR-IF-NOT-FILEP means return nil if no filename on
                             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)
@@ -1498,7 +1508,7 @@ DIR must be a directory name, not a file name."
         ;; 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]")
@@ -1508,21 +1518,30 @@ DIR must be a directory name, not a file name."
 ;;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.")
@@ -2148,7 +2167,8 @@ FILES is the list of marked files."
     (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))))
@@ -2640,6 +2660,7 @@ With a prefix argument you can edit the current listing switches instead."
   (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.
@@ -2702,7 +2723,8 @@ To be called first in body of `dired-sort-other', etc."
 
 (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)