emacs-devel
[Top][All Lists]
Advanced

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

Re: master 2b97e83cc1 2/2: Fix off-by-one file size formatting in ls-lis


From: Eli Zaretskii
Subject: Re: master 2b97e83cc1 2/2: Fix off-by-one file size formatting in ls-lisp
Date: Mon, 14 Feb 2022 14:19:03 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: salutis@me.com,  monnier@iro.umontreal.ca,  emacs-devel@gnu.org
> Date: Mon, 14 Feb 2022 11:48:42 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > So how about the patch below:
> >
> > diff --git a/lisp/files.el b/lisp/files.el
> > index cfa1a59..7e62726 100644
> > --- a/lisp/files.el
> > +++ b/lisp/files.el
> > @@ -1494,7 +1494,8 @@ file-size-human-readable
> >                                 (or unit "B"))
> >                              (concat prefix unit))))
> >        (format (if (and (>= (mod file-size 1.0) 0.05)
> > -                       (< (mod file-size 1.0) 0.95))
> > +                       (< (mod file-size 1.0) 0.95)
> > +                       (< file-size 10))
> 
> Possibly, but it's hard to tell...  perhaps a better test is whether the
> printed representation is longer than 6 characters, and then precision
> should be reduced.

I thought we wanted to mimic what GNU 'ls' does?  AFAICT, it shows the
fractional part only for values whose integral part is less than 10,
i.e. takes just one digit.  So that's what the above change does.

If you run "ls -lh" on a large directory, do you see something
different from my description above?



reply via email to

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