[Top][All Lists]

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

bug#17848: #17848 add suffix search to -l even when directory part in ar

From: npostavs
Subject: bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...)
Date: Sun, 04 Sep 2016 18:06:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

tags 17848 patch

Eli Zaretskii <address@hidden> writes:
> Instead of doing the search by hand, wouldn't it be better to teach
> 'load' to ignore directories?
>  But I don't understand why using locate-file here is a good idea.

So now in the context of *this* bug, I think `locate-file' is needed.
The current directory needs to be searched for suffixed versions, but we
can't let `load' do that without adding "." to `load-path'.

>From b14d2df532f637fe9fe21a50a8a6066a40720c8b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Sun, 4 Sep 2016 17:57:56 -0400
Subject: [PATCH v1] Add suffix search to --load dir/foo

* lisp/startup.el (command-line-1): Search for files with load-suffixes
in default directory (Bug #17848).
 lisp/startup.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index d5225bd..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-regular-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)))

reply via email to

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