]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt Tramp to dired--insert-disk-space assumptions
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 24 Mar 2022 11:50:34 +0000 (12:50 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 24 Mar 2022 11:50:34 +0000 (12:50 +0100)
* 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
lisp/net/tramp-smb.el

index 7a2b884bad31c663aad5a5b6e4386d3715138df0..fd18b3f05c6b7cfaaeb2c5f003520e26bc56812d 100644 (file)
@@ -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")
index 67c63e6ce7a695cbefc70d5a79484cc3a70fbd8b..bbc5499ae7281a73c421f0458e717f37cdbf6cb8 100644 (file)
@@ -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))))