From 50bfdd5d78aa015d9032da7e6376665243f3f3b1 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 19 Feb 2014 20:24:32 +0100 Subject: Some Tramp minor fixes, found during test campaign. * net/tramp-adb.el (tramp-adb-file-name-handler-alist) [make-symbolic-link]: Use `tramp-handle-make-symbolic-link'. * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist) [make-symbolic-link]: Use `tramp-handle-make-symbolic-link'. (tramp-gvfs-maybe-open-connection): Set always connection properties, even if target is mounted already. * net/tramp-sh.el (tramp-color-escape-sequence-regexp): Set tramp-autoload cookie. (tramp-get-remote-touch): New defun. (tramp-sh-handle-set-file-times): Use it. (tramp-sh-handle-directory-files-and-attributes): Use `tramp-handle-directory-files-and-attributes' if neither stat nor perl are available on the remote host. * net/tramp-smb.el (tramp-smb-handle-insert-directory): Mark trailing "/". Write long listing only when "l" belongs to the switches. * net/tramp.el (tramp-handle-make-symbolic-link): New defun. (tramp-check-cached-permissions): Call `file-attributes' if the cache is empty. * net/trampver.el: Update release number. --- lisp/net/tramp-smb.el | 67 ++++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 30 deletions(-) (limited to 'lisp/net/tramp-smb.el') diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 97a892f9858..43e2c494ece 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -929,6 +929,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." "Like `insert-directory' for Tramp files." (setq filename (expand-file-name filename)) (unless switches (setq switches "")) + ;; Mark trailing "/". + (when (and (zerop (length (file-name-nondirectory filename))) + (not full-directory-p)) + (setq switches (concat switches "F"))) (if full-directory-p ;; Called from `dired-add-entry'. (setq filename (file-name-as-directory filename)) @@ -991,38 +995,41 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (mapc (lambda (x) (when (not (zerop (length (nth 0 x)))) - (let ((attr - (when (tramp-smb-get-stat-capability v) - (ignore-errors - (file-attributes filename 'string))))) - (insert - (format - "%10s %3d %-8s %-8s %8s %s " - (or (nth 8 attr) (nth 1 x)) ; mode - (or (nth 1 attr) 1) ; inode - (or (nth 2 attr) "nobody") ; uid - (or (nth 3 attr) "nogroup") ; gid - (or (nth 7 attr) (nth 2 x)) ; size - (format-time-string - (if (tramp-time-less-p - (tramp-time-subtract (current-time) (nth 3 x)) - tramp-half-a-year) - "%b %e %R" - "%b %e %Y") - (nth 3 x)))) ; date - ;; We mark the file name. The inserted name could be - ;; from somewhere else, so we use the relative file - ;; name of `default-directory'. - (let ((start (point))) + (when (string-match "l" switches) + (let ((attr + (when (tramp-smb-get-stat-capability v) + (ignore-errors + (file-attributes filename 'string))))) (insert (format - "%s\n" - (file-relative-name - (expand-file-name - (nth 0 x) (file-name-directory filename))))) - (put-text-property start (1- (point)) 'dired-filename t)) - (forward-line) - (beginning-of-line)))) + "%10s %3d %-8s %-8s %8s %s " + (or (nth 8 attr) (nth 1 x)) ; mode + (or (nth 1 attr) 1) ; inode + (or (nth 2 attr) "nobody") ; uid + (or (nth 3 attr) "nogroup") ; gid + (or (nth 7 attr) (nth 2 x)) ; size + (format-time-string + (if (tramp-time-less-p + (tramp-time-subtract (current-time) (nth 3 x)) + tramp-half-a-year) + "%b %e %R" + "%b %e %Y") + (nth 3 x)))))) ; date + + ;; We mark the file name. The inserted name could be + ;; from somewhere else, so we use the relative file name + ;; of `default-directory'. + (let ((start (point))) + (insert + (format + "%s\n" + (file-relative-name + (expand-file-name + (nth 0 x) (file-name-directory filename)) + (when full-directory-p (file-name-directory filename))))) + (put-text-property start (1- (point)) 'dired-filename t)) + (forward-line) + (beginning-of-line))) entries))))) (defun tramp-smb-handle-make-directory (dir &optional parents) -- cgit v1.2.1