From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rocky Bernstein Newsgroups: gmane.emacs.devel Subject: Re: relative load-file Date: Wed, 11 Nov 2009 20:01:24 -0500 Message-ID: <6cd6de210911111701s5d5a989fp27386dd1379065ff@mail.gmail.com> References: <6cd6de210911110901v24307163i253e69e89c72c9e@mail.gmail.com> <87ljic7vu9.fsf@thinkpad.tsdh.de> <6cd6de210911111126y62c7dfceqb82092c9eef9890d@mail.gmail.com> <6cd6de210911111321t1176868yba2f07ca48f6b186@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001636e0b62015e26e04782215e1 X-Trace: ger.gmane.org 1257987704 16230 80.91.229.12 (12 Nov 2009 01:01:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Nov 2009 01:01:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 12 02:01:37 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N8O48-0000ae-Vq for ged-emacs-devel@m.gmane.org; Thu, 12 Nov 2009 02:01:37 +0100 Original-Received: from localhost ([127.0.0.1]:55879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8O47-00073W-St for ged-emacs-devel@m.gmane.org; Wed, 11 Nov 2009 20:01:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8O42-0006zq-T6 for emacs-devel@gnu.org; Wed, 11 Nov 2009 20:01:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8O3y-0006q8-AT for emacs-devel@gnu.org; Wed, 11 Nov 2009 20:01:30 -0500 Original-Received: from [199.232.76.173] (port=34291 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8O3y-0006pu-6f for emacs-devel@gnu.org; Wed, 11 Nov 2009 20:01:26 -0500 Original-Received: from mail-pw0-f47.google.com ([209.85.160.47]:61165) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8O3x-00050h-LK for emacs-devel@gnu.org; Wed, 11 Nov 2009 20:01:25 -0500 Original-Received: by pwi9 with SMTP id 9so1095007pwi.26 for ; Wed, 11 Nov 2009 17:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=jgLWYijEsdfmI3Oq+X6eRGp1XbvDRqZ0iqIg4vaLdU8=; b=BWgKbawp3ELWeIXEIQMkHszyCCneru/UJ+Ary2qYUZ//0OnFdvndbCLdoGFAvRNz4H 9I+TBD2RUnTJwdPvGXjYKex5lnkb/3YAR+xrBH0UKG0mv4rhfz90CvO1JXCy/0em5yj5 nbRjjS9NVxQtpAnyCkdj8xD2i/QIj95/eUl4Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=LeHeKqy5T8M9dQ4mpYqhXD5g9vqzaG7sWgmc402L/H8c2mYP2jhdi4FV93NsKwK8G7 PIdDbwfEH6M3yjxrWpTD3k/IDDlGKjYqpIIoapiOnosrsWqR0DV/b4SWUI3B5GwBOjgI PIG08OeGLXBkjPJATl6J6NUULXeMPM7qZs9Zc= Original-Received: by 10.142.61.35 with SMTP id j35mr256446wfa.52.1257987684819; Wed, 11 Nov 2009 17:01:24 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: 72f4f6668fab0db6 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116854 Archived-At: --001636e0b62015e26e04782215e1 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 11, 2009 at 6:06 PM, Stefan Monnier wrote: > > Unfortunately this doesn't work either because load-file-name might > > sometimes be nil. For example > > Of course in the case of M-C-x or eval-buffer, it will be nil. > If you care about that case, refine it to > > (load (expand-file-name (if load-file-name > (file-name-directory load-file-name)))) > I don't think this is quite right yet. When load-file-name is nil, this uses the name of default directory of current buffer. But that's not the same as the directory of the file containing the load-relative function. For example, I could have eval'd a buffer that did a load-relative of a file in a different directory. Even without this, I can change the default directory using the cd function. And changing the default directory never changes the file location of the file issuing load-relative. Any other thoughts? > > -- Stefan > --001636e0b62015e26e04782215e1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Wed, Nov 11, 2009 at 6:06 PM, Stefan = Monnier <m= onnier@iro.umontreal.ca> wrote:
> Unfortunately this doesn't work either because l= oad-file-name might
> sometimes be nil. =A0For example

Of course in the case of M-C-x or eval-buffer, it will be nil.
If you care about that case, refine it to

=A0 (load (expand-file-name <foo> (if load-file-name
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (f= ile-name-directory load-file-name))))

I don't = think this is quite right yet.

When load-file-name is nil,=A0 this u= ses the name of default directory of current buffer. But that's not the= same as the directory of the file containing the load-relative function.
For example, I could have eval'd a buffer that did a load-relative = of a file in a different directory. Even without this, I can change the def= ault directory using the cd function. And changing the default directory ne= ver changes the file location of the file issuing load-relative.

Any other thoughts?



-- Stefan

--001636e0b62015e26e04782215e1--