Function: dired-number-of-marked-files
dired-number-of-marked-files is an interactive and byte-compiled
function defined in dired.el.gz.
Signature
(dired-number-of-marked-files)
Documentation
Display the number and total size of the marked files.
Probably introduced at or before Emacs version 27.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-number-of-marked-files ()
"Display the number and total size of the marked files."
(interactive nil dired-mode)
(let* ((files (dired-get-marked-files nil nil nil t))
(nmarked
(cond ((null (cdr files))
0)
((and (= (length files) 2)
(eq (car files) t))
1)
(t
(length files))))
(size (cl-loop for file in files
when (stringp file)
sum (file-attribute-size (file-attributes file)))))
(if (zerop nmarked)
(message "No marked files")
(message "%d marked file%s (%s total size)"
nmarked
(if (= nmarked 1)
""
"s")
(funcall byte-count-to-string-function size)))))