]> git.eshelyaron.com Git - emacs.git/commit
Optional space and unit in `file-size-human-readable' (bug#35756)
authorMattias Engdegård <mattiase@acm.org>
Mon, 13 May 2019 15:05:24 +0000 (17:05 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sun, 23 Jun 2019 18:30:50 +0000 (20:30 +0200)
commit866f527ddf21050a827fa47e04cfe6163f1c7053
tree411dae7879dc84717f0bfd11087633d32762b5a7
parentb439b3bb5a44bc61cec3f5c8e3e3ea37760dfb29
Optional space and unit in `file-size-human-readable' (bug#35756)

To improve readability of strings produced by
`file-size-human-readable', add two optional arguments:

- SPACE, to provide a string (typically a space or non-breaking space)
to put between the number and unit.  For compatibility, the default is
an empty string.

- UNIT, a string to use as unit.  For compatibility, the default is
"B" in `iec' mode and the empty string otherwise.

Also fix a glitch with small numbers in `iec' mode which caused a
stray "i" in the result.

* lisp/files.el (file-size-human-readable):
Add optional SPACE and UNIT arguments and handle small numbers correctly.
(files--ask-user-about-large-file, warn-maybe-out-of-memory):
Call with `iec' and space.
* test/lisp/files-tests.el (files-test-file-size-human-readable): New test.
* lisp/url/url-http.el (url-http-simple-after-change-function)
(url-http-content-length-after-change-function): Call with `iec' and space.
* etc/NEWS (Lisp Changes): Mention the change.
etc/NEWS
lisp/files.el
lisp/url/url-http.el
test/lisp/files-tests.el