From: Trent Buck
Subject: CL equivalent of Emacs' load-path
Date: 
Message-ID: <20050126193139.2c2cbbbf@harpo.marx>
In (GNU) Emacs, I say something like

	(add-to-list 'load-path "/foo/pkg/cvs/lisp--slime/slime")
	(require 'slime)

How to I tell CL where to look for packages?  Specifically, I want to
use definitions url.lisp from CLOCC, without compiling and installing.
I'm using CMUCL, CLISP and GCL.

The hyperspec notes that PROVIDE and REQUIRE are deprecated.  What is
the alternative, and why are people (e.g. CLOCC) using it in their code?

-- 
-trent
`Zero Tolerance' in this case meaning `We're too stupid to be able to
apply conscious thought on a case-by-case basis'. -- Mike Sphar

From: Oyvin Halfdan Thuv
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <7omzuwy42y.fsf@apollo.orakel.ntnu.no>
Trent Buck <·········@tznvy.pbz> writes:

> In (GNU) Emacs, I say something like
> 
> 	(add-to-list 'load-path "/foo/pkg/cvs/lisp--slime/slime")
> 	(require 'slime)
> 
> How to I tell CL where to look for packages?  Specifically, I want to
> use definitions url.lisp from CLOCC, without compiling and installing.
> I'm using CMUCL, CLISP and GCL.

If you use ASDF you can use the *central-registry* list in much the same way
as load-path in emacs. It's in the ADSF-package.

> The hyperspec notes that PROVIDE and REQUIRE are deprecated. 

I believe LOAD is the state-of-the-art now. And ADSF for "modules".

> What is
> the alternative, and why are people (e.g. CLOCC) using it in their code?

Good question. Probably because it still works in most (all?) implementations?

-- 
Oyvin
From: Marco Antoniotti
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <iEPJd.2$fp1.11960@typhoon.nyu.edu>
Trent Buck wrote:
> In (GNU) Emacs, I say something like
> 
> 	(add-to-list 'load-path "/foo/pkg/cvs/lisp--slime/slime")
> 	(require 'slime)
> 
> How to I tell CL where to look for packages?  Specifically, I want to
> use definitions url.lisp from CLOCC, without compiling and installing.
> I'm using CMUCL, CLISP and GCL.
> 
> The hyperspec notes that PROVIDE and REQUIRE are deprecated.  What is
> the alternative, and why are people (e.g. CLOCC) using it in their code?

There is not a portable way of doing this.  If you are using 
MK:DEFSYSTEM or ASDF you can have a look at MK:*CENTRAL-REGISTRY* or 
ASDF:*CENTRAL-REGISTRY* which is a list.

In MK:DEFSYSTEM you can use the function MKM:ADD-REGISTRY-LOCATION to 
achieve the desired effect.

CMUCL and SBCL (and other CL too) have a way to make MK:DEFSYSTEM and 
ASDF aware of the inner workings of CL:REQUIRE.

Cheers
--
Marco
From: Rahul Jain
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <87brbbxzle.fsf@nyct.net>
Marco Antoniotti <·······@cs.nyu.edu> writes:

> There is not a portable way of doing this.  If you are using
> MK:DEFSYSTEM or ASDF you can have a look at MK:*CENTRAL-REGISTRY* or
> ASDF:*CENTRAL-REGISTRY* which is a list.

When using ASDF, if you have lots of projects scattered all over the
place, you can create one directory specifically for the .asd files. 
_Symlink_ the .asd files from the various projects into the directory
you created and add it to the central registry. All those projects will
then be loadable using REQUIRE or ASDF:OOS.

-- 
Rahul Jain
·····@nyct.net
Professional Software Developer, Amateur Quantum Mechanicist
From: Pascal Bourguignon
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <87oefbkwof.fsf@thalassa.informatimago.com>
Rahul Jain <·····@nyct.net> writes:

> Marco Antoniotti <·······@cs.nyu.edu> writes:
> 
> > There is not a portable way of doing this.  If you are using
> > MK:DEFSYSTEM or ASDF you can have a look at MK:*CENTRAL-REGISTRY* or
> > ASDF:*CENTRAL-REGISTRY* which is a list.
> 
> When using ASDF, if you have lots of projects scattered all over the
> place, you can create one directory specifically for the .asd files. 
> _Symlink_ the .asd files from the various projects into the directory
> you created and add it to the central registry. All those projects will
> then be loadable using REQUIRE or ASDF:OOS.

I find it rather difficult to manage it this way. I much prefer this:

(defparameter *original-asdf-registry* ASDF:*CENTRAL-REGISTRY*)

;; ...

(defun asdf-rescan-packages ()
  (SORT (DELETE-DUPLICATES 
         (MAPCAR
          (LAMBDA (P) (MAKE-PATHNAME :NAME NIL :TYPE NIL :VERSION NIL :DEFAULTS P))
          (DIRECTORY "PACKAGES:**;*.ASD")) 
         :test (function equal))
        (LAMBDA (A B) (if (= (length a) (length b))
                   (string< a b)
                   (< (length a) (length b))))
        :key (function namestring)))

(defun update-asdf-registry ()
  (setf ASDF:*CENTRAL-REGISTRY*
        (nconc (asdf-rescan-packages)
                (list CCLAN-GET::*CCLAN-ASDF-REGISTRY*)
                *original-asdf-registry*)))

(update-asdf-registry)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
You never feed me.
Perhaps I'll sleep on your face.
That will sure show you.
From: Marco Antoniotti
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <7vcKd.3$fp1.14076@typhoon.nyu.edu>
Rahul Jain wrote:
> Marco Antoniotti <·······@cs.nyu.edu> writes:
> 
> 
>>There is not a portable way of doing this.  If you are using
>>MK:DEFSYSTEM or ASDF you can have a look at MK:*CENTRAL-REGISTRY* or
>>ASDF:*CENTRAL-REGISTRY* which is a list.
> 
> 
> When using ASDF, if you have lots of projects scattered all over the
> place, you can create one directory specifically for the .asd files. 
> _Symlink_ the .asd files from the various projects into the directory
> you created and add it to the central registry. All those projects will
> then be loadable using REQUIRE or ASDF:OOS.
> 

This should work with MK:DEFSYSTEM as well provided that you are 
redefining REQUIRE or that you are using CMUCL/SBCL.   In MK:DEFSYSTEM 
(cvs version) you can also have all your systems reside in a 
subdirectory of a directory listed in the central registry.  Say 
$HOME/lisp.  Doing  (mk:load-system "mysys") (or mk:compile-system or 
mk:oos) will load the correct "mysys.system" from 
$HOME/lisp/mysys/mysys.system and take it from there.

This works very well under Windows where shortcuts have a different 
semantics than symlinks under UNIX.

Cheers

Marco
From: rydis (Martin Rydstr|m) @CD.Chalmers.SE
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <w4cr7k7es39.fsf@boris.cd.chalmers.se>
Marco Antoniotti <·······@cs.nyu.edu> writes:
> Trent Buck wrote:
> > In (GNU) Emacs, I say something like
> > 	(add-to-list 'load-path "/foo/pkg/cvs/lisp--slime/slime")
> > 	(require 'slime)
> > How to I tell CL where to look for packages?  Specifically, I want to
> > use definitions url.lisp from CLOCC, without compiling and installing.
> > I'm using CMUCL, CLISP and GCL.
> > The hyperspec notes that PROVIDE and REQUIRE are deprecated.  What is
> > the alternative, and why are people (e.g. CLOCC) using it in their code?
> 
> There is not a portable way of doing this.  If you are using
> MK:DEFSYSTEM or ASDF you can have a look at MK:*CENTRAL-REGISTRY* or
> ASDF:*CENTRAL-REGISTRY* which is a list.
> 
> In MK:DEFSYSTEM you can use the function MKM:ADD-REGISTRY-LOCATION to
> achieve the desired effect.
> 
> CMUCL and SBCL (and other CL too) have a way to make MK:DEFSYSTEM and
> ASDF aware of the inner workings of CL:REQUIRE.

CMUCL also has it's DEFMODULE, as well as the #p"modules:" search-list.

Regards,

'mr

-- 
[Emacs] is written in Lisp, which is the only computer language that is
beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_
From: Steven M. Haflich
Subject: Re: CL equivalent of Emacs' load-path
Date: 
Message-ID: <nk%Jd.15531$wZ2.9971@newssvr13.news.prodigy.com>
Trent Buck wrote:
> In (GNU) Emacs, I say something like
> 
> 	(add-to-list 'load-path "/foo/pkg/cvs/lisp--slime/slime")
> 	(require 'slime)
> 
> How to I tell CL where to look for packages?

"Package" is the wrong term.  You might as well ask how to tell
CL where to look for floating-point numbers of streams.  The term
of art that relates to cl:require is the "module".

The functions require and provide are deprecated in the ANS because
it was recognized that they are insufficient to support serious
portable modularity.  There was at the time the ANS was finished no
agreed standards on what would satisfy this need.  This is still the
case.

If you don't want to depend on the systems suggested in other messages
in this thread, and if ou want to keep within the ANS, you might
consider always using the two-argument form of cl:require, and
always use a logical pathname as he second argument.  Logical pathname
translations provide a reasonably flexible late-binding mechanism to
locate required modules.