start emacs, load slime and one .lisp file

Discussion of programming Lisps using Emacs, including SLIME and other tools
Post Reply
sycamorex
Posts: 15
Joined: Sat Oct 08, 2011 4:05 am

start emacs, load slime and one .lisp file

Post by sycamorex » Sun Oct 09, 2011 4:51 am

Hi there.

I'm new to Lisp. I've been playing with clisp and emacs (+slime). I follow The Land of Lisp. It's a bit annoying to start emacs, load slime and then load my file game.lisp each time. I'm sure it can be automated either in shell (bash) or on the emacs level (.emacs). Ideally, as I said, I'd start emacs, load slime and load that particular file into slime automatically. How would I go about doing it?

On a separate note, I have noticed that I can only load a file into slime (load "game.lisp") if I start emacs from that particular directory. Obviously it makes sense, but when I try to:

Code: Select all

(load "/absolute/path/to/my/lisp/file") 
It complains that the file isn't found.


Thank you

Kompottkin
Posts: 94
Joined: Mon Jul 21, 2008 7:26 am
Location: München, Germany
Contact:

Re: start emacs, load slime and one .lisp file

Post by Kompottkin » Sun Oct 09, 2011 3:37 pm

It depends on your SLIME setup, but you usually don't need to use the load function at the REPL. Try opening your file in Emacs with SLIME loaded and hitting either C-c C-l (slime-load-file) or C-c C-k (slime-compile-and-load-file).

Regarding automatic Emacs session setup on startup, Emacs' desktop-save-mode might prove useful.

sycamorex
Posts: 15
Joined: Sat Oct 08, 2011 4:05 am

Re: start emacs, load slime and one .lisp file

Post by sycamorex » Mon Oct 10, 2011 10:51 am

Thanks. I'll look into it.

arvid
Posts: 4
Joined: Sat Mar 07, 2009 8:23 am

Re: start emacs, load slime and one .lisp file

Post by arvid » Fri May 04, 2012 6:43 pm

you can specify e-lisp function calls in the emacs command line.

so to start emacs with slime make a shortcut with the following

emacs --funcall=slime

for example by emacs-slime shortcut
/usr/bin/emacs-snapshot -g 162x51+15+0 %F --funcall=split-window-horizontally --funcall=slime

As for loading the file automatically, you could change .emacs to

Code: Select all

(eval-after-load "slime"
  '(progn (slime-load-file "/path/to/file/myfile.lisp"))
or you could define a no parameter e-lisp function in .emacs to load the file and --funcall it on the command-line.

Post Reply