summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>1999-12-16 09:43:32 +0000
committerEli Zaretskii <eliz@gnu.org>1999-12-16 09:43:32 +0000
commita5e0e1a8abc622c8d184c1b3a6e068b93485c0cc (patch)
tree6aea588c3fa021a31708670bd37f8a5c665d3f1f
parent363e4e4226195164a316ba23f9069feaa9898f4a (diff)
downloademacs-a5e0e1a8abc622c8d184c1b3a6e068b93485c0cc.tar.gz
* 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.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/dired.el21
-rw-r--r--lisp/ls-lisp.el16
3 files changed, 36 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 799ed3b55b9..f2a0a6dede8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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)
diff --git a/lisp/dired.el b/lisp/dired.el
index 895c95fc78e..c56485033a6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -651,9 +651,10 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
;; 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 @@ Optional arg LOCALP with value `no-dir' means don't include directory
`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 @@ Optional arg NO-ERROR-IF-NOT-FILEP means return nil if no filename on
"\\([^\\]\\|\\`\\)\"" 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)
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 6158eff5df9..fa7b462b3ff 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -106,7 +106,8 @@ file names.
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 @@ are: A a c i r S s t u"
;; 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.