diff options
| author | Eli Zaretskii | 2011-04-09 09:59:26 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-04-09 09:59:26 +0300 |
| commit | 04f33f1ed9cdfed6a3e44a55d333cd19d58424ca (patch) | |
| tree | fde0e2644a278b7e49c0871e33a2c4db62d60022 | |
| parent | d7b898799f330e0543b3f01277114a9e98a7a456 (diff) | |
| download | emacs-04f33f1ed9cdfed6a3e44a55d333cd19d58424ca.tar.gz emacs-04f33f1ed9cdfed6a3e44a55d333cd19d58424ca.zip | |
Produce more accurate results from file-size-human-readable.
lisp/files.el (file-size-human-readable): Produce one digit after
decimal, like "ls -lh" does.
lisp/ls-lisp.el (ls-lisp-format-file-size): Allow for 7 characters in
the file size representation.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/files.el | 5 | ||||
| -rw-r--r-- | lisp/ls-lisp.el | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 07d77bc9d64..b7d80c636a7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -12,6 +12,12 @@ | |||
| 12 | 12 | ||
| 13 | 2011-04-08 Eli Zaretskii <eliz@gnu.org> | 13 | 2011-04-08 Eli Zaretskii <eliz@gnu.org> |
| 14 | 14 | ||
| 15 | * files.el (file-size-human-readable): Produce one digit after | ||
| 16 | decimal, like "ls -lh" does. | ||
| 17 | |||
| 18 | * ls-lisp.el (ls-lisp-format-file-size): Allow for 7 characters in | ||
| 19 | the file size representation. | ||
| 20 | |||
| 15 | * simple.el (list-processes): If async subprocesses are not | 21 | * simple.el (list-processes): If async subprocesses are not |
| 16 | available, error out with a clear error message. | 22 | available, error out with a clear error message. |
| 17 | 23 | ||
diff --git a/lisp/files.el b/lisp/files.el index fd241041b74..5b29f3790e8 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1162,7 +1162,10 @@ Optional second argument FLAVOR controls the units and the display format: | |||
| 1162 | (while (and (>= file-size power) (cdr post-fixes)) | 1162 | (while (and (>= file-size power) (cdr post-fixes)) |
| 1163 | (setq file-size (/ file-size power) | 1163 | (setq file-size (/ file-size power) |
| 1164 | post-fixes (cdr post-fixes))) | 1164 | post-fixes (cdr post-fixes))) |
| 1165 | (format "%.0f%s%s" file-size | 1165 | (format (if (> (mod file-size 1.0) 0.05) |
| 1166 | "%.1f%s%s" | ||
| 1167 | "%.0f%s%s") | ||
| 1168 | file-size | ||
| 1166 | (if (and (eq flavor 'iec) (string= (car post-fixes) "k")) | 1169 | (if (and (eq flavor 'iec) (string= (car post-fixes) "k")) |
| 1167 | "K" | 1170 | "K" |
| 1168 | (car post-fixes)) | 1171 | (car post-fixes)) |
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 44e8bce5b8d..9314f934dc1 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el | |||
| @@ -724,7 +724,7 @@ All ls time options, namely c, t and u, are handled." | |||
| 724 | ls-lisp-filesize-f-fmt | 724 | ls-lisp-filesize-f-fmt |
| 725 | ls-lisp-filesize-d-fmt) | 725 | ls-lisp-filesize-d-fmt) |
| 726 | file-size) | 726 | file-size) |
| 727 | (format " %4s" (file-size-human-readable file-size)))) | 727 | (format " %7s" (file-size-human-readable file-size)))) |
| 728 | 728 | ||
| 729 | (provide 'ls-lisp) | 729 | (provide 'ls-lisp) |
| 730 | 730 | ||