From: Jim Newton
Subject: which directory does LOAD load from
Date: 
Message-ID: <30cjevF2v40qbU1@uni-berlin.de>
In UNIX if I cd into the directory where the files are,
and use LOAD, it finds the files in that directory.  However,
when i'm using SLIME, i cannot figure out why it tries
to load from the wrong directory?  Is this a problem of SLIME? or is 
there perhaps some search path mechanism which LOAD knows about.  I have 
not found any mention of a load-path in the hyper spec documentation of 
the LOAD function.

-jim

From: Thomas F. Burdick
Subject: Re: which directory does LOAD load from
Date: 
Message-ID: <xcvzn1alhjz.fsf@conquest.OCF.Berkeley.EDU>
Jim Newton <·····@rdrop.com> writes:

> In UNIX if I cd into the directory where the files are,
> and use LOAD, it finds the files in that directory.  However,
> when i'm using SLIME, i cannot figure out why it tries
> to load from the wrong directory?  Is this a problem of SLIME? or is 
> there perhaps some search path mechanism which LOAD knows about.  I have 
> not found any mention of a load-path in the hyper spec documentation of 
> the LOAD function.

LOAD will merge what you give it with *DEFAULT-PATHNAME-DEFAULTS*,
which is the Common Lisp equivalent to the notion of pwd.  Some lisps
get this better than others[*], but one way or another, *d-p-d* will
probably be the directory that you started the Lisp in.  In Slime, it
will be the directory Emacs was in when it started the inferior-lisp
process.  You should be able to just set *d-p-d* to a valid pathname
object (not a string!), but if you're typing at the toplevel, the
easiest way to do this is with the ",cd" command at the Slime
toplevel.

[*] SBCL, for example, will set *d-p-d* to the directory you started
it in.  CMUCL and MCL set it to #p"", and interpret any non-absolute
pathnames as being relative to the OS's concept of pwd.  Both CMUCL
and SBCL both do the right thing if you do:

  (setf *default-pathname-defaults*
        (pathname "/usr/local/src/my-project/"))
From: Petter Gustad
Subject: Re: which directory does LOAD load from
Date: 
Message-ID: <87fz32g5jd.fsf@parish.home.gustad.com>
Jim Newton <·····@rdrop.com> writes:

> In UNIX if I cd into the directory where the files are, and use
> LOAD, it finds the files in that directory. However, when i'm using
> SLIME, i cannot figure out why it tries to load from the wrong
> directory? 

In slime-mode it's easier to use C-c C-l and specify the path to the
file you want to load, or better use C-c C-k to compile and load the
current buffer.

Petter
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Petter Gustad
Subject: Re: which directory does LOAD load from
Date: 
Message-ID: <87brdqfl2z.fsf@parish.home.gustad.com>
Petter Gustad <·············@gustad.com> writes:

> Jim Newton <·····@rdrop.com> writes:
> 
> > In UNIX if I cd into the directory where the files are, and use
> > LOAD, it finds the files in that directory. However, when i'm using
> > SLIME, i cannot figure out why it tries to load from the wrong
> > directory? 
> 
> In slime-mode it's easier to use C-c C-l and specify the path to the
> file you want to load, or better use C-c C-k to compile and load the
> current buffer.

If you want to use load you can also type C-c ~ while in a buffer to
set the current directory (and package) to the one of the current
buffer.

Petter

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Jim Newton
Subject: Re: which directory does LOAD load from
Date: 
Message-ID: <30dil4F2via52U1@uni-berlin.de>
Changing the directory works.  ,cd
but simply using C-c C-k does not.
especially if the file I am compiling
tries to load another file.   load looks in the current
directory not in the directory of the file being loaded.

-jim


Petter Gustad wrote:
> Jim Newton <·····@rdrop.com> writes:
> 
> 
>>In UNIX if I cd into the directory where the files are, and use
>>LOAD, it finds the files in that directory. However, when i'm using
>>SLIME, i cannot figure out why it tries to load from the wrong
>>directory? 
> 
> 
> In slime-mode it's easier to use C-c C-l and specify the path to the
> file you want to load, or better use C-c C-k to compile and load the
> current buffer.
> 
> Petter
From: ·············@gustad.com
Subject: Re: which directory does LOAD load from
Date: 
Message-ID: <kjur7mmrxk5.fsf@shardlow.dolphinics.no>
Jim Newton <·····@rdrop.com> writes:

> Changing the directory works. ,cd but simply using C-c C-k does not.

C-c C-k compiles and loads the current buffer, but does not change the
current working directory.

> especially if the file I am compiling tries to load another file.
> load looks in the current directory not in the directory of the file
> being loaded.

If you need to load files from your source file you can get the path
of the file you are compiling and loading with C-c C-k using something
like:


(eval-when (:load-toplevel :execute)
  (load (make-pathname :name "other" :type "lisp" 
                       :directory (pathname-directory *load-pathname*))))



Petter
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Edi Weitz
Subject: Re: which directory does LOAD load from
Date: 
Message-ID: <u3bz2dbm6.fsf@agharta.de>
On Sun, 21 Nov 2004 23:34:30 +0100, Jim Newton <·····@rdrop.com> wrote:

> In UNIX if I cd into the directory where the files are, and use
> LOAD, it finds the files in that directory.  However, when i'm using
> SLIME, i cannot figure out why it tries to load from the wrong
> directory?  Is this a problem of SLIME? or is there perhaps some
> search path mechanism which LOAD knows about.  I have not found any
> mention of a load-path in the hyper spec documentation of the LOAD
> function.

You're trying to LOAD from within SLIME? Have you tried ,cd
(i.e. typing the three characters comma, c, and d while in the SLIME
REPL) for "change directory?" This should have the same effect as if
you had started CMUCL from there. The comma is for
slime-handle-repl-shortcut - see the docs for more nice shortcuts.

Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")