]> git.eshelyaron.com Git - emacs.git/commitdiff
find-buffer-visiting: Fix test breakage introduced in b7a737ef49
authorIhor Radchenko <yantar92@posteo.net>
Sat, 30 Dec 2023 10:31:51 +0000 (11:31 +0100)
committerEli Zaretskii <eliz@gnu.org>
Sat, 30 Dec 2023 11:02:05 +0000 (13:02 +0200)
* lisp/files.el (find-buffer-visiting): Fix code branch checking for
buffers referring to the same file number.  We should check the found
buffer with the file number, not current.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66117#412
lisp/files.el

index 315ba831e8cd03db80e9d7fc1456a79105bced9b..78e2bca3cffec08802a41db2885d4d282c15183a 100644 (file)
@@ -2220,15 +2220,17 @@ If there is no such live buffer, return nil."
                 (number (file-attribute-file-identifier attributes)))
            (and buffer-file-numbers-unique
                 (car-safe number)       ;Make sure the inode is not just nil.
-                (let ((buf (find-buffer 'buffer-file-number number)))
-                  (when (and buf (buffer-local-value 'buffer-file-name buf)
+                (let* ((buf (find-buffer 'buffer-file-number number))
+                       (buf-file-name (and buf (buffer-local-value 'buffer-file-name buf))))
+                  (when (and buf-file-name
                              ;; Verify this buffer's file number
                              ;; still belongs to its file.
-                             (file-exists-p buffer-file-name)
-                             (equal (file-attributes buffer-file-truename)
-                                    attributes)
+                             (file-exists-p buf-file-name)
+                             (equal
+                              (file-attributes (buffer-local-value 'buffer-file-truename buf))
+                              attributes)
                              (or (not predicate)
-                                 (funcall predicate (current-buffer))))
+                                 (funcall predicate buf)))
                     buf))))))))
 
 \f