Mercurial > emacs
changeset 26914:09c7b74fa57f
* 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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 16 Dec 1999 09:43:32 +0000 |
parents | 9d6d94db8909 |
children | 11fddded9ceb |
files | lisp/ChangeLog lisp/dired.el lisp/ls-lisp.el |
diffstat | 3 files changed, 36 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Dec 16 09:38:21 1999 +0000 +++ b/lisp/ChangeLog Thu Dec 16 09:43:32 1999 +0000 @@ -1,3 +1,14 @@ +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)
--- a/lisp/dired.el Thu Dec 16 09:38:21 1999 +0000 +++ b/lisp/dired.el Thu Dec 16 09:43:32 1999 +0000 @@ -651,9 +651,10 @@ ;; 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, @@ -1314,7 +1315,7 @@ `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)))) @@ -1335,13 +1336,19 @@ "\\([^\\]\\|\\`\\)\"" 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)
--- a/lisp/ls-lisp.el Thu Dec 16 09:38:21 1999 +0000 +++ b/lisp/ls-lisp.el Thu Dec 16 09:43:32 1999 +0000 @@ -106,7 +106,8 @@ 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) @@ -180,10 +181,15 @@ ;; 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.