summaryrefslogtreecommitdiff
path: root/lisp/net/tramp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r--lisp/net/tramp.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b044762b70d..b17e4a787cc 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3152,10 +3152,10 @@ User is always nil."
(defun tramp-handle-file-modes (filename)
"Like `file-modes' for Tramp files."
- (let ((truename (or (file-truename filename) filename)))
- (when (file-exists-p truename)
- (tramp-mode-string-to-int
- (tramp-compat-file-attribute-modes (file-attributes truename))))))
+ ;; Starting with Emacs 25.1, `when-let' can be used.
+ (let ((attrs (file-attributes (or (file-truename filename) filename))))
+ (when attrs
+ (tramp-mode-string-to-int (tramp-compat-file-attribute-modes attrs)))))
;; Localname manipulation functions that grok Tramp localnames...
(defun tramp-handle-file-name-as-directory (file)