Subject: bug#16406: load prefers directories rather than searching load-path

From: [email-masked]
Date: Sat, 03 Sep 2016 15:12:49 -0400

Eli Zaretskii <[email-masked]> writes:

>> 
>> Hmm, I seem to have confused things by trying to combine the fix for
>> 16406 and 17848.  Just replacing the file-exists-p test, as in the patch
>> below, is enough to fix this bug.  Let's look at 17848 separately.
>> 
>>                              (file-ex (expand-file-name file)))
>> -                       (when (file-exists-p file-ex)
>> +                       (when (and file-ex (file-regular-p file-ex))
>
> OK.  But isn't the "and file-ex" test unnecessary?  It wasn't required
> for file-exists-p, so why is it for file-regular-p?

Indeed, not required. It's just leftover confusion.

>From 72ac37f50068af39aebc200b812cb901e0dcd176 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Sun, 21 Aug 2016 10:51:38 -0400
Subject: [PATCH v4] Don't --load directories

* lisp/startup.el (command-line-1): Only pass expanded FILENAME argument
of --load when it refers to a normal file, since `load' doesn't handle
directories (Bug #16406).
---
 lisp/startup.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index fcdc376..d5225bd 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2393,7 +2393,7 @@ command-line-1
                             ;; Take file from default dir if it exists there;
                             ;; otherwise let `load' search for it.
                             (file-ex (expand-file-name file)))
-                       (when (file-exists-p file-ex)
+                       (when (file-regular-p file-ex)
                          (setq file file-ex))
                        (load file nil t)))
 
-- 
2.9.3