Permalink
Browse files

whitespace cleanup

  • Loading branch information...
1 parent 74f51df commit 9371b0edd59004e17d975825486e4dd1867053c3 @3b committed Apr 4, 2012
Showing with 76 additions and 75 deletions.
  1. +9 −9 slime-proxy.el
  2. +19 −19 swank-proxy-implementation.lisp
  3. +48 −47 wsproxy.lisp
View
@@ -27,7 +27,7 @@
;; FIXME: use a per-buffer variable instead of a per-connection variable
(let* ((slime-dispatching-connection (slime-proxy-connection)))
(slime-connection-proxy-output-buffer)))
-
+
(defun slime-proxy-connection ()
"Returns the most relevant proxy connection."
@@ -66,7 +66,7 @@ launch a REPL for the proxy."
;; now create the swank-side proxy listener
(slime-eval-async
`(swank:create-proxy-listener ,(slime-channel.id channel) ,target)
- (slime-rcurry
+ (slime-rcurry
(lambda (result channel)
(let ((slime-dispatching-connection (slime-connection)))
(destructuring-bind (remote thread-id package prompt) result
@@ -122,7 +122,7 @@ launch a REPL for the proxy."
(slime-send `(:emacs-channel-send
,slime-proxy-most-recent-channel-id
(:proxy (:emacs-rex ,form ,package ,thread ,id))) )
-
+
;; wrap the continuation to execute in the proxy's environment
(lexical-let* ((original continuation)
(wrapped (lambda (result)
@@ -131,17 +131,17 @@ launch a REPL for the proxy."
(funcall original result))))))
(push (cons id wrapped)
(slime-rex-continuations)))
- ;(message "adjusted continuations (added %i for %s): %s"
+ ;(message "adjusted continuations (added %i for %s): %s"
; id (slime-connection) (mapcar 'car (slime-rex-continuations)))
(slime-recompute-modelines)))
((:buffer-first-change)
nil)
((:operator-arglist )
(message "slime-proxy ignorning slime: %s" event)
nil)
- ;;; fixme dont have proxy-event caught in two places. Use
- ;;; only the one below, and get rid of the if/else separating
- ;;; these.
+;;; fixme dont have proxy-event caught in two places. Use
+;;; only the one below, and get rid of the if/else separating
+;;; these.
((:proxy-event wrapped-event package prompt-string)
(case wrapped-event
(:new-package
@@ -198,14 +198,14 @@ launch a REPL for the proxy."
(defun slime-show-arglist-ps ()
(let ((op (slime-operator/form-before-point)))
- (when op
+ (when op
(slime-eval-async `(swank:operator-arglist ,op ,(slime-current-package))
(lambda (arglist)
(when arglist
(slime-message "%s" arglist)))))))
(defun slime-operator/form-before-point ()
- (ignore-errors
+ (ignore-errors
(save-excursion
(backward-up-list 1)
(down-list 1)
@@ -37,11 +37,11 @@ evaluated by PROXY-EVAL-FOR-EMACS."))
;; by default, simply call the continuation and return :async
(format t "unknown proxy-eval command ~s or proxy target ~s~%" (cons op args) proxy-target)
#++(when cont
- (funcall cont nil nil))
+ (funcall cont nil nil))
:async
#+nil
:pass
- (format nil "unknown proxy-eval command ~s or proxy target ~s~%" op proxy-target))
+ (format nil "unknown proxy-eval command ~s or proxy target ~s~%" op proxy-target))
(defmacro define-proxy-fun (name target (&rest args) &body body)
"Defines a method for proxy-eval with NAME and TARGET as eql
@@ -52,8 +52,8 @@ lambda-list to destructure whatever remaining parameters are passed to
proxy-eval. "
(let ((rest (gensym)))
`(defmethod proxy-eval ((op (eql ',name)) (target (eql ',target)) continuation &rest ,rest)
- (destructuring-bind (,args) ,rest
- ,@body))))
+ (destructuring-bind (,args) ,rest
+ ,@body))))
(defgeneric proxy-eval-form (form target continuation)
(:documentation ""))
@@ -89,7 +89,7 @@ form, uses PROXY-EVAL-FORM"
;; fixme what about the not-okay case?
(with-dynamic-bindings-for-proxy-eval ()
(run-hook *pre-reply-hook*)
- ;(format t "About to send to emacs: ~A~%" result)
+ ;(format t "About to send to emacs: ~A~%" result)
(send-to-emacs `(:return ,thread
,(if ok
`(:ok ,result)
@@ -100,7 +100,7 @@ form, uses PROXY-EVAL-FORM"
(let (ok result)
(unwind-protect
(with-dynamic-bindings-for-proxy-eval ()
- ;; APPLY would be cleaner than EVAL.
+ ;; APPLY would be cleaner than EVAL.
;; (setq result (apply (car form) (cdr form)))
(setq result
(with-slime-interrupts (proxy-eval-form form (channel-target channel)
@@ -109,7 +109,7 @@ form, uses PROXY-EVAL-FORM"
(when (eql result :pass)
(setf result
(eval-for-emacs form *buffer-package* id))))
-
+
(when (not (eq result :async))
(cont ok result))))))))
@@ -123,16 +123,16 @@ form, uses PROXY-EVAL-FORM"
#+nil(format t "proxy ~s~%" (list channel args))
(case (car args)
(:emacs-rex
- (destructuring-bind (form package thread id &rest r) (cdr args)
- (declare (ignore r))
- ;;(format t "form ~s~% package ~s~% id ~S~%" form package id)
- (proxy-eval-for-emacs form channel thread package id)
- #++(let ((swank-backend::*proxy-interfaces* (make-hash-table)))
- (eval-for-emacs form package id))))))
+ (destructuring-bind (form package thread id &rest r) (cdr args)
+ (declare (ignore r))
+ ;;(format t "form ~s~% package ~s~% id ~S~%" form package id)
+ (proxy-eval-for-emacs form channel thread package id)
+ #++(let ((swank-backend::*proxy-interfaces* (make-hash-table)))
+ (eval-for-emacs form package id))))))
;; SPAWN-PROXY-THREAD and CREATE-PROXY-LISTENER set up the swank-proxy
-;; thread that listens in on SWANK events and
+;; thread that listens in on SWANK events and
(defgeneric proxy-create-channel (target &key remote)
(:documentation "Returns an instance of a proxy-channel connected to
the given remote instance.
@@ -195,7 +195,7 @@ backend. Returns the thread of the swank proxy server "
(maybe-setf *swank-proxy-thread*
(bordeaux-threads:make-thread
(lambda ()
- (unwind-protect
+ (unwind-protect
(run-swank-proxy-loop channel emacs-connection)
(when (eql *swank-proxy-channel* channel)
(setf *swank-proxy-channel* nil))))
@@ -210,10 +210,10 @@ backend. Returns the thread of the swank proxy server "
(with-top-level-restart (connection (go start))
(with-connection (connection)
(loop
- (destructure-case (wait-for-event `(:emacs-channel-send . _))
- ((:emacs-channel-send c (selector &rest args))
- (assert (eq c channel))
- (channel-send channel selector args))))))))
+ (destructure-case (wait-for-event `(:emacs-channel-send . _))
+ ((:emacs-channel-send c (selector &rest args))
+ (assert (eq c channel))
+ (channel-send channel selector args))))))))
;;; eval-and-grab-output
View
@@ -30,7 +30,7 @@
(defun active-client-limit-ip (client)
(if *allowed-active-client-ip*
(string= (clws:client-host client)
- *allowed-active-client-ip*)
+ *allowed-active-client-ip*)
t))
;; hook for validating 'active' clients
@@ -104,7 +104,7 @@ to do with swank proxy."
`("MESSAGE"
,message
,@(when image
- (list "IMG" image))))
+ (list "IMG" image))))
s))))
(defun log-to-active (res message &key image)
@@ -165,22 +165,23 @@ variable. If not set, \"/swank\" or any resource starting with
(defun valid-data-url (string)
(labels ((base64chars (start)
- (loop for i from start below (length string)
- for c = (aref string i)
- ;; a-z A-Z 0-9 _-
- always (or (char<= #\a c #\z)
- (char<= #\A c #\Z)
- (char<= #\0 c #\9)
- ;; not sure exactly which set of
- ;; characters is valid, possibly should
- ;; at least reject whitespace?
- (char= c #\_)
- (char= c #\-)
- (char= c #\/)
- (char= c #\+)
- (char= c #\=)
- (char= c #\space)
- (char= c #\linefeed))))
+ (loop
+ for i from start below (length string)
+ for c = (aref string i)
+ ;; a-z A-Z 0-9 _-
+ always (or (char<= #\a c #\z)
+ (char<= #\A c #\Z)
+ (char<= #\0 c #\9)
+ ;; not sure exactly which set of
+ ;; characters is valid, possibly should
+ ;; at least reject whitespace?
+ (char= c #\_)
+ (char= c #\-)
+ (char= c #\/)
+ (char= c #\+)
+ (char= c #\=)
+ (char= c #\space)
+ (char= c #\linefeed))))
(try-type (type)
(and (alexandria:starts-with-subseq type string)
(base64chars (length type)))))
@@ -233,21 +234,21 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
(log-to-active res (format nil "image [~s]" (position client (resource-clients res))) :image message))
((eql client (active-client res))
(let* ((string-for-emacs (format nil "[~s] ~s~%" (position client (resource-clients res)) message))
- (r (ignore-errors (yason:parse message)))
- (result (when (and r (hash-table-p r)) (gethash "RESULT" r)))
- (id (when (and r (hash-table-p r)) (gethash "ID" r)))
- (err (when (and r (hash-table-p r)) (gethash "ERROR" r))))
- #++(format t "got frame ~s (~s)~%" data s)
- (splog "got response ~s . ~s / ~s~%" result id err)
- (if id
- (let ((cont (gethash id *continuations*)))
- (if cont
- (if err
- (funcall cont nil err)
- (funcall cont t result))
- #++(format t "got cont id ~s but no cont?~%" id))
- (remhash id *continuations*))
- (swank::send-to-emacs `(:write-string ,string-for-emacs :proxy)))))
+ (r (ignore-errors (yason:parse message)))
+ (result (when (and r (hash-table-p r)) (gethash "RESULT" r)))
+ (id (when (and r (hash-table-p r)) (gethash "ID" r)))
+ (err (when (and r (hash-table-p r)) (gethash "ERROR" r))))
+ #++(format t "got frame ~s (~s)~%" data s)
+ (splog "got response ~s . ~s / ~s~%" result id err)
+ (if id
+ (let ((cont (gethash id *continuations*)))
+ (if cont
+ (if err
+ (funcall cont nil err)
+ (funcall cont t result))
+ #++(format t "got cont id ~s but no cont?~%" id))
+ (remhash id *continuations*))
+ (swank::send-to-emacs `(:write-string ,string-for-emacs :proxy)))))
(t
(let* ((string-for-emacs (format nil "[~s] ~s~%" (position client (resource-clients res)) message)))
(log-to-active res string-for-emacs)
@@ -330,20 +331,20 @@ okay or not, and (2) the result."
(maybe-kill *swank-proxy-ws-thread* )
(maybe-kill *swank-proxy-resource-thread*)
- (let ((con swank::*emacs-connection*))
- (maybe-setf *swank-proxy-ws-thread*
- (bordeaux-threads:make-thread
- (lambda ()
- (swank::with-connection (con)
- (ws:run-server port)))
- :name "swank-proxy websockets server"))
-
- (maybe-setf *swank-proxy-resource-thread*
- (bordeaux-threads:make-thread
- (lambda ()
- (swank::with-connection (con)
- (run-swank-proxy-resource-server)))
- :name "swank-proxy resource handler"))))
+ (let ((con swank::*emacs-connection*))
+ (maybe-setf *swank-proxy-ws-thread*
+ (bordeaux-threads:make-thread
+ (lambda ()
+ (swank::with-connection (con)
+ (ws:run-server port)))
+ :name "swank-proxy websockets server"))
+
+ (maybe-setf *swank-proxy-resource-thread*
+ (bordeaux-threads:make-thread
+ (lambda ()
+ (swank::with-connection (con)
+ (run-swank-proxy-resource-server)))
+ :name "swank-proxy resource handler"))))
(list *swank-proxy-ws-thread* *swank-proxy-resource-thread*))
(defun run-swank-proxy-resource-server ()

0 comments on commit 9371b0e

Please sign in to comment.