Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs and Slime startup script

Every time I start work, I fire up Emacs, M-x cd to a working directory, M-x slime to start Slime, then do run (ql:quickload 'myproject) in the slime repl, (or , load-system myproject) followed by , +p myproject to switch the current package in the repl. Lastly I run call a (start-server) in the repl to get my web server started.

I'd like for this all to be just a single Emacs keystroke or command. It's embarrassing that I have to ask this, since it's all lisp, but I can't quite figure out the interplay between Emacs and Slime here. Yet as a programmer I feel like I should automate all tedious processes - and I foresee several more steps being added to this.

I guess the tricky part is sending slime commands and then waiting for quicklisp to finish before sending the next command.

Any pointers would be appreciated!

Edit: Thanks to Svante for the C-c ~ hint, which was news to me

like image 660
Javelinapps Avatar asked May 02 '18 18:05

Javelinapps


1 Answers

On the Emacs side, you can bind a key to a command than calls slime with additional arguments:

(defun my-lisp ()
  (interactive)
  (slime (concat "sbcl --load " <path-to-your-lisp-script>)))

And in your Lisp script, for example:

(ql:quickload :my-system)
(in-package :my-package)
(start-server)
like image 64
coredump Avatar answered Sep 20 '22 13:09

coredump