From 8f5da5587f41bec80ea32c6c9c670d132c7b6a5e Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 21 Sep 2019 09:53:18 +0200 Subject: * lisp/net/tramp.el (tramp-handle-file-modes): Check for nil file-attributes. --- lisp/net/tramp.el | 8 ++++---- 1 file 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) -- cgit v1.2.1