emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107472: * files.el (file-equal-p): F


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107472: * files.el (file-equal-p): Fix docstring. Avoid unnecessary
Date: Thu, 01 Mar 2012 09:33:50 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107472
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Thu 2012-03-01 09:33:50 +0100
message:
  * files.el (file-equal-p): Fix docstring.  Avoid unnecessary
  access of FILE2, if FILE1 does not exist.
modified:
  lisp/ChangeLog
  lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-01 05:01:22 +0000
+++ b/lisp/ChangeLog    2012-03-01 08:33:50 +0000
@@ -1,3 +1,8 @@
+2012-03-01  Michael Albinus  <address@hidden>
+
+       * files.el (file-equal-p): Fix docstring.  Avoid unnecessary
+       access of FILE2, if FILE1 does not exist.
+
 2012-03-01  Michael R. Mauger  <address@hidden>
 
        * progmodes/sql.el: Bug fix

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2012-02-28 09:28:52 +0000
+++ b/lisp/files.el     2012-03-01 08:33:50 +0000
@@ -4986,15 +4986,16 @@
       (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.


reply via email to

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