From: Michael Albinus Date: Sat, 21 Sep 2019 07:53:18 +0000 (+0200) Subject: * lisp/net/tramp.el (tramp-handle-file-modes): Check for nil file-attributes. X-Git-Tag: emacs-27.0.90~1518 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8f5da5587f41bec80ea32c6c9c670d132c7b6a5e;p=emacs.git * lisp/net/tramp.el (tramp-handle-file-modes): Check for nil file-attributes. --- 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)