+1999-12-16 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * ls-lisp.el (ls-lisp-insert-directory): Print an explicit message
+ if one of the files specified cannot be accessed by
+ file-attributes. Do not strip any leading directories from the
+ file names, to behave more like `ls' does.
+
+ * dired.el (dired-get-filename): Handle absolute file names.
+ (dired-readin-insert): If argument is a cons, don't print
+ "wildcard" on the ``total'' line.
+
1999-12-15 Eli Zaretskii <eliz@is.elta.co.il>
* faces.el (face-read-integer, read-face-attribute)
;; unless it is an explicit list of files.
(dired-insert-directory dir-or-list dired-actual-switches
(not (listp dir-or-list)))
- (save-excursion ;; insert wildcard instead of total line:
- (goto-char (point-min))
- (insert "wildcard " (file-name-nondirectory dirname) "\n"))))))
+ (or (consp dir-or-list)
+ (save-excursion ;; insert wildcard instead of total line:
+ (goto-char (point-min))
+ (insert "wildcard " (file-name-nondirectory dirname) "\n")))))))
(defun dired-insert-directory (dir-or-list switches &optional wildcard full-p)
;; Do the right thing whether dir-or-list is atomic or not. If it is,
`default-directory', which still may contain slashes if in a subdirectory.
Optional arg NO-ERROR-IF-NOT-FILEP means return nil if no filename on
this line, otherwise an error occurs."
- (let (case-fold-search file p1 p2)
+ (let (case-fold-search file p1 p2 already-absolute)
(save-excursion
(if (setq p1 (dired-move-to-filename (not no-error-if-not-filep)))
(setq p2 (dired-move-to-end-of-filename no-error-if-not-filep))))
"\\([^\\]\\|\\`\\)\"" file "\\1\\\\\"" nil t)
file)
"\"")))))
+ (and (file-name-absolute-p file)
+ (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)))
- (if (eq localp 'no-dir)
- file
- (and file (concat (dired-current-directory localp) file)))))
+ (cond
+ ((and (eq localp 'no-dir) already-absolute)
+ (file-name-nondirectory file))
+ ((or already-absolute (eq localp 'no-dir))
+ file)
+ (t
+ (and file (concat (dired-current-directory localp) file))))))
(defun dired-string-replace-match (regexp string newtext
&optional literal global)
Not all `ls' switches are supported. The switches that work
are: A a c i r S s t u"
- (let ((handler (find-file-name-handler file 'insert-directory)))
+ (let ((handler (find-file-name-handler file 'insert-directory))
+ fattr)
(if handler
(funcall handler 'insert-directory file switches
wildcard full-directory-p)
;; if not full-directory-p, FILE *must not* end in /, as
;; file-attributes will not recognize a symlink to a directory
;; must make it a relative filename as ls does:
- (setq file (file-name-nondirectory file))
- (insert (ls-lisp-format file (file-attributes file)
- (nth 7 (file-attributes file)) switches
- (current-time)))))))
+ (if (eq (aref file (1- (length file))) ?/)
+ (setq file (substring file 0 (1- (length file)))))
+ (setq fattr (file-attributes file))
+ (if fattr
+ (insert (ls-lisp-format file fattr (nth 7 fattr)
+ switches (current-time)))
+ (message "%s: doesn't exist or is inaccessible" file)
+ (ding)
+ (sit-for 2))))))
(defun ls-lisp-delete-matching (regexp list)
;; Delete all elements matching REGEXP from LIST, return new list.