summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-imap.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/tramp-imap.el')
-rw-r--r--lisp/net/tramp-imap.el14
1 files changed, 9 insertions, 5 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)