[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch: Enable -h switch in ls-lisp.el
From: |
Eduardo Muñoz |
Subject: |
Patch: Enable -h switch in ls-lisp.el |
Date: |
29 Apr 2003 00:08:27 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
I patched ls-lisp.el as follows. Maybe it will be usefull.
$ diff -c ls-lisp.1.42.4.1.el ls-lisp.new.el
*** ls-lisp.1.42.4.1.el Mon Apr 28 23:51:13 2003
--- ls-lisp.new.el Mon Apr 28 23:53:37 2003
***************
*** 497,503 ****
(if group
(format " %-8s" group)
(format " %-8d" gid))))))
! (format (if (floatp file-size) " %8.0f" " %8d") file-size)
" "
(ls-lisp-format-time file-attr time-index now)
" "
--- 497,503 ----
(if group
(format " %-8s" group)
(format " %-8d" gid))))))
! (ls-lisp-format-file-size file-size (memq ?h switches))
" "
(ls-lisp-format-time file-attr time-index now)
" "
***************
*** 537,542 ****
--- 537,551 ----
time)
(error "Unk 0 0000"))))
+ (defun ls-lisp-format-file-size (file-size human-readable)
+ (if (or (not human-readable)
+ (< file-size 1024))
+ (format (if (floatp file-size) " %8.0f" " %8d") file-size)
+ (do ((file-size (/ file-size 1024.0) (/ file-size 1024.0))
+ ;; kilo, mega, giga, tera, peta, exa
+ (post-fixes (list "k" "M" "G" "T" "P" "E") (cdr post-fixes)))
+ ((< file-size 1024) (format " %7.0f%s" file-size (car
post-fixes))))))
+
(provide 'ls-lisp)
;;; ls-lisp.el ends here
--
Eduardo Muñoz | (prog () 10 (print "Hello world!")
http://213.97.131.125/ | 20 (go 10))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Patch: Enable -h switch in ls-lisp.el,
Eduardo Muñoz <=