emacslispcommon-lispswank

How to make swank working with stumpw?


I've added this code snippet to my stumpwmrc file:

(defun load-swank ()
  "Load a swank server"
  (ql:quickload 'swank)
  (require 'swank)
  (setq swank:*use-dedicated-output-stream* nil)
  (setq slime-net-coding-system 'utf-8-unix)
  (swank:create-server :port 4006))
(load-swank)

I am expecting to open a socket server, accepting the "swank" protocol. Thus I could connect to it with emacs (thanks to Slime).

But when I login and and stumpwm is reading its configuration file, here is the error message I get:

15:00:34 Outputting a message:
         ^B^1*Error loading ^b/home/ybaumes/.stumpwmrc^B: ^nThe name "SWANK" does not designate any package.

How can I fix that? I invoke 'require, or even 'quickload functions. What's the issue here?


Solution

  • A typical error is this:

    You load the file and the reader sees the code:

    SWANK is not loaded

    (defun load-swank ()
      "Load a swank server"
    

    SWANK is not loaded

      (ql:quickload 'swank)
    

    SWANK is not loaded - remember, we are still reading the form.

      (require 'swank)
    

    SWANK is not loaded - remember, we are still reading the form.

    Now use us a symbol in package which is not existing... the reader complains:

      (setq swank:*use-dedicated-output-stream* nil)  ; the package SWANK does not exist yet.
    
      (setq slime-net-coding-system 'utf-8-unix)
      (swank:create-server :port 4006))
    

    Now you want to load SWANK:

    (load-swank)
    

    You can't use a symbol from a package which does not exist.

    For example what works is this inside the function:

    (setf (symbol-value (read-from-string "swank:*use-dedicated-output-stream*")) nil)
    

    and so on.

    You need to find the symbol at runtime of that function. Use (find-symbol "FOO" "SWANK") (remember Common Lisp is upcase internally) or (read-from-string "SWANK::FOO").