6
votes

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

1
I don't use ql:quickload to load my project but , open-system (from slime-asdf, I think). Using helm or similar for typeahead is useful for this. Then C-c ~ from a project file buffer to switch working directory and package. You also could put slime on an F-key, for example. I have currently decided against coding up the entire sequence for a single project (I am usually working on more than one), because it is fast enough for me.Svante

1 Answers

2
votes

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)