Answers:
这个Emacs Wiki页面建议使用以下代码段来计算所选文件和目录的大小:
(defun dired-get-size ()
(interactive)
(let ((files (dired-get-marked-files)))
(with-temp-buffer
(apply 'call-process "/usr/bin/du" nil t nil "-sch" files)
(message "Size of all marked files: %s"
(progn
(re-search-backward "\\(^[0-9.,]+[A-Za-z]+\\).*total$")
(match-string 1))))))
(define-key dired-mode-map (kbd "?") 'dired-get-size)
如果我对您的理解正确,那么您想直接更新Dired缓冲区的值。我对Dired的内部知识还不太熟悉,但是我想这并不难。