aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus <[email protected]>2012-03-01 09:33:50 +0100
committerMichael Albinus <[email protected]>2012-03-01 09:33:50 +0100
commita032a70212f82e2d7d1e8ca056508a16f4fd5c3e (patch)
treeabff4d2019ae23b2cfc923c92a35f5c4181af31c
parent7272fbf3f6f302af3a8762764b17d6a25104f999 (diff)
* files.el (file-equal-p): Fix docstring. Avoid unnecessary
access of FILE2, if FILE1 does not exist.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el11
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8df640a3c9..a320976a74 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-01 Michael Albinus <[email protected]>
+
+ * files.el (file-equal-p): Fix docstring. Avoid unnecessary
+ access of FILE2, if FILE1 does not exist.
+
2012-03-01 Michael R. Mauger <[email protected]>
* progmodes/sql.el: Bug fix
diff --git a/lisp/files.el b/lisp/files.el
index 0d687a157f..88ebb9eaab 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4986,15 +4986,16 @@ given. With a prefix argument, TRASH is nil."
(delete-directory-internal directory)))))
(defun file-equal-p (file1 file2)
- "Return non-nil if existing files FILE1 and FILE2 name the same file.
-Return nil if one or both files doesn't exists."
+ "Return non-nil if files FILE1 and FILE2 name the same file.
+If FILE1 or FILE2 does not exist, the return value is unspecified."
(let ((handler (or (find-file-name-handler file1 'file-equal-p)
(find-file-name-handler file2 'file-equal-p))))
(if handler
(funcall handler 'file-equal-p file1 file2)
- (let ((f1-attr (file-attributes (file-truename file1)))
- (f2-attr (file-attributes (file-truename file2))))
- (and f1-attr f2-attr (equal f1-attr f2-attr))))))
+ (let (f1-attr f2-attr)
+ (and (setq f1-attr (file-attributes (file-truename file1)))
+ (setq f2-attr (file-attributes (file-truename file2)))
+ (equal f1-attr f2-attr))))))
(defun file-subdir-of-p (dir1 dir2)
"Return non-nil if DIR1 is a subdirectory of DIR2.