Page 1 of 1

Load path?

Posted: Fri Apr 20, 2007 2:24 pm
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

Posted: Fri Apr 20, 2007 2:32 pm
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 ;-)

Posted: Fri Apr 20, 2007 2:34 pm
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

Posted: Fri Apr 20, 2007 2:37 pm
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

Posted: Fri Apr 20, 2007 2:39 pm
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...

Posted: Fri Apr 20, 2007 2:41 pm
by newdep
hehehe..