1

I've been using SLIME mode with the quicklisp slime helper, and I load the package with the following code (in my .emacs):

(load (expand-file-name slime-helper-path))
(setq inferior-lisp-program "sbcl")
(require 'slime-autoloads)

However, I noticed that the load uses a lot of startup time. I'd like to only call that code when I open a lisp file (and not on startup), or when I call the slime function. How could I do that ?

3
  • 1
    Check out autoload.
    – Dan
    Nov 6, 2017 at 18:58
  • Not too clear (to me). You seem to be saying that (1) you want to use slime before you visit any Lisp file, (2) you cannot use slime without first loading the helper file, and (3) you don't want to load the helper file until you visit a Lisp file. That's sounds logically impossible. Please try to clarify the problem/question.
    – Drew
    Nov 6, 2017 at 19:07
  • @Drew Sorry my question is indeed quite unclear. I only meant (2) and (3). However, Dan's solution with using autoload solves it. Nov 6, 2017 at 19:16

1 Answer 1

1

Thanks to @Dan for suggesting to use autoload.

Instead of detecting the file type, I binded the load to the slime function, like this:

(autoload 'slime "path/to/slime-helper.el "Launch SLIME" t nil)

Evaluating this expression tells Emacs to automatically load the library slime-helper.el from load-path, when slime is called for the first time—either from Lisp, or interactively with M-x slime.

(modified source)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.