You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
478 B
EmacsLisp
17 lines
478 B
EmacsLisp
2 years ago
|
(define-ibuffer-column size-human-readable
|
||
|
(:name "Size" :inline t)
|
||
|
(let ((size (buffer-size)))
|
||
|
(cond
|
||
|
((> size (expt 1000 4))
|
||
|
(error "buffer is over 1TB large!"))
|
||
|
((> size (expt 1000 3))
|
||
|
(format "%sG" (/ size (expt 1000 3))))
|
||
|
((> size (expt 1000 2))
|
||
|
(format "%sM" (/ size (expt 1000 2))))
|
||
|
((> size 1000)
|
||
|
(format "%sK" (/ size 1000)))
|
||
|
(t
|
||
|
(format "%sB" size)))))
|
||
|
|
||
|
(provide 'config-ibuffer-human-readable-size)
|