emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/ls-lisp.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/ls-lisp.el [lexbind]
Date: Tue, 14 Oct 2003 19:52:10 -0400

Index: emacs/lisp/ls-lisp.el
diff -c emacs/lisp/ls-lisp.el:1.42.4.1 emacs/lisp/ls-lisp.el:1.42.4.2
*** emacs/lisp/ls-lisp.el:1.42.4.1      Fri Apr  4 01:20:09 2003
--- emacs/lisp/ls-lisp.el       Tue Oct 14 19:51:17 2003
***************
*** 65,70 ****
--- 65,72 ----
  
  ;;; Code:
  
+ (eval-when-compile (require 'cl))
+ 
  (defgroup ls-lisp nil
    "Emulate the ls program completely in Emacs Lisp."
    :version "21.1"
***************
*** 214,219 ****
--- 216,224 ----
        (if handler
          (funcall handler 'insert-directory file switches
                   wildcard full-directory-p)
+       ;; Remove --dired switch
+       (if (string-match "--dired " switches)
+           (setq switches (replace-match "" nil nil switches)))
        ;; Convert SWITCHES to a list of characters.
        (setq switches (delete ?- (append switches nil)))
        (if wildcard
***************
*** 533,539 ****
                        (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)
            " "
--- 538,544 ----
                        (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)
            " "
***************
*** 587,592 ****
--- 592,607 ----
           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)
  
+ ;;; arch-tag: e55f399b-05ec-425c-a6d5-f5e349c35ab4
  ;;; ls-lisp.el ends here




reply via email to

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