Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
142 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
### Slime proxy | ||
|
||
A hack for using slime with things like parenscript and 3bil that | ||
compile code on a host lisp then run it somewhere else. | ||
|
||
Currently only usable with parenscript, using websockets for | ||
communication between host lisp and browser. | ||
|
||
#### Requirements: | ||
* currently only works on sbcl, since clws hasn't been ported to other lisps yet | ||
* [modified parenscript](http://github.com/3b/parenscript) | ||
* [clws](http://github.com/3b/clws) | ||
* [websockets emulation](http://github.com/gimite/web-socket-js) for browsers without native support | ||
* misc libraries: ironclad, anaphora, cl-ppcre, yason | ||
|
||
#### Loading: | ||
|
||
load slime-proxy/slime-proxy.el into emacs, then `M-x eval-buffer` | ||
|
||
load/start proxy stuff (listens on port 12345 by default, adjust in wsproxy.lisp if needed) | ||
|
||
(require 'slime-proxy) | ||
(swank-proxy-ws::start-proxy-server) | ||
(swank::create-proxy-listener) | ||
|
||
adjust URLs in slime-proxy/slimy.html | ||
|
||
`/wsjs/*` → files from web-socket-js | ||
|
||
`ws://127.0.0.1:12345/` → host/port to use to connect to websocket serrver, if changed | ||
|
||
(if clients are loading page from somewhere other than localhost, add the host to the `(ws:origin-prefix "http..." ...)` form in wsproxy,lisp) | ||
|
||
load slimy.html in browser | ||
|
||
switch an emacs buffer to proxy mode: | ||
`M-: (setq slime-proxy-proxy-connection t) RET` | ||
or | ||
|
||
;;; -*- Mode: LISP; slime-proxy-proxy-connection: t -*- | ||
|
||
|
||
|
||
|
||
#### things that (mostly) work | ||
* compile/eval with `C-c C-c`, `C-c C-k`, `M-C-x`, `C-x C-e` and REPL | ||
* non-autodoc arglist display (including introspecting from browser if possible) | ||
* `M-.` | ||
* connection to multiple browsers at once (currently just sends | ||
everything to all connected browsers, so can behave a bit oddly. | ||
seems like it might be useful enough to try to figure out how to | ||
make it work sanely though) | ||
|
||
#### things that don't work | ||
* autodoc | ||
* debugger | ||
* pretty much everything else :p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
(in-package #:swank) | ||
|
||
|
||
(defun ps-arglist-dispatch (op args) | ||
(declare (ignorable args)) | ||
#++(let ((*package* (find-package :keyword))) | ||
(format t "p-a-d ~s ~s~%" op args) | ||
) | ||
(when (ps::parenscript-function-p op) | ||
;(format t "p-a-d -> ~s~%" (ps::parenscript-arglist op)) | ||
(with-available-arglist (decoded-arglist) | ||
(decode-arglist (ps::parenscript-arglist op)) | ||
#++(enrich-decoded-arglist-with-extra-keywords decoded-arglist | ||
(cons op args)) | ||
(values decoded-arglist nil nil)))) | ||
|
||
;;;; autodoc hooks | ||
;;fixme: separate this into a separate file, only load with autodoc contrib | ||
(defmethod arglist-dispatch :around (op argument) | ||
;(format t "arglist dispatch ~s / ~s~T" op argument) | ||
(when (next-method-p) | ||
(call-next-method)) | ||
#++((ps::parenscript-function-p sym) | ||
(let ((args (ps::parenscript-arglist sym))) | ||
(format t "found s function, args=~s~%" args) | ||
(cond ((eq args :not-available) nil) | ||
(t (princ-to-string (cons name args)))))) | ||
) | ||
|
||
|
||
(defmethod arglist-dispatch :around (op argument) | ||
; (format t "arglist dispatch ~s / ~s~T" op argument) | ||
(when (next-method-p) | ||
(call-next-method)) | ||
#++((ps::parenscript-function-p sym) | ||
(let ((args (ps::parenscript-arglist sym))) | ||
(format t "found s function, args=~s~%" args) | ||
(cond ((eq args :not-available) nil) | ||
(t (princ-to-string (cons name args)))))) | ||
) | ||
|
||
(defmethod arglist-dispatch (operator arguments) | ||
;(format t "--dispatch--~%") | ||
(cond | ||
((and (symbolp operator) (valid-operator-symbol-p operator)) | ||
(multiple-value-bind (decoded-arglist determining-args) | ||
(compute-enriched-decoded-arglist operator arguments) | ||
(with-available-arglist (arglist) decoded-arglist | ||
;; replace some formal args by determining actual args | ||
(setf arglist (delete-given-args arglist determining-args)) | ||
(setf (arglist.provided-args arglist) determining-args) | ||
arglist))) | ||
((find-if (lambda (hook) #++(format t "trying hook ~s~%" hook) (funcall hook operator arguments)) *arglist-dispatch-hooks*)) | ||
(t (return-from arglist-dispatch :not-available)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters