Commit a5e0e1a8 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

* 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.
parent 363e4e42
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)
......
......@@ -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)
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment