From 34c7f14668b8445e0a9bb0de2639481fc3bf6918 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 24 Mar 2022 12:50:34 +0100 Subject: [PATCH] Adapt Tramp to dired--insert-disk-space assumptions * 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) --- lisp/net/tramp-sh.el | 4 +++- lisp/net/tramp-smb.el | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 7a2b884bad3..fd18b3f05c6 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2715,7 +2715,9 @@ The method used must be an out-of-band method." ;; 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") diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 67c63e6ce7a..bbc5499ae72 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1129,7 +1129,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; 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)))) -- 2.39.5