summaryrefslogtreecommitdiff
path: root/vim/bundle/slimv/slime/start-swank.lisp
blob: 77bd3aa43e786d4a9796f486baa36c1e73ba9c13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;;; This file is intended to be loaded by an implementation to
;;; get a running swank server
;;; e.g. sbcl --load start-swank.lisp
;;;
;;; Default port is 4005

;;; For additional swank-side configurations see
;;; 6.2 section of the Slime user manual.
;;;
;;; Modified for Slimv:
;;; - don't close connection
;;; - pass swank port in environment variable

(load (merge-pathnames "swank-loader.lisp" *load-truename*))

(swank-loader:init
 :delete nil         ; delete any existing SWANK packages
 :reload nil         ; reload SWANK, even if the SWANK package already exists
 :load-contribs nil) ; load all contribs

(defun my-getenv (name &optional default)
  #+CMU
  (let ((x (assoc name ext:*environment-list*
                  :test #'string=)))
    (if x (cdr x) default))
  #-CMU
  (or
    #+Allegro (sys:getenv name)
    #+CLISP (ext:getenv name)
    #+ECL (si:getenv name)
    #+SBCL (sb-unix::posix-getenv name)
    #+LISPWORKS (lispworks:environment-variable name)
    #+CCL (ccl::getenv name)
    default))

(swank:create-server :port (parse-integer (my-getenv "SWANK_PORT" "4005"))
                     ;; if non-nil the connection won't be closed
                     ;; after connecting
                     :dont-close t)