emacs-devel
[Top][All Lists]
Advanced

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

File size column width in dired


From: Slawomir Nowaczyk
Subject: File size column width in dired
Date: Tue, 08 Nov 2005 13:05:34 +0100

Hello,

I was wondering if the following patch could be applied... I routinely
work with directories where files >100MB exist, and currently
filenames in dired buffer are misaligned in such cases. My patch
reserves one more character for file size.

I do not know if it would make sense to make it even bigger (files
larger than 1GB definitely exist, but I do not know how common they
are) or to provide this as user option.

*** c:/Emacs/lisp/ls-lisp.el    Mon Oct 31 16:29:45 2005
--- c:/temp/buffer-content-960sNJ       Tue Nov  8 13:00:45 2005
***************
*** 588,598 ****
  (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)
  
--- 588,598 ----
  (defun ls-lisp-format-file-size (file-size human-readable)
    (if (or (not human-readable)
            (< file-size 1024))
!       (format (if (floatp file-size) " %9.0f" " %9d") 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 " %8.0f%s"  file-size (car 
post-fixes))))))
  
  (provide 'ls-lisp)

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( address@hidden )

Duct tape is like the force:
it has a light side and a dark side, and it holds the universe together.





reply via email to

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