emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master fd54102: * lisp/files.el (file-size-function):


From: Basil L. Contovounesios
Subject: Re: [Emacs-diffs] master fd54102: * lisp/files.el (file-size-function): New defcustom
Date: Sat, 20 Jul 2019 17:53:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

address@hidden (Oleh Krehel) writes:

> branch: master
> commit fd5410217ff23810edc16e97c10934ad622f8e4b
> Author: Oleh Krehel <address@hidden>
> Commit: Oleh Krehel <address@hidden>
>
>     * lisp/files.el (file-size-function): New defcustom

[I wish changes like this (and its recent predecessors, which caused
 test failues that others had to fix), even if small, to central
 user-facing features were instead discussed and tested a little before
 being unilaterally pushed.]

> ---
>  etc/NEWS      |  1 +
>  lisp/files.el | 10 +++++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index c875fc6..5cbe60c 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -400,6 +400,7 @@ mode they are described in the manual "(emacs) Display".
>  ---
>  ** New variable 'xref-file-name-display' controls the display of file
>  names in xref buffers.
> +** New variable `file-size-function' controls how file sizes are displayed

Which file sizes?

>  
>  * Editing Changes in Emacs 27.1
> diff --git a/lisp/files.el b/lisp/files.el
> index 238aa37..e26b482 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -6696,13 +6696,21 @@ This variable is obsolete; Emacs no longer uses it."
>                       "ignored, as Emacs uses `file-system-info' instead"
>                       "27.1")
>  
> +(defcustom file-size-function #'file-size-human-readable
> +  "Function that transforms the number of bytes into a human-readable 
> string."

The number of which bytes?  I think a phrase similar to "for display"
would be more accurate than "human-readable" here.

> +  :type '(choice

Did you try radio+function-item instead of choice+const?  I usually find
the former nicer, as recommended in (info "(elisp) Composite Types").

> +          (const :tag "default" file-size-human-readable)
> +          (const :tag "iec"

Nit: Please capitalise and uppercase these tags, respectively.

> +           (lambda (size) (file-size-human-readable size 'iec " ")))

Please do not use an unevaluated anonymous function here.

> +          (function :tag "Custom function")))
>
>  (defun get-free-disk-space (dir)
>    "String describing the amount of free space on DIR's file system.
>  If DIR's free space cannot be obtained, this function returns nil."
>    (save-match-data
>      (let ((avail (nth 2 (file-system-info dir))))
>        (if avail
> -          (file-size-human-readable avail 'iec " ")))))
> +          (funcall file-size-function avail)))))
>  
>  ;; The following expression replaces `dired-move-to-filename-regexp'.
>  (defvar directory-listing-before-filename-regexp

Thanks for working on this,

-- 
Basil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]