]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix 'locate-dominating-file' when FILE is not a directory.
authordalanicolai <dalanicolai@gmail.com>
Sat, 21 Oct 2023 15:39:17 +0000 (17:39 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 25 Oct 2023 13:12:24 +0000 (16:12 +0300)
* lisp/files.el (locate-dominating-file): Handle FILE that is not
a directory.  (Bug#66542)

lisp/files.el

index 1be5b374ae84e54baae00584aefec59a5869ada6..3d838cd3b8c0665ebd29b6d38f65c28004b9f93f 100644 (file)
@@ -1135,9 +1135,11 @@ the function needs to examine, starting with FILE."
     (while (not (or root
                     (null file)
                     (string-match locate-dominating-stop-dir-regexp file)))
-      (setq try (if (stringp name)
-                    (and (file-directory-p file)
-                         (file-exists-p (expand-file-name name file)))
+      (setq file (if (file-directory-p file)
+                     file
+                   (file-name-directory file))
+            try (if (stringp name)
+                    (file-exists-p (expand-file-name name file))
                   (funcall name file)))
       (cond (try (setq root file))
             ((equal file (setq file (file-name-directory