unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Eli Zaretskii <eliz@gnu.org>
Cc: 17848@debbugs.gnu.org
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	[thread overview]
Message-ID: <8760qb9v5v.fsf_-_@users.sourceforge.net> (raw)
In-Reply-To: <831t10evoh.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Sep 2016 20:32:14 +0300")

[-- 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


  parent reply	other threads:[~2016-09-04 22:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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       ` npostavs [this message]
2016-09-05 15:07         ` bug#17848: #17848 add suffix search to -l even when directory part in argument (WAS: Re: bug#16406: load prefers directories...) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760qb9v5v.fsf_-_@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=17848@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).