diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2019-09-21 09:53:18 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2019-09-21 09:53:18 +0200 |
commit | 8f5da5587f41bec80ea32c6c9c670d132c7b6a5e (patch) | |
tree | d68f08147b2326d79930053767782a06d505787b | |
parent | 0dd4b87e61e2d45b958b7afb888a6de5222ed172 (diff) | |
download | emacs-8f5da5587f41bec80ea32c6c9c670d132c7b6a5e.tar.gz |
* lisp/net/tramp.el (tramp-handle-file-modes): Check for nil file-attributes.
-rw-r--r-- | lisp/net/tramp.el | 8 |
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) |