By Xah Lee. Date: .
how to get dired to display file size with seperators e.g. 123,456,789.
(defun jacob-format-filesize-with-seperator (input seperator)
(letrec ((digits (split-string input "" t))
(go (lambda (l c nl)
(if (null l)
nl
(funcall
go (cdr l) (+ c 1)
(cons (car l)
(cons (if (and (= (% c 3) 0)
(not (null nl)))
(if (string-equal " " (car l))
" "
seperator))
nl)))))))
(mapconcat 'identity
(funcall go (reverse digits) 0 nil)
"")))
(defun ls-lisp-format-file-size (file-size human-readable)
(if (not human-readable)
(format " %s"
(jacob-format-filesize-with-seperator
(format (if (floatp file-size)
ls-lisp-filesize-f-fmt
ls-lisp-filesize-d-fmt)
file-size)
","))
(format " %6s" (file-size-human-readable file-size))))
(defun ls-lisp-format-file-size (file-size human-readable)
(if (not human-readable)
(format (if (floatp file-size)
ls-lisp-filesize-f-fmt
ls-lisp-filesize-d-fmt)
file-size)
(format " %6s" (file-size-human-readable file-size))))