bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: npostavs
Subject: bug#16406: load prefers directories rather than searching load-path
Date: Sat, 03 Sep 2016 12:43:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

npostavs@users.sourceforge.net writes:

>
> Seems simple enough to fix, here is a patch (this also covers #17848
> "add suffix search to -l even when directory part in argument"):

That one broke normal loading.  Here's a new patch.

>From 38e48fb4bc3b6f949659d528fcaaa78d903be1db Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 21 Aug 2016 10:51:38 -0400
Subject: [PATCH v2] Improvements to --load argument handling

* lisp/startup.el (command-line-1): Search for files with load-suffixes
in default dir (Bug #17848).  Only pass normal files that were found,
since `load' doesn't handle directories (Bug #16406).
---
 lisp/startup.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index fcdc376..01e6d85 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2392,8 +2392,11 @@ command-line-1
                                    (or argval (pop command-line-args-left))))
                             ;; 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)
+                            (file-ex (locate-file
+                                      file (list default-directory)
+                                      (append (get-load-suffixes)
+                                              load-file-rep-suffixes))))
+                       (when (and file-ex (file-regular-p file-ex))
                          (setq file file-ex))
                        (load file nil t)))
 
-- 
2.9.3


reply via email to

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