diff options
| author | Geoff Voelker | 1999-08-06 20:41:07 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1999-08-06 20:41:07 +0000 |
| commit | 261c60553a5dc735a17bfaa9b263b467b3b18c28 (patch) | |
| tree | 93ec71d82828e7f496a54556d4861e6ae1874a21 | |
| parent | b19cc00c30cb5261225fc0a80e1f7a9dcba13b51 (diff) | |
| download | emacs-261c60553a5dc735a17bfaa9b263b467b3b18c28.tar.gz emacs-261c60553a5dc735a17bfaa9b263b467b3b18c28.zip | |
(ls-lisp-delete-matching): List argument is now alist
of filenames and attributes.
(ls-lisp-insert-directory): Use directory-files-and-attributes
for speed.
| -rw-r--r-- | lisp/ls-lisp.el | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index e02bd5db459..6158eff5df9 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el | |||
| @@ -134,29 +134,18 @@ are: A a c i r S s t u" | |||
| 134 | (sum 0) | 134 | (sum 0) |
| 135 | elt | 135 | elt |
| 136 | short | 136 | short |
| 137 | (file-list (directory-files dir nil wildcard)) | 137 | (file-alist (directory-files-and-attributes dir nil wildcard)) |
| 138 | file-alist | ||
| 139 | (now (current-time)) | 138 | (now (current-time)) |
| 140 | ;; do all bindings here for speed | 139 | ;; do all bindings here for speed |
| 141 | file-size | 140 | file-size |
| 142 | fil attr) | 141 | fil attr) |
| 143 | (cond ((memq ?A switches) | 142 | (cond ((memq ?A switches) |
| 144 | (setq file-list | 143 | (setq file-alist |
| 145 | (ls-lisp-delete-matching "^\\.\\.?$" file-list))) | 144 | (ls-lisp-delete-matching "^\\.\\.?$" file-alist))) |
| 146 | ((not (memq ?a switches)) | 145 | ((not (memq ?a switches)) |
| 147 | ;; if neither -A nor -a, flush . files | 146 | ;; if neither -A nor -a, flush . files |
| 148 | (setq file-list | 147 | (setq file-alist |
| 149 | (ls-lisp-delete-matching "^\\." file-list)))) | 148 | (ls-lisp-delete-matching "^\\." file-alist)))) |
| 150 | (setq file-alist | ||
| 151 | (mapcar | ||
| 152 | (function | ||
| 153 | (lambda (x) | ||
| 154 | ;; file-attributes("~bogus") bombs | ||
| 155 | (cons x (file-attributes (expand-file-name x))))) | ||
| 156 | ;; inserting the call to directory-files right here | ||
| 157 | ;; seems to stimulate an Emacs bug | ||
| 158 | ;; ILLEGAL DATATYPE (#o37777777727) or #o67 | ||
| 159 | file-list)) | ||
| 160 | ;; ``Total'' line (filled in afterwards). | 149 | ;; ``Total'' line (filled in afterwards). |
| 161 | (insert (if (car-safe file-alist) | 150 | (insert (if (car-safe file-alist) |
| 162 | "total \007\n" | 151 | "total \007\n" |
| @@ -201,7 +190,7 @@ are: A a c i r S s t u" | |||
| 201 | ;; Should perhaps use setcdr for efficiency. | 190 | ;; Should perhaps use setcdr for efficiency. |
| 202 | (let (result) | 191 | (let (result) |
| 203 | (while list | 192 | (while list |
| 204 | (or (string-match regexp (car list)) | 193 | (or (string-match regexp (car (car list))) |
| 205 | (setq result (cons (car list) result))) | 194 | (setq result (cons (car list) result))) |
| 206 | (setq list (cdr list))) | 195 | (setq list (cdr list))) |
| 207 | result)) | 196 | result)) |