GNU bug report logs - #23638
"load" should use directory from load-file-name as a final fallback

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Robert Weiner <rswgnu@HIDDEN>; dated Sat, 28 May 2016 14:35:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 23638 <at> debbugs.gnu.org:


Received: (at 23638) by debbugs.gnu.org; 7 Feb 2021 13:14:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 07 08:14:47 2021
Received: from localhost ([127.0.0.1]:47071 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l8jtn-0006EY-Ic
	for submit <at> debbugs.gnu.org; Sun, 07 Feb 2021 08:14:47 -0500
Received: from quimby.gnus.org ([95.216.78.240]:35246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1l8jtj-0006EI-1C
 for 23638 <at> debbugs.gnu.org; Sun, 07 Feb 2021 08:14:46 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=cae0eIv7vqNyEqWCUt1HllTuN7sKY6MuGw0DS2TslQQ=; b=QD28+kLarZoNjG8/2hwoT8t31E
 tZ5qjgmaAnpYmjk9mSC00L0MK3BpmFTuKh1r8AbNfNU/9xARZpVL7kC/tpuTciJU9WP1L+TM8psLs
 SHeI0SwvevCgetLcJPh177SXeC0gPA+6XIf57yEGhWYf1anclzJQuGOIbjOOAl5giNUk=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1l8jtZ-0000Xk-GK; Sun, 07 Feb 2021 14:14:37 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Robert Weiner <rswgnu@HIDDEN>
Subject: Re: bug#23638: "load" should use directory from load-file-name as a
 final fallback
References: <CA+OMD9hJuFZ+au2p2CPWMADS_xYjY3Gy--tW_uugqhZoX3UEkA@HIDDEN>
X-Now-Playing: James White and the Blacks's _Off White_: "White Savage"
Date: Sun, 07 Feb 2021 14:14:32 +0100
In-Reply-To: <CA+OMD9hJuFZ+au2p2CPWMADS_xYjY3Gy--tW_uugqhZoX3UEkA@HIDDEN>
 (Robert Weiner's message of "Sat, 28 May 2016 10:33:20 -0400")
Message-ID: <875z346mvb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Robert Weiner <rswgnu@HIDDEN> writes: > The "load"
 function
 could do more of the right thing in the case where > an absolute path is
 given in a load call and then within the file > loaded,
 require or load references are made to relative f [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 23638
Cc: 23638 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Robert Weiner <rswgnu@HIDDEN> writes:

> The "load" function could do more of the right thing in the case where
> an absolute path is given in a load call and then within the file
> loaded, require or load references are made to relative files whose
> directories are not in load path but the files do exist within the
> directory specified by the original load.

It's an interesting idea, and I guess it's pretty trivial to implement?
That is, if `load' is called with an absolute path, then bind
`load-path' and add the directory to the value locally.

It sounds convenient, but also kinda chaotic -- if I load "/tmp/foo.el",
then I may not want to load anything else from "/tmp/" just because
"/tmp/foo.el" says "(require 'bar)".  That is, it sounds kinda insecure.

There's also the issue of being consistent -- today,
'(load "/tmp/foo.el")' and `C-x C-f /tmp/foo.el RET' and then
`eval-buffer' gives the same result...  but this wouldn't be the case if
we changed `load' this way.

Now, we could add a new command `load-file-with-directory' or something
that would do this -- that would be more clear, at least, that we're
playing games with `load-path', and would be almost as convenient as if
`load' did this itself.

Any opinions here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23638; Package emacs. Full text available.

Message received at 23638 <at> debbugs.gnu.org:


Received: (at 23638) by debbugs.gnu.org; 28 May 2016 14:49:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 28 10:49:42 2016
Received: from localhost ([127.0.0.1]:44940 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b6fYc-0003DC-Nm
	for submit <at> debbugs.gnu.org; Sat, 28 May 2016 10:49:42 -0400
Received: from mail-oi0-f48.google.com ([209.85.218.48]:34881)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fYb-0003Bm-5N
 for 23638 <at> debbugs.gnu.org; Sat, 28 May 2016 10:49:41 -0400
Received: by mail-oi0-f48.google.com with SMTP id w184so207478504oiw.2
 for <23638 <at> debbugs.gnu.org>; Sat, 28 May 2016 07:49:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:from:date:message-id:subject:to;
 bh=rXIA2H6VCDRKUeivL8PJk9mY/3a9ojZrh7poeIuQfZo=;
 b=wRkBlP138BQM+6/0Wls6ydyVblugUirBX4tPFd22IIn43msTo6NNOpaeQjYm6suW6R
 uG4DHTkDQCfe9wWdY5Dt38maRzbpJ0cSSEOC28pEDTNgOTu4VaFawvY0/h1F+jEjQmg8
 ynrytNaZRAysbuaxVWWmhGqWDsyeIoJ+q8chLcxzng29bAVUmHqUDOUwXKSLPL8E1ld0
 29tR3rOF0Cs3RafwGR/9KW9KofVa/1Hkhh5mgnITtOYK9Wqzz2LTmnQxC1gIjLlyzwUn
 iFMNXuA5+89FZzMWiTsO3WzWVYWHwAiJRanSoWTGKXAggjOTuq+cTIDFcR+bO+Wsb4ZI
 LlyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=rXIA2H6VCDRKUeivL8PJk9mY/3a9ojZrh7poeIuQfZo=;
 b=C5kc8C8RrhOLN2T6kuml+GwbOdNM+fbBgSXa1vUKc9Na79FADPcFKbpQomPrjQhP6A
 aT4tUnLzua/ooUK0t3Abfa8P5sOZ4nxZ2GZSPs1l4UtKAkUvF8J/vxEwIZonJOMmZwDt
 64YVL9HGgRUGMLiO66UavTM/woWhCbBvE/OPHwxKuNMvL7+0eOf1V9+WuvX4h12Mqfky
 HQQnlPd8VhbIz/VLtojH16FcZ1H4O0L5W0vLW8l7dQ/4OvV3Q1cCe6WLxO8vCElytc0N
 ARnihgRd+SaUDzF13+3EGOcAkrs6E3Ks8BkHefMo71GJ+Gz2UPHxaptQGkOTTnq3I3zg
 +KDQ==
X-Gm-Message-State: ALyK8tLmCoUkyp+U1EGYaZjkyMD0kva4HtqQtcSNK7FZWmaJ63p1PaR4SEq/ruHHS7WoOdiAeg7N2uCYE+bBNw==
X-Received: by 10.202.225.8 with SMTP id y8mr13566309oig.192.1464446975239;
 Sat, 28 May 2016 07:49:35 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.205.17 with HTTP; Sat, 28 May 2016 07:49:05 -0700 (PDT)
From: Robert Weiner <rswgnu@HIDDEN>
Date: Sat, 28 May 2016 10:49:05 -0400
Message-ID: <CA+OMD9j7ExrwqWvLH0sZxjOoJzhGLXmhzoTqgnY+h9KPUjBmYQ@HIDDEN>
Subject: Someone thought relative file loading was enough of a problem, he
 wrote a whole package for it.
To: 23638 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary=001a113cd178c069bb0533e821cf
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 23638
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--001a113cd178c069bb0533e821cf
Content-Type: text/plain; charset=UTF-8

That package is here:

https://github.com/rocky/emacs-load-relative

But integrating the key points into "load" would be much more useful and
cleaner.

Bob

--001a113cd178c069bb0533e821cf
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">That package is here:<div><br></div><div><a href=3D"https:=
//github.com/rocky/emacs-load-relative">https://github.com/rocky/emacs-load=
-relative</a><br></div><div><br></div><div>But integrating the key points i=
nto &quot;load&quot; would be much more useful and cleaner.</div><div><br><=
/div><div>Bob</div><div><br></div></div>

--001a113cd178c069bb0533e821cf--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23638; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 May 2016 14:34:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 28 10:34:03 2016
Received: from localhost ([127.0.0.1]:44929 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1b6fJS-0002mn-T0
	for submit <at> debbugs.gnu.org; Sat, 28 May 2016 10:34:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50491)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fJR-0002mK-84
 for submit <at> debbugs.gnu.org; Sat, 28 May 2016 10:34:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fJL-0006Zm-1n
 for submit <at> debbugs.gnu.org; Sat, 28 May 2016 10:33:56 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:58211)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fJK-0006ZT-Uz
 for submit <at> debbugs.gnu.org; Sat, 28 May 2016 10:33:54 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41444)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fJI-0002Zd-Jv
 for bug-gnu-emacs@HIDDEN; Sat, 28 May 2016 10:33:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fJG-0006Z7-IM
 for bug-gnu-emacs@HIDDEN; Sat, 28 May 2016 10:33:51 -0400
Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:33166)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <rswgnu@HIDDEN>) id 1b6fJG-0006Z1-CR
 for bug-gnu-emacs@HIDDEN; Sat, 28 May 2016 10:33:50 -0400
Received: by mail-oi0-x22a.google.com with SMTP id k23so214037326oih.0
 for <bug-gnu-emacs@HIDDEN>; Sat, 28 May 2016 07:33:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:from:date:message-id:subject:to;
 bh=KSpb7frv0kF9TE0jQ8cv+U0mOGA37+YDUwGyoVYgj3Q=;
 b=s4ttkZ30kKtalGFebeoQ3p4THua0ol3ctUDOW0H4YAOb9XJyH8dZGezocHC9G4yqgb
 uzhzPLJiTKRAzXGX97HPe5Jl2c+DYFNfXyjZg+js60lDnzi9PIE7wlGWbGzIzy9Wyjg+
 WH/amRvfK3AbmxbsxlS7lBxXY10zfNmcem0+N6YleaQTJ3OBqk0nVr1SUXQ2JWsgJRit
 wfkU3PqWObk/Xw7rN+9nGvF0K44iuwdv5GY8MHMkx1yR0wlp7s9G6pWXyrSxYHQ7ppRP
 svssG3yXAMSDrbFFX+NJ1xqWIUObE9mHXknTStkVipjfAabOiiUSdZva9HSjVD0CNFxw
 GuSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=KSpb7frv0kF9TE0jQ8cv+U0mOGA37+YDUwGyoVYgj3Q=;
 b=WFq0w6qilBBZgF0Va97I0EVTadvtcYc2eb1d9LSKQd7PAKBVUMKoMRb7PHcZkPRmhy
 rChMS66qDAiVHPlMSsDgUXgDwfS6fvMYhkhgBOM0BSjqcidYXAwIjYOSZppca9dWMI0U
 Fbe+69+v/z+z4S9nAINXyB6sOUjfi4uZFn8OQrt5l7DfuEKxULUmczO4t3GAyrM+RGD1
 k+2dq4fyI2CMjshoYUzDAyzIl+DjT50FVQtkaoXDC6IQmVsQnNArsSg3PMYB6geNwkV/
 HYNl9FeHmCBgHI2dbea3j/s21uzKLzQ9TDy5oRuUTtJGogn1rU385Ak5d5jCNUh6+AJu
 74Xg==
X-Gm-Message-State: ALyK8tJ2hXw4mFODoYRFs9qgnGdlbjg81IAaIzP5/Dg82sirEXnYPfU3scyODAX7zoGLkYSVogNgKodMbb1Mhg==
X-Received: by 10.202.224.85 with SMTP id x82mr8994547oig.176.1464446029927;
 Sat, 28 May 2016 07:33:49 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.202.205.17 with HTTP; Sat, 28 May 2016 07:33:20 -0700 (PDT)
From: Robert Weiner <rswgnu@HIDDEN>
Date: Sat, 28 May 2016 10:33:20 -0400
Message-ID: <CA+OMD9hJuFZ+au2p2CPWMADS_xYjY3Gy--tW_uugqhZoX3UEkA@HIDDEN>
Subject: "load" should use directory from load-file-name as a final fallback
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=001a113d2b82681c490533e7e937
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

--001a113d2b82681c490533e7e937
Content-Type: text/plain; charset=UTF-8

The "load" function could do more of the right thing in the case where an
absolute path is given in a load call and then within the file loaded,
require or load references are made to relative files whose directories are
not in load path but the files do exist within the directory specified by
the original load.

So for example, we have a testing directory, "/tmp/" not in load-path with
files a.el and b.el.
In a.el, there is the line: (require 'b) and then we do a (load
"/tmp/a.el").  The require of b will fail but since load-file-name is set
to /tmp/a.el, if no matches are found in load-path, it would be a simple
matter to try to resolve b in the directory specified in load-file-name as
a fallback.

This would help in many cases when experimenting with new directories of
code that have not yet been added to the load path.  It also would help the
Emacs package system since it adds only the top-level directory of a
package to load-path when trying to byte-compile the package.  If the
package contains subdirectories, which require or load local files within
these subdirectories, these will fail right now but would succeed with the
above change.

Any comments, suggestions or issues with this?  Please consider
implementing this and help make multi-directory packages a reality.

--001a113d2b82681c490533e7e937
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The &quot;load&quot; function could do more of the right t=
hing in the case where an absolute path is given in a load call and then wi=
thin the file loaded, require or load references are made to relative files=
 whose directories are not in load path but the files do exist within the d=
irectory specified by the original load.<div><br></div><div>So for example,=
 we have a testing directory, &quot;/tmp/&quot; not in load-path with files=
 a.el and b.el.</div><div>In a.el, there is the line: (require &#39;b) and =
then we do a (load &quot;/tmp/a.el&quot;).=C2=A0 The require of b will fail=
 but since load-file-name is set to /tmp/a.el, if no matches are found in l=
oad-path, it would be a simple matter to try to resolve b in the directory =
specified in load-file-name as a fallback.</div><div><br></div><div>This wo=
uld help in many cases when experimenting with new directories of code that=
 have not yet been added to the load path.=C2=A0 It also would help the Ema=
cs package system since it adds only the top-level directory of a package t=
o load-path when trying to byte-compile the package.=C2=A0 If the package c=
ontains subdirectories, which require or load local files within these subd=
irectories, these will fail right now but would succeed with the above chan=
ge.</div><div><br></div><div>Any comments, suggestions or issues with this?=
=C2=A0 Please consider implementing this and help make multi-directory pack=
ages a reality.</div></div>

--001a113d2b82681c490533e7e937--




Acknowledgement sent to Robert Weiner <rswgnu@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#23638; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 7 Feb 2021 13:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.