Function: treemacs--human-readable-bytes--inliner

treemacs--human-readable-bytes--inliner is a function defined in treemacs-mode.el.

Signature

(treemacs--human-readable-bytes--inliner INLINE--FORM BYTES)

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-mode.el
;; Closure converted to defun by helpful.
(defun treemacs--human-readable-bytes--inliner
    (inline--form bytes)
  (ignore inline--form)
  (catch 'inline--just-use
    (let*
	((exp bytes)
	 (bytes
	  (if
	      (macroexp-copyable-p exp)
	      exp
	    (make-symbol "bytes")))
	 (body
	  (list 'cl-loop 'with 'result '=
		(list 'cons "B" bytes)
		'for 'i 'in
		(list 'quote
		      (list "k" "M" "G" "T" "P" "E" "Z" "Y"))
		'while
		(list '>=
		      (list 'cdr 'result)
		      1024.0)
		'do
		(list 'setf 'result
		      (list 'cons 'i
			    (list '/
				  (list 'cdr 'result)
				  1024.0)))
		'finally 'return
		(list 'pcase
		      (list 'car 'result)
		      (list "B"
			    (list 'format "%sb" bytes))
		      (list '_
			    (list 'format "%.1f%s"
				  (list 'cdr 'result)
				  (list 'car 'result)))))))
      (if
	  (eq bytes exp)
	  body
	(macroexp-let*
	 (list
	  (list bytes exp))
	 body)))))