* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory):
Do not modify disk space information when
`dired--insert-disk-space' is available. (Bug#54512)
;; Try to insert the amount of free space.
(goto-char (point-min))
;; First find the line to put it on.
- (when (re-search-forward "^\\([[:space:]]*total\\)" nil t)
+ (when (and (re-search-forward "^\\([[:space:]]*total\\)" nil t)
+ ;; Emacs 29.1 or later.
+ (not (fboundp 'dired--insert-disk-space)))
(when-let ((available (get-free-disk-space ".")))
;; Replace "total" with "total used", to avoid confusion.
(replace-match "\\1 used in directory")
;; Insert size information.
(when full-directory-p
(insert
- (if avail
+ (if (and avail
+ ;; Emacs 29.1 or later.
+ (not (fboundp 'dired--insert-disk-space)))
(format "total used in directory %s available %s\n" used avail)
(format "total %s\n" used))))