unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Rocky Bernstein <rocky@gnu.org>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-devel@gnu.org
Subject: Re: relative load-file
Date: Wed, 11 Nov 2009 14:26:01 -0500	[thread overview]
Message-ID: <6cd6de210911111126y62c7dfceqb82092c9eef9890d@mail.gmail.com> (raw)
In-Reply-To: <87ljic7vu9.fsf@thinkpad.tsdh.de>

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

On Wed, Nov 11, 2009 at 1:35 PM, Tassilo Horn <tassilo@member.fsf.org>wrote:

> Rocky Bernstein <rocky@gnu.org> writes:
>
> Hi Rocky!
>
> > For developing multi-file emacs packages, it would be helpful to have
> > something akin to require-relative in Ruby 1.9. That is, one wants to
> > load an Emacs Lisp file relative the file that issues the load which
> > is often in the same directory or a nearby directory.
>
> `load-file' accepts relative paths.
>
> Let's say your project looks like
>
>      foo/foo.el
>      foo/misc/foo-misc.el
>
> then a (load-file "misc/foo-misc.el") in foo.el should work.
>
> Bye,
> Tassilo
>

I don't see that this does what I need or meant to convey:
   one wants to load an Emacs Lisp file *relative [to] the* *[directory of
the]* *file that issues the load *

Here my test of the above suggestion..

$ find /tmp/proj -type f -print -exec cat {} \;
/tmp/proj/subdir/subload.el
       (load-file "../test1.el")
/tmp/proj/test1.el
      (load-file "test3.el")
/tmp/proj/test3.el
       (message "test3 here")

Now inside emacs I edit /tmp/proj/subdir/subload.el, and M-x
eval-current-buffer. I get:

load-file: Cannot open load file: /tmp/proj/subdir/test3.el

This is loading relative to the directory I started at, /tmp/proj/subdir,
not relative to the directory that of the file that issued the load,
/tmp/proj/test1.el.

[-- Attachment #2: Type: text/html, Size: 1952 bytes --]

  reply	other threads:[~2009-11-11 19:26 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11 17:01 relative load-file Rocky Bernstein
2009-11-11 18:35 ` Tassilo Horn
2009-11-11 19:26   ` Rocky Bernstein [this message]
2009-11-11 19:54     ` Tassilo Horn
2009-11-11 20:17     ` Stefan Monnier
2009-11-11 21:21       ` Rocky Bernstein
2009-11-11 23:06         ` Stefan Monnier
2009-11-12  1:01           ` Rocky Bernstein
2009-11-12  1:20             ` Stefan Monnier
2009-11-12  2:09               ` Rocky Bernstein
2009-11-12  4:22                 ` Stefan Monnier
2009-11-12 13:01                   ` Rocky Bernstein
2009-11-12 13:52                     ` spedrosa
2009-11-12 14:11                       ` Andreas Schwab
2009-11-12 15:34                     ` Stefan Monnier
2009-11-13  4:34                       ` Rocky Bernstein
2009-11-13 14:22                         ` Stefan Monnier
2009-11-13 15:03                           ` Rocky Bernstein
2009-11-13 16:17                             ` Stefan Monnier
2009-11-13 16:39                               ` Rocky Bernstein
2009-11-14 11:24 ` Richard Stallman
2009-11-14 15:44   ` Rocky Bernstein
2009-11-15 21:59     ` M Jared Finder
2009-11-18  3:20       ` Stefan Monnier
2009-11-15 22:38     ` Richard Stallman
2009-11-15 23:50       ` Rocky Bernstein
2009-11-18 12:10         ` Richard Stallman
2009-11-18 13:39           ` Rocky Bernstein
2009-11-21 22:52             ` Richard Stallman
2009-11-22  4:45               ` Rocky Bernstein
2009-11-23  2:29                 ` Richard Stallman
2009-11-23 15:04                   ` Rocky Bernstein
2009-11-24 14:11                     ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2009-11-13  5:24 grischka
2009-11-13  5:59 ` Rocky Bernstein
2009-11-13 14:26   ` Stefan Monnier
2009-11-13 15:06     ` Rocky Bernstein

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=6cd6de210911111126y62c7dfceqb82092c9eef9890d@mail.gmail.com \
    --to=rocky@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tassilo@member.fsf.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).