7

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
  • 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. Commented May 3, 2018 at 7:46

1 Answer 1

2

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) 
Sign up to request clarification or add additional context in comments.

1 Comment

It's a good idea, but it didn't work for me as written. However, by doing (setq slime-lisp-implementations '((sbcl ("/usr/local/bin/sbcl" "--load" "start.lisp")))) I was able to get it to actually consider the --load argument. The only missing part of the puzzle now is getting emacs to run some commands after the lisp is done with its script + loading swank. I'm sure there's some hook or something?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.