您可以在虚拟机中使用 quicklisp 和 swank,然后在 this tutorial 或用于虚拟化环境的端口之后转发您打开 lisp 的端口。
在虚拟机上的 lisp 中:
Welcome to Clozure Common Lisp Version 1.11-r16635 (DarwinX8664)!
CCL is developed and maintained by Clozure Associates. For more information
about CCL visit http://ccl.clozure.com. To enquire about Clozure's Common Lisp
consulting services e-mail info@clozure.com or visit http://www.clozure.com.
? (ql:quickload :swank)
To load "swank":
Load 1 ASDF system:
swank
; Loading "swank"
.....
(:SWANK)
? (swank:create-server)
;; Swank started at port: 4005.
4005
?
然后使用 slime-connect 连接到您的虚拟机 ip 和您为 swank-server 选择的端口。
在其他情况下,ssh 也很容易。如果你想使用 ssh 连接到一台远程机器上的一个端口,简单的方法是使用 -L 选项,像这样
ssh user@ip -p22 -L local_port:localhost:remote_port
然后你使用 slime-connect 并连接到 localhost 和 local_port
这是一个使用 vagrant 的设置,只连接到机器的 ssh 来启动 swank,但你可以自动化它。
1) Vagrantfile:有转发端口和ip,还有roswell设置,你可以直接安装sbcl,这不重要但是用roswell很容易在一分钟内启动并运行lisp,这里重要的是正在运行 quicklisp。
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 4005, host: 4005
config.vm.network "private_network", ip: "192.168.33.24"
config.vm.provider "virtualbox" do |vb|
vb.name = "lisp_host"
vb.gui = false
vb.memory = "1024"
end
config.vm.provision "shell",
inline: "apt-get update
if which apt-get > /dev/null; then sudo apt-get -y install git build-essential automake libcurl4-openssl-dev;fi
git clone -b release https://github.com/roswell/roswell.git
cd roswell
sh bootstrap
./configure
make
sudo make install
sudo ros setup"
# SHELL
end
2) vagrant up amd vagrant ssh 进入机器
3) ros run -Q #安装完sbcl后可以在REPL中使用quicklisp
4) 准备 swank
2016-06-06 12:32:55 ☆ |ruby-2.2.3@laguna| Antonios-MBP in ~/learn/lisp/stackoverflow/vagrant-env
○ → vagrant ssh
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-79-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Mon Jun 6 10:26:56 UTC 2016
System load: 0.41 Processes: 84
Usage of /: 4.7% of 39.34GB Users logged in: 0
Memory usage: 12% IP address for eth0: 10.0.2.15
Swap usage: 0% IP address for eth1: 192.168.33.24
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
Last login: Mon Jun 6 10:26:56 2016 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$ ros run -Q
WARNING: Setting locale failed.
Check the following variables for correct values:
LC_CTYPE=UTF-8
LANG=en_US.UTF-8
* (ql:quickload :swank)
To load "swank":
Load 1 ASDF system:
swank
; Loading "swank"
.
(:SWANK)
* (setf swank::*loopback-interface* "192.168.33.24") ;Important to listen throught the internet IP
"192.168.33.24"
* (swank:create-server)
;; Swank started at port: 4005.
4005
5) 然后去你的emacs环境:
粘液连接
主机 192.168.33.24
4005端口
6)可能版本不同,接受它并继续
终于可以使用了
我相信这个技巧对你有用,最重要的是 swank::loopback-interface