unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16406: load prefers directories rather than searching load-path
@ 2014-01-10  5:23 Glenn Morris
  2014-01-10 14:46 ` Stefan Monnier
  2016-08-21 16:35 ` npostavs
  0 siblings, 2 replies; 15+ messages in thread
From: Glenn Morris @ 2014-01-10  5:23 UTC (permalink / raw)
  To: 16406

Package: emacs
Version: 24.3

From the Emacs source directory, wanting to load the standard info.el library:

./src/emacs -Q -l info

  Cannot open load file: is a directory, /tmp/emacs/trunk/info

It seems dumb for load prefer a directory.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2014-01-10  5:23 bug#16406: load prefers directories rather than searching load-path Glenn Morris
@ 2014-01-10 14:46 ` Stefan Monnier
  2016-08-21 16:35 ` npostavs
  1 sibling, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2014-01-10 14:46 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16406

> It seems dumb for load prefer a directory.

You have just insulted Emacs.  Pay $50 to each player.


        Stefan "sorry, too much Monopoly lately"





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2014-01-10  5:23 bug#16406: load prefers directories rather than searching load-path Glenn Morris
  2014-01-10 14:46 ` Stefan Monnier
@ 2016-08-21 16:35 ` npostavs
  2016-09-03 16:43   ` npostavs
  1 sibling, 1 reply; 15+ messages in thread
From: npostavs @ 2016-08-21 16:35 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16406

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

tags 16406 patch
quit

Glenn Morris <rgm@gnu.org> writes:

> Package: emacs
> Version: 24.3
>
> From the Emacs source directory, wanting to load the standard info.el library:
>
> ./src/emacs -Q -l info
>
>   Cannot open load file: is a directory, /tmp/emacs/trunk/info
>
> It seems dumb for load prefer a directory.

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


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1314 bytes --]

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

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

diff --git a/lisp/startup.el b/lisp/startup.el
index fcdc376..9134604 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2392,8 +2392,9 @@ 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)
+                                                  load-suffixes)))
+                       (when (and file-ex (file-regular-p file-ex))
                          (setq file file-ex))
                        (load file nil t)))
 
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-08-21 16:35 ` npostavs
@ 2016-09-03 16:43   ` npostavs
  2016-09-03 17:32     ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: npostavs @ 2016-09-03 16:43 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16406

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

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.


[-- Attachment #2: patch v2 --]
[-- Type: text/plain, Size: 1429 bytes --]

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-09-03 16:43   ` npostavs
@ 2016-09-03 17:32     ` Eli Zaretskii
  2016-09-03 18:43       ` npostavs
  2016-09-04 22:06       ` bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...) npostavs
  0 siblings, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2016-09-03 17:32 UTC (permalink / raw)
  To: npostavs; +Cc: 16406

> From: npostavs@users.sourceforge.net
> Date: Sat, 03 Sep 2016 12:43:29 -0400
> Cc: 16406@debbugs.gnu.org
> 
> > 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.

Instead of doing the search by hand, wouldn't it be better to teach
'load' to ignore directories?  Or do we have a use case where finding
a directory in 'load' would make sense?

IOW, isn't "'load' prefers directories" the actual problem we should
fix, rather than only fixing the startup problem?

I do agree that the file-exists-p test in command-line-1 should be
replaced with a test that doesn't let directories through.  But I
don't understand why using locate-file here is a good idea.

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-09-03 17:32     ` Eli Zaretskii
@ 2016-09-03 18:43       ` npostavs
  2016-09-03 19:00         ` Eli Zaretskii
  2016-09-04 22:06       ` bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...) npostavs
  1 sibling, 1 reply; 15+ messages in thread
From: npostavs @ 2016-09-03 18:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16406

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: npostavs@users.sourceforge.net
>> Date: Sat, 03 Sep 2016 12:43:29 -0400
>> Cc: 16406@debbugs.gnu.org
>> 
>> > 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.
>
> Instead of doing the search by hand, wouldn't it be better to teach
> 'load' to ignore directories?  Or do we have a use case where finding
> a directory in 'load' would make sense?
>
> IOW, isn't "'load' prefers directories" the actual problem we should
> fix, rather than only fixing the startup problem?
>
> I do agree that the file-exists-p test in command-line-1 should be
> replaced with a test that doesn't let directories through.  But I
> don't understand why using locate-file here is a good idea.

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.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1039 bytes --]

From ba8ddc2e039fe982bdfa46519c003808be9ddff3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 21 Aug 2016 10:51:38 -0400
Subject: [PATCH v3] 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..45beefb 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 (and file-ex (file-regular-p file-ex))
                          (setq file file-ex))
                        (load file nil t)))
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-09-03 18:43       ` npostavs
@ 2016-09-03 19:00         ` Eli Zaretskii
  2016-09-03 19:12           ` npostavs
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-09-03 19:00 UTC (permalink / raw)
  To: npostavs; +Cc: 16406

> From: npostavs@users.sourceforge.net
> Cc: 16406@debbugs.gnu.org,  rgm@gnu.org
> Date: Sat, 03 Sep 2016 14:43:53 -0400
> 
> > I do agree that the file-exists-p test in command-line-1 should be
> > replaced with a test that doesn't let directories through.  But I
> > don't understand why using locate-file here is a good idea.
> 
> 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.
> 
> >From ba8ddc2e039fe982bdfa46519c003808be9ddff3 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Sun, 21 Aug 2016 10:51:38 -0400
> Subject: [PATCH v3] 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..45beefb 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 (and file-ex (file-regular-p file-ex))
>                           (setq file file-ex))
>                         (load file nil t)))

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?

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-09-03 19:00         ` Eli Zaretskii
@ 2016-09-03 19:12           ` npostavs
  2016-09-03 19:27             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: npostavs @ 2016-09-03 19:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16406

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

Eli Zaretskii <eliz@gnu.org> 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.


[-- Attachment #2: patch v4 --]
[-- Type: text/plain, Size: 1025 bytes --]

From 72ac37f50068af39aebc200b812cb901e0dcd176 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-09-03 19:12           ` npostavs
@ 2016-09-03 19:27             ` Eli Zaretskii
  2016-09-07 23:27               ` npostavs
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-09-03 19:27 UTC (permalink / raw)
  To: npostavs; +Cc: 16406

> From: npostavs@users.sourceforge.net
> Cc: 16406@debbugs.gnu.org,  rgm@gnu.org
> Date: Sat, 03 Sep 2016 15:12:49 -0400
> 
> > 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 <npostavs@gmail.com>
> 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

Thanks, LGTM.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...)
  2016-09-03 17:32     ` Eli Zaretskii
  2016-09-03 18:43       ` npostavs
@ 2016-09-04 22:06       ` npostavs
  2016-09-05 15:07         ` Eli Zaretskii
  1 sibling, 1 reply; 15+ messages in thread
From: npostavs @ 2016-09-04 22:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 17848

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

tags 17848 patch
quit

Eli Zaretskii <eliz@gnu.org> 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'.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1335 bytes --]

From b14d2df532f637fe9fe21a50a8a6066a40720c8b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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)))
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...)
  2016-09-04 22:06       ` bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...) npostavs
@ 2016-09-05 15:07         ` Eli Zaretskii
  2016-09-05 22:59           ` bug#17848: #17848 add suffix search to -l even when directory part in argument npostavs
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-09-05 15:07 UTC (permalink / raw)
  To: npostavs; +Cc: 17848

> From: npostavs@users.sourceforge.net
> Cc: 17848@debbugs.gnu.org,  rgm@gnu.org
> Date: Sun, 04 Sep 2016 18:06:52 -0400
> 
> 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'.

I'm not sure.  Wouldn't adding the leading directory to load-path in a
let-binding be a cleaner solution?  IOW, I don't understand the reason
for the "Take file from default dir if it exists there" logic in the
first place -- what are we gaining there?

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#17848: #17848 add suffix search to -l even when directory part in argument
  2016-09-05 15:07         ` Eli Zaretskii
@ 2016-09-05 22:59           ` npostavs
  2016-09-06 15:05             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: npostavs @ 2016-09-05 22:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 17848

Eli Zaretskii <eliz@gnu.org> writes:

>> From: npostavs@users.sourceforge.net
>> Cc: 17848@debbugs.gnu.org,  rgm@gnu.org
>> Date: Sun, 04 Sep 2016 18:06:52 -0400
>> 
>> 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'.
>
> I'm not sure.  Wouldn't adding the leading directory to load-path in a
> let-binding be a cleaner solution?  IOW, I don't understand the reason
> for the "Take file from default dir if it exists there" logic in the
> first place -- what are we gaining there?

If we let-bind `load-path', then this could influence the code that
we're loading.  For more context, I came to this bug from
test/Makefile.in:

    ## We need to use $loadfile because:
    ## i) -L :$srcdir -l basename does not work, because we have files whose
    ## basename duplicates a file in lisp/ (eg eshell.el).
    ## ii) Although -l basename will automatically load .el or .elc,
    ## -l ./basename treats basename as a literal file (it would be nice
    ## to change this; bug#17848 - if that gets done, this can be simplified).






^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#17848: #17848 add suffix search to -l even when directory part in argument
  2016-09-05 22:59           ` bug#17848: #17848 add suffix search to -l even when directory part in argument npostavs
@ 2016-09-06 15:05             ` Eli Zaretskii
  2016-09-08  0:06               ` npostavs
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-09-06 15:05 UTC (permalink / raw)
  To: npostavs; +Cc: 17848

> From: npostavs@users.sourceforge.net
> Cc: 17848@debbugs.gnu.org,  rgm@gnu.org
> Date: Mon, 05 Sep 2016 18:59:22 -0400
> 
> > I'm not sure.  Wouldn't adding the leading directory to load-path in a
> > let-binding be a cleaner solution?  IOW, I don't understand the reason
> > for the "Take file from default dir if it exists there" logic in the
> > first place -- what are we gaining there?
> 
> If we let-bind `load-path', then this could influence the code that
> we're loading.  For more context, I came to this bug from
> test/Makefile.in:
> 
>     ## We need to use $loadfile because:
>     ## i) -L :$srcdir -l basename does not work, because we have files whose
>     ## basename duplicates a file in lisp/ (eg eshell.el).
>     ## ii) Although -l basename will automatically load .el or .elc,
>     ## -l ./basename treats basename as a literal file (it would be nice
>     ## to change this; bug#17848 - if that gets done, this can be simplified).

You have a point there, indeed.

However, I don't think the proposed solution, to pass to 'load' the
explicit absolute file name of a file that 'locate-file' found, is TRT
here.  Here's my rationale:

Stepping back a notch, what is the root cause of the reported bug?
The root cause, AFAICT, is that ./foo doesn't exist, and therefore we
pass literally "./foo" to 'load', which then looks for this relative
file name in every directory in load-path, and doesn't try the current
directory.  If we were to pass an absolute file name "/some/where/foo"
to 'load', it wouldn't have looked along load-path, but instead would
try /some/where/foo.elc, /some/where/foo.el, etc. -- exactly as
requested.

The proposed patch indeed passes an absolute file name to 'load', but
it passes the name of the first candidate file found by 'locate-file',
and that could very well be different from what 'load' would have
found, because 'load' has some additional features and logic that
'locate-file' doesn't.

So I think what we need is to see if 'locate-file' finds _any_
candidate at all, and if it does, simply pass to 'load' the result of

  (expand-file-name file)

disregarding the file name returned by 'locate-file'; and we should do
that only if 'file' is not an absolute file name to begin with.  WDYT?

One other thought: should we prefer an exact match, without any
extensions, in this particular case?  IOW, should "-l ./foo" prefer
'foo" even if "foo.el" or "foo.gz" etc. exist in the current
directory?  If we should indeed prefer an exact match, then we might
need to tweak the order of the suffixes to support that.

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#16406: load prefers directories rather than searching load-path
  2016-09-03 19:27             ` Eli Zaretskii
@ 2016-09-07 23:27               ` npostavs
  0 siblings, 0 replies; 15+ messages in thread
From: npostavs @ 2016-09-07 23:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16406

tags 16406 fixed
close 16406 25.2
quit

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, LGTM.

Pushed as a08ce41e





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#17848: #17848 add suffix search to -l even when directory part in argument
  2016-09-06 15:05             ` Eli Zaretskii
@ 2016-09-08  0:06               ` npostavs
  0 siblings, 0 replies; 15+ messages in thread
From: npostavs @ 2016-09-08  0:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 17848

tags 17848 - patch
quit

Eli Zaretskii <eliz@gnu.org> writes:

> The proposed patch indeed passes an absolute file name to 'load', but
> it passes the name of the first candidate file found by 'locate-file',
> and that could very well be different from what 'load' would have
> found, because 'load' has some additional features and logic that
> 'locate-file' doesn't.

Actually, thinking more about it, I wonder what's wrong with just doing 

    emacs -l '$PWD/foo'

or even

    emacs -l $PWD/foo

    
So then it's just a question of whether it's worth saving a few
characters on the command line (to write ./foo instead of '$PWD/foo'),
to which I'm inclined to answer "no", especially since implementing it
turns out to be rather fiddly.

>
> One other thought: should we prefer an exact match, without any
> extensions, in this particular case?  IOW, should "-l ./foo" prefer
> 'foo" even if "foo.el" or "foo.gz" etc. exist in the current
> directory?  If we should indeed prefer an exact match, then we might
> need to tweak the order of the suffixes to support that.





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-09-08  0:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-10  5:23 bug#16406: load prefers directories rather than searching load-path Glenn Morris
2014-01-10 14:46 ` Stefan Monnier
2016-08-21 16:35 ` npostavs
2016-09-03 16:43   ` npostavs
2016-09-03 17:32     ` Eli Zaretskii
2016-09-03 18:43       ` npostavs
2016-09-03 19:00         ` Eli Zaretskii
2016-09-03 19:12           ` npostavs
2016-09-03 19:27             ` Eli Zaretskii
2016-09-07 23:27               ` npostavs
2016-09-04 22:06       ` bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...) npostavs
2016-09-05 15:07         ` Eli Zaretskii
2016-09-05 22:59           ` bug#17848: #17848 add suffix search to -l even when directory part in argument npostavs
2016-09-06 15:05             ` Eli Zaretskii
2016-09-08  0:06               ` npostavs

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).