common-lispsbclslime

Passing SBCL options to slime?


How do I increase the stack size in a slime session.

I can do it in the terminal with:

$> sbcl --control-stack-size 5

How do I do this in slime?


Solution

  • In your emacs init.el or .emacs file you can include program arguments in the settings of slime-lisp-implementations. For example:

    ;; Set available Lisp implementations
    (setq slime-lisp-implementations
          '((sbcl ("/usr/local/bin/sbcl" "--control-stack-size" "5"))
            (cmucl ("lisp"))
            (ccl ("ccl64"))
            (clisp ("clisp"))))
    

    Responding to an OP comment:

    ... will the new stack size hold if I create an executable?

    That depends on how you create the executable. You can't use save-lisp-and-die from a Slime repl, but you can use it from an SBCL repl. You can use the :save-runtime-options key argument which saves the --dynamic-space-size and --control-stack-size runtime options. E.g., you could do this from a terminal window to create an executable named my-exe with a custom control stack size:

    $ sbcl --control-stack-size 5                         \
    >      --load "my-source-file.lisp"                   \
    >      --eval "(sb-ext:save-lisp-and-die #p\"my-exe\" \
    >               :toplevel #'main                      \
    >               :executable t                         \
    >               :save-runtime-options t)"             \
    >      --eval "(quit)"