emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103874: Produce more accurate result


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103874: Produce more accurate results from file-size-human-readable.
Date: Sat, 09 Apr 2011 09:59:26 +0300
User-agent: Bazaar (2.1.2)

------------------------------------------------------------
revno: 103874
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2011-04-09 09:59:26 +0300
message:
  Produce more accurate results from file-size-human-readable.
  
   lisp/files.el (file-size-human-readable): Produce one digit after
   decimal, like "ls -lh" does.
   lisp/ls-lisp.el (ls-lisp-format-file-size): Allow for 7 characters in
   the file size representation.
modified:
  lisp/ChangeLog
  lisp/files.el
  lisp/ls-lisp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-08 20:09:19 +0000
+++ b/lisp/ChangeLog    2011-04-09 06:59:26 +0000
@@ -12,6 +12,12 @@
 
 2011-04-08  Eli Zaretskii  <address@hidden>
 
+       * files.el (file-size-human-readable): Produce one digit after
+       decimal, like "ls -lh" does.
+
+       * ls-lisp.el (ls-lisp-format-file-size): Allow for 7 characters in
+       the file size representation.
+
        * simple.el (list-processes): If async subprocesses are not
        available, error out with a clear error message.
 

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2011-04-08 15:31:33 +0000
+++ b/lisp/files.el     2011-04-09 06:59:26 +0000
@@ -1162,7 +1162,10 @@
     (while (and (>= file-size power) (cdr post-fixes))
       (setq file-size (/ file-size power)
            post-fixes (cdr post-fixes)))
-    (format "%.0f%s%s" file-size
+    (format (if (> (mod file-size 1.0) 0.05)
+               "%.1f%s%s"
+             "%.0f%s%s")
+           file-size
            (if (and (eq flavor 'iec) (string= (car post-fixes) "k"))
                "K"
              (car post-fixes))

=== modified file 'lisp/ls-lisp.el'
--- a/lisp/ls-lisp.el   2011-04-08 15:31:33 +0000
+++ b/lisp/ls-lisp.el   2011-04-09 06:59:26 +0000
@@ -724,7 +724,7 @@
                  ls-lisp-filesize-f-fmt
                ls-lisp-filesize-d-fmt)
              file-size)
-    (format " %4s" (file-size-human-readable file-size))))
+    (format " %7s" (file-size-human-readable file-size))))
 
 (provide 'ls-lisp)
 


reply via email to

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