From: globalrev
Subject: extend the language permanently?
Date: 
Message-ID: <0ddcbbba-062f-49f8-8429-c846fcd72b38@56g2000hsm.googlegroups.com>
if i have some very useful functions and macros and a lot of them
saved in a file,

can i then load these automatically every time SLIME starts somehow?

so that they are practically a constant extension of the language.

From: Lars Rune Nøstdal
Subject: Re: extend the language permanently?
Date: 
Message-ID: <48155bac$0$28884$c83e3ef6@nn1-read.tele2.net>
globalrev wrote:
> if i have some very useful functions and macros and a lot of them
> saved in a file,
> 
> can i then load these automatically every time SLIME starts somehow?
> 
> so that they are practically a constant extension of the language.

http://www.sbcl.org/manual/Initialization-Files.html

you might be looking for ~/.sbclrc

-- 
Lars Rune N�stdal
http://nostdal.org/
From: globalrev
Subject: Re: extend the language permanently?
Date: 
Message-ID: <efcb35fb-36fc-412d-b039-80705c0a0dfa@m45g2000hsb.googlegroups.com>
On 28 Apr, 07:08, Lars Rune Nøstdal <···········@gmail.com> wrote:
> globalrev wrote:
> > if i have some very useful functions and macros and a lot of them
> > saved in a file,
>
> > can i then load these automatically every time SLIME starts somehow?
>
> > so that they are practically a constant extension of the language.
>
> http://www.sbcl.org/manual/Initialization-Files.html
>
> you might be looking for ~/.sbclrc
>
> --
> Lars Rune Nøstdalhttp://nostdal.org/

i dont have that file. or  any of them. is there no wya i can tell
emacs to lauch a mylisp.lisp at start?
From: Thomas A. Russ
Subject: Re: extend the language permanently?
Date: 
Message-ID: <ymiabjdfcsm.fsf@blackcat.isi.edu>
globalrev <·········@yahoo.se> writes:

> On 28 Apr, 07:08, Lars Rune N��stdal <···········@gmail.com> wrote:
> > globalrev wrote:
> > > if i have some very useful functions and macros and a lot of them
> > > saved in a file,
> >
> > > can i then load these automatically every time SLIME starts somehow?
> >
> > > so that they are practically a constant extension of the language.
> >
> > http://www.sbcl.org/manual/Initialization-Files.html
> >
> > you might be looking for ~/.sbclrc
> >
> > --
> > Lars Rune N��stdalhttp://nostdal.org/
> 
> i dont have that file. or  any of them. is there no wya i can tell
> emacs to lauch a mylisp.lisp at start?

You need to find the proper name for the initialization file for the
underlying lisp implementation you are using and then create that file.
In that file, you put the things you want to have happen when your lisp
starts up.

So if you are using SBCL, you need to create the .sbclrc file in your
home directory and put the lisp code in there.

I'm not sure what you mean by "launch" in your request.  If you want to
have the contents of "mylisp.lisp" LOADed at startup time, you can do
one of two things:

1)  Put the contents of the "mylisp.lisp" file in the appropriately
    named initialization file.

2)  Put (load "mylisp.lisp") in the initialization file.

Option #2 is superior if you plan to use different lisp implementations
since you can then keep the code you want to load in one place and just
have each initialization file load that code, instead of having to
repeat the code in each implementation's separate init file.

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Pascal J. Bourguignon
Subject: Re: extend the language permanently?
Date: 
Message-ID: <7ciqy13v9o.fsf@pbourguignon.anevia.com>
globalrev <·········@yahoo.se> writes:

> n 28 Apr, 07:08, Lars Rune N�stdal <···········@gmail.com> wrote:
>> globalrev wrote:
>> > if i have some very useful functions and macros and a lot of them
>> > saved in a file,
>>
>> > can i then load these automatically every time SLIME starts somehow?
>>
>> > so that they are practically a constant extension of the language.
>>
>> http://www.sbcl.org/manual/Initialization-Files.html
>>
>> you might be looking for ~/.sbclrc
>>
>> --
>> Lars Rune N�stdalhttp://nostdal.org/
>
> i dont have that file. or  any of them. 

So what?  Can't you type C-x C-f ~/.sbclrc RET ?

> is there no wya i can tell
> emacs to lauch a mylisp.lisp at start?

No.  Because emacs talks emacs lisp, not Common Lisp. However, if you
install emacs-cl, which is a Common Lisp implementation written in
emacs lisp, then you will be able to run mylisp.lisp in emacs.

That's why we're telling you to use ~/.sbclrc if you use sbcl, or
~/.clisprc.lisp if you use clisp.


Note also that the lisp process doesn't necessarily start when you
start slime.  With slime, you can connect to an existing lisp process.
So what you really want, is to load mylisp.lisp when you start the
lisp process. Happily, sbcl automatically loads ~/.sbclrc, and clisp
automatically load ~/.clisprc.lisp when they start.

Similarly, emacs automatically loads ~/.emacs when it starts, but
again, since it is emacs lisp and not Common Lisp, it may not be too
useful for you right now.


I'll just mention it now, but don't bother with that for now, you'll
come back to it in a few months when you'll know more about Common
Lisp programming, but to "extend the language permanently", you could
also load your functions and save the lisp image (with sbcl
sb-ext:save-lisp-and-die or clisp ext:saveinitmem), and then launch it
with that saved image, instead of the normal image.  Then you'd have
your function in the lisp image without even a need to load them from
the rc file.

-- 
__Pascal Bourguignon__
From: Barry Fishman
Subject: Re: extend the language permanently?
Date: 
Message-ID: <m3abjcwt52.fsf@barry_fishman.acm.org>
···@informatimago.com (Pascal J. Bourguignon) writes:

> globalrev <·········@yahoo.se> writes:
>
>> n 28 Apr, 07:08, Lars Rune Nøstdal <···········@gmail.com> wrote:
>>> globalrev wrote:
>>> > if i have some very useful functions and macros and a lot of them
>>> > saved in a file,
>>>
>>> > can i then load these automatically every time SLIME starts somehow?
>>>
>>> > so that they are practically a constant extension of the language.
>>>

Now that everyone has explained why you shouldn't do this, I guess its
time for someone to show how to do it anyway.

Slime (at least the CVS version) has the function:

  (slime-start-and-load filename package)

to set you up with a file loaded and in the given package.  Assuming
you have in your ~/.emacs file something like:

  (setq inferior-lisp-program "sbcl --noinit")
  (add-to-list 'load-path "_the path of your `slime' directory_")
  (require 'slime)
  (slime-setup)

You can add:

  (defun try-slime ()
    (interactive)
    (slime-start-and-load (expand-file-name "~/.slimerc.lisp") "CL-USER"))

Its probably best to ask slime questions on the slime mailing list,
where there are people better at slime than me.

-- 
Barry Fishman