/[emacs]/emacs/lisp/ls-lisp.el
ViewVC logotype

Diff of /emacs/lisp/ls-lisp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.48 by rost, Mon Jan 20 05:44:47 2003 UTC revision 1.49 by lektu, Thu May 1 11:16:21 2003 UTC
# Line 65  Line 65 
65    
66  ;;; Code:  ;;; Code:
67    
68    (eval-when-compile (require 'cl))
69    
70  (defgroup ls-lisp nil  (defgroup ls-lisp nil
71    "Emulate the ls program completely in Emacs Lisp."    "Emulate the ls program completely in Emacs Lisp."
72    :version "21.1"    :version "21.1"
# Line 533  SWITCHES, TIME-INDEX and NOW give the fu Line 535  SWITCHES, TIME-INDEX and NOW give the fu
535                          (if group                          (if group
536                              (format " %-8s" group)                              (format " %-8s" group)
537                            (format " %-8d" gid))))))                            (format " %-8d" gid))))))
538              (format (if (floatp file-size) " %8.0f" " %8d") file-size)              (ls-lisp-format-file-size file-size (memq ?h switches))
539              " "              " "
540              (ls-lisp-format-time file-attr time-index now)              (ls-lisp-format-time file-attr time-index now)
541              " "              " "
# Line 587  All ls time options, namely c, t and u, Line 589  All ls time options, namely c, t and u,
589             time))             time))
590        (error "Unk  0  0000"))))        (error "Unk  0  0000"))))
591    
592    (defun ls-lisp-format-file-size (file-size human-readable)
593      (if (or (not human-readable)
594              (< file-size 1024))
595          (format (if (floatp file-size) " %8.0f" " %8d") file-size)
596        (do ((file-size (/ file-size 1024.0) (/ file-size 1024.0))
597             ;; kilo, mega, giga, tera, peta, exa
598             (post-fixes (list "k" "M" "G" "T" "P" "E") (cdr post-fixes)))
599            ((< file-size 1024) (format " %7.0f%s"  file-size (car post-fixes))))))
600    
601  (provide 'ls-lisp)  (provide 'ls-lisp)
602    
603  ;;; ls-lisp.el ends here  ;;; ls-lisp.el ends here

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26