Mercurial > emacs
comparison lisp/ls-lisp.el @ 24329:40be509c47c2
(ls-lisp-insert-directory): Call fceiling to round
the size in blocks, since it can be a float.
(ls-lisp-format): Likewise
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 16 Feb 1999 08:29:22 +0000 |
parents | f0077d5425f2 |
children | 3b5ee0390edd |
comparison
equal
deleted
inserted
replaced
24328:d968067e4580 | 24329:40be509c47c2 |
---|---|
175 ;; Fill in total size of all files: | 175 ;; Fill in total size of all files: |
176 (save-excursion | 176 (save-excursion |
177 (search-backward "total \007") | 177 (search-backward "total \007") |
178 (goto-char (match-end 0)) | 178 (goto-char (match-end 0)) |
179 (delete-char -1) | 179 (delete-char -1) |
180 (insert (format "%d" (if (zerop sum) 0 (1+ (/ sum 1024))))))) | 180 (insert (format "%.0f" (fceiling (/ sum 1024.0)))))) |
181 ;; if not full-directory-p, FILE *must not* end in /, as | 181 ;; if not full-directory-p, FILE *must not* end in /, as |
182 ;; file-attributes will not recognize a symlink to a directory | 182 ;; file-attributes will not recognize a symlink to a directory |
183 ;; must make it a relative filename as ls does: | 183 ;; must make it a relative filename as ls does: |
184 (setq file (file-name-nondirectory file)) | 184 (setq file (file-name-nondirectory file)) |
185 (insert (ls-lisp-format file (file-attributes file) switches | 185 (insert (ls-lisp-format file (file-attributes file) switches |
244 (let ((file-type (nth 0 file-attr))) | 244 (let ((file-type (nth 0 file-attr))) |
245 (concat (if (memq ?i switches) ; inode number | 245 (concat (if (memq ?i switches) ; inode number |
246 (format "%6d " (nth 10 file-attr))) | 246 (format "%6d " (nth 10 file-attr))) |
247 ;; nil is treated like "" in concat | 247 ;; nil is treated like "" in concat |
248 (if (memq ?s switches) ; size in K | 248 (if (memq ?s switches) ; size in K |
249 (format "%4d " (1+ (/ (nth 7 file-attr) 1024)))) | 249 (format "%4d " (fceiling (/ (nth 7 file-attr) 1024.0)))) |
250 (nth 8 file-attr) ; permission bits | 250 (nth 8 file-attr) ; permission bits |
251 ;; numeric uid/gid are more confusing than helpful | 251 ;; numeric uid/gid are more confusing than helpful |
252 ;; Emacs should be able to make strings of them. | 252 ;; Emacs should be able to make strings of them. |
253 ;; user-login-name and user-full-name could take an | 253 ;; user-login-name and user-full-name could take an |
254 ;; optional arg. | 254 ;; optional arg. |