[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8f5da55: * lisp/net/tramp.el (tramp-handle-file-mod

From: Michael Albinus
Subject: [Emacs-diffs] master 8f5da55: * lisp/net/tramp.el (tramp-handle-file-modes): Check for nil file-attributes.
Date: Sat, 21 Sep 2019 03:53:26 -0400 (EDT)

branch: master
commit 8f5da5587f41bec80ea32c6c9c670d132c7b6a5e
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    * lisp/net/tramp.el (tramp-handle-file-modes): Check for nil 
 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 b044762..b17e4a7 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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]