Page 1 of 1

start emacs, load slime and one .lisp file

Posted: Sun Oct 09, 2011 4:51 am
by sycamorex
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

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

Posted: Sun Oct 09, 2011 3:37 pm
by Kompottkin
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.

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

Posted: Mon Oct 10, 2011 10:51 am
by sycamorex
Thanks. I'll look into it.

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

Posted: Fri May 04, 2012 6:43 pm
by arvid
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.