summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-imap.el14
-rw-r--r--lisp/net/tramp-smb.el11
-rw-r--r--lisp/net/tramp.el35
3 files changed, 36 insertions, 24 deletions
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el
index 6f20d527713..60c19c1a43c 100644
--- a/lisp/net/tramp-imap.el
+++ b/lisp/net/tramp-imap.el
@@ -472,14 +472,18 @@ SIZE MODE WEIRD INODE DEVICE)."
(nth 6 x)))) ; date
;; For the file name, we set the `dired-filename'
;; property. This allows to handle file names with
- ;; leading or trailing spaces as well.
+ ;; leading or trailing spaces as well. The inserted name
+ ;; could be from somewhere else, so we use the relative
+ ;; file name of `default-directory'.
(let ((pos (point)))
- (insert (format "%s" (nth 0 x))) ; file name
- (put-text-property pos (point) 'dired-filename t))
- (insert "\n")
+ (insert
+ (format
+ "%s\n"
+ (file-relative-name (expand-file-name (nth 0 x) filename))))
+ (put-text-property pos (1- (point)) 'dired-filename t))
(forward-line)
(beginning-of-line)))
- entries)))))
+ entries)))))
(defun tramp-imap-handle-insert-file-contents
(filename &optional visit beg end replace)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index e9051f0a435..a8c8345c446 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -716,7 +716,7 @@ PRESERVE-UID-GID is completely ignored."
(when (tramp-smb-get-stat-capability v)
(ignore-errors
(file-attributes
- (expand-file-name (nth 0 x)) 'string)))))
+ (expand-file-name (nth 0 x) filename) 'string)))))
(insert
(format
"%10s %3d %-8s %-8s %8s %s "
@@ -732,9 +732,14 @@ PRESERVE-UID-GID is completely ignored."
"%b %e %R"
"%b %e %Y")
(nth 3 x)))) ; date
- ;; We mark the filename.
+ ;; 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" (nth 0 x))) ; file name
+ (insert
+ (format
+ "%s\n"
+ (file-relative-name (expand-file-name (nth 0 x) filename))))
(put-text-property start (1- (point)) 'dired-filename t))
(forward-line)
(beginning-of-line))))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 28a30155a66..a573a75afe2 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4035,9 +4035,11 @@ This is like `dired-recursive-delete-directory' for Tramp files."
(concat file ".z"))
(t nil)))))))))
-(defun tramp-handle-dired-uncache (dir)
+(defun tramp-handle-dired-uncache (dir &optional dir-p)
"Like `dired-uncache' for Tramp files."
- (with-parsed-tramp-file-name dir nil
+ ;; DIR-P is valid for XEmacs only.
+ (with-parsed-tramp-file-name
+ (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
(tramp-flush-file-property v localname)))
;; Pacify byte-compiler. The function is needed on XEmacs only. I'm
@@ -4663,20 +4665,21 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
(defun tramp-handle-file-remote-p (filename &optional identification connected)
"Like `file-remote-p' for Tramp files."
- (when (tramp-tramp-file-p filename)
- (let* ((v (tramp-dissect-file-name filename))
- (p (tramp-get-connection-process v))
- (c (and p (processp p) (memq (process-status p) '(run open)))))
- ;; We expand the file name only, if there is already a connection.
- (with-parsed-tramp-file-name
- (if c (expand-file-name filename) filename) nil
- (and (or (not connected) c)
- (cond
- ((eq identification 'method) method)
- ((eq identification 'user) user)
- ((eq identification 'host) host)
- ((eq identification 'localname) localname)
- (t (tramp-make-tramp-file-name method user host ""))))))))
+ (let ((tramp-verbose 3))
+ (when (tramp-tramp-file-p filename)
+ (let* ((v (tramp-dissect-file-name filename))
+ (p (tramp-get-connection-process v))
+ (c (and p (processp p) (memq (process-status p) '(run open)))))
+ ;; We expand the file name only, if there is already a connection.
+ (with-parsed-tramp-file-name
+ (if c (expand-file-name filename) filename) nil
+ (and (or (not connected) c)
+ (cond
+ ((eq identification 'method) method)
+ ((eq identification 'user) user)
+ ((eq identification 'host) host)
+ ((eq identification 'localname) localname)
+ (t (tramp-make-tramp-file-name method user host "")))))))))
(defun tramp-find-file-name-coding-system-alist (filename tmpname)
"Like `find-operation-coding-system' for Tramp filenames.