Load path?

Q&A's, tips, howto's
Locked
rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Load path?

Post by rickyboy »

Lutz? Any one? Is there a load path for newLISP?

I need my newLISP library routines to be loaded on demand (as opposed to all the time, e.g. init.lsp in the share directory). And I'd like to avoid saying

Code: Select all

(load "/path/to/rickyboys/libs/mylib.lsp")
but rather say

Code: Select all

(load "mylib.lsp")
and have /path/to/rickyboys/libs in the "load path." Thinking of emacs here -- so what is the newLISP way?

Thanks for any help! --Ricky
(λx. x x) (λx. x x)

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Hi Ricky,

well by default there is not, but indeed newlisp seeks for init.lsp

But you could add to you ENV someting like export NEWLISP_PATH=/mylibs


Then put an (env "NEWLISP_PATH") in your init.lsp and append
that always to your files..or script and it will load from there...

But perhpas a default path setting inside newlisp would help out ;-)
-- (define? (Cornflakes))

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

I couldn't find it in the manual or the source code; so it looks as if I need to write my own load function which will be located in init.lsp and which honors a "load path".

Thanks! --Ricky
(λx. x x) (λx. x x)

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Post by rickyboy »

newdep wrote:Hi Ricky,

well by default there is not, but indeed newlisp seeks for init.lsp

But you could add to you ENV someting like export NEWLISP_PATH=/mylibs


Then put an (env "NEWLISP_PATH") in your init.lsp and append
that always to your files..or script and it will load from there...

But perhpas a default path setting inside newlisp would help out ;-)
Hey Norman, You were writing at the same time I was and we came to the same conclusion. Great minds think alike, it is said. ;-)

Thanks! --Ricky
(λx. x x) (λx. x x)

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

the init.lsp is hidden in /usr/share/newlisp..

or in your ~/.init.lsp

its called init.lsp.example by default...


put (set-env "NEWLISP_LIBS" "/mylibs") in your init.lsp


in your scripts or in init.lsp put something like

(setq $L (env "NEWLISP_LIBS"))

now $L always has your directory..


could be done differently though...
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

hehehe..
-- (define? (Cornflakes))

Locked