diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-05-13 17:05:24 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-06-23 20:30:50 +0200 |
commit | 866f527ddf21050a827fa47e04cfe6163f1c7053 (patch) | |
tree | 411dae7879dc84717f0bfd11087633d32762b5a7 /etc | |
parent | b439b3bb5a44bc61cec3f5c8e3e3ea37760dfb29 (diff) | |
download | emacs-866f527ddf21050a827fa47e04cfe6163f1c7053.tar.gz |
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.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/NEWS | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -2163,6 +2163,15 @@ The functions 'base64-decode-string' and 'base64-decode-region' now accept an optional argument to decode the URL variant of base-64 encoding. ++++ +** The function 'file-size-human-readable' accepts more optional arguments. +The new third argument is a string put between the number and unit; it +defaults to the empty string. The new fourth argument is a string +representing the unit to use; it defaults to "B" when the second +argument is 'iec' and the empty string otherwise. We recomment a +space or non-breaking space as third argument, and "B" as fourth +argument, circumstances allowing. + * Changes in Emacs 27.1 on Non-Free Operating Systems |