From: Michael Albinus Date: Fri, 3 Dec 2021 13:24:43 +0000 (+0100) Subject: Adapt directory summary line handling in Tramp X-Git-Tag: emacs-29.0.90~3619^2~41 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=76099240119d0137f25b356d64e2c1b70201973e;p=emacs.git Adapt directory summary line handling in Tramp * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): * lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory): Do not add or modify summary line when `dired-free-space' is bound. --- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b83569f3ded..780c3b39413 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2678,15 +2678,17 @@ The method used must be an out-of-band method." (point-min) 'noerror) (replace-match (file-relative-name filename) t)) - ;; 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-let ((available (get-free-disk-space "."))) - ;; Replace "total" with "total used", to avoid confusion. - (replace-match "\\1 used in directory") - (end-of-line) - (insert " available " available)))) + ;; Try to insert the amount of free space. This is moved to + ;; `dired-insert-directory' in Emacs 29.1. + (unless (boundp 'dired-free-space) + (goto-char (point-min)) + ;; First find the line to put it on. + (when (re-search-forward "^\\([[:space:]]*total\\)" nil t) + (when-let ((available (get-free-disk-space "."))) + ;; Replace "total" with "total used", to avoid confusion. + (replace-match "\\1 used in directory") + (end-of-line) + (insert " available " available))))) (prog1 (goto-char end-marker) (set-marker beg-marker nil) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 24119539db0..0a7d1efc8b8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1120,12 +1120,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (setcar x (concat (car x) "*")))))) entries)) - ;; Insert size information. - (when full-directory-p - (insert - (if avail - (format "total used in directory %s available %s\n" used avail) - (format "total %s\n" used)))) + ;; Insert size information. This is moved to + ;; `dired-insert-directory' in Emacs 29.1. + (unless (boundp 'dired-free-space) + (when full-directory-p + (insert + (if avail + (format "total used in directory %s available %s\n" used avail) + (format "total %s\n" used))))) ;; Print entries. (mapc