1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 06:20:43 -08:00

Clean up file-size-function

It is now called `byte-count-to-string-function', and used instead of
calling `file-size-human-readable' directly where appropriate.

* lisp/files.el (file-size-human-readable-iec): New.
(file-size-function): Rename to byte-count-to-string-function.  Better
default value.  Eliminate lambda.  Better default for custom choice.
Put in group `files'.  More descriptive doc string.  Move.
(out-of-memory-warning-percentage, warn-maybe-out-of-memory)
(get-free-disk-space):
* lisp/dired.el (dired-number-of-marked-files):
* lisp/url/url-http.el (url-http-simple-after-change-function)
(url-http-content-length-after-change-function):
Use byte-count-to-string-function.
* test/lisp/files-test.el (files-test-file-size-human-readable):
Test file-size-human-readable-iec.
This commit is contained in:
Mattias Engdegård 2019-07-22 17:10:37 +02:00
parent b49d987a8c
commit 408e75e819
5 changed files with 35 additions and 23 deletions

View file

@ -1025,7 +1025,7 @@ should be shown to the user."
;; Function used when we do NOT know how long the document is going to be
;; Just _very_ simple 'downloaded %d' type of info.
(url-lazy-message "Reading %s..."
(file-size-human-readable (buffer-size) 'iec " ")))
(funcall byte-count-to-string-function (buffer-size))))
(defun url-http-content-length-after-change-function (_st nd _length)
"Function used when we DO know how long the document is going to be.
@ -1038,16 +1038,16 @@ the callback to be triggered."
(url-percentage (- nd url-http-end-of-headers)
url-http-content-length)
url-http-content-type
(file-size-human-readable (- nd url-http-end-of-headers) 'iec " ")
(file-size-human-readable url-http-content-length 'iec " ")
(funcall byte-count-to-string-function (- nd url-http-end-of-headers))
(funcall byte-count-to-string-function url-http-content-length)
(url-percentage (- nd url-http-end-of-headers)
url-http-content-length))
(url-display-percentage
"Reading... %s of %s (%d%%)"
(url-percentage (- nd url-http-end-of-headers)
url-http-content-length)
(file-size-human-readable (- nd url-http-end-of-headers) 'iec " ")
(file-size-human-readable url-http-content-length 'iec " ")
(funcall byte-count-to-string-function (- nd url-http-end-of-headers))
(funcall byte-count-to-string-function url-http-content-length)
(url-percentage (- nd url-http-end-of-headers)
url-http-content-length)))