15af562c7bca

Rename a few macros to play nicer
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 05 Dec 2015 20:27:18 +0000
parents c24e85a0b4c0
children dcaf8468adb1
branches/tags (none)
files nrepl.asd src/middleware/core.lisp src/middleware/describe.lisp src/middleware/documentation.lisp src/middleware/eval.lisp src/middleware/session.lisp src/utils.lisp src/workarounds.lisp

Changes

--- a/nrepl.asd	Thu Dec 03 15:25:32 2015 +0000
+++ b/nrepl.asd	Sat Dec 05 20:27:18 2015 +0000
@@ -26,8 +26,10 @@
                                               "middleware"))
                  (:module "middleware"
                   :depends-on ("utils")
+                  :serial t
                   :components
-                  ((:file "describe")
+                  ((:file "core")
+                   (:file "describe")
                    (:file "documentation")
                    (:file "eval")
                    (:file "session")))))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/middleware/core.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -0,0 +1,4 @@
+(in-package #:nrepl)
+
+(defvar *middleware* (fset:empty-map))
+
--- a/src/middleware/describe.lisp	Thu Dec 03 15:25:32 2015 +0000
+++ b/src/middleware/describe.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -6,7 +6,7 @@
             "incremental" incremental
             "version-string" (format nil "~d.~d.~d" major minor incremental)))
 
-(defmiddleware wrap-describe "describe" message
+(define-middleware wrap-describe "describe" message
   (respond message
            (make-map "status" '("done")
                      "versions" (make-map
--- a/src/middleware/documentation.lisp	Thu Dec 03 15:25:32 2015 +0000
+++ b/src/middleware/documentation.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -16,7 +16,7 @@
                           (find-package pack)
                           *package*)))))
 
-(defmiddleware wrap-documentation "documentation" message
+(define-middleware wrap-documentation "documentation" message
   (let* ((s (find-symbol-harder (fset:lookup message "symbol"))))
     (respond message
              (with-when
--- a/src/middleware/eval.lisp	Thu Dec 03 15:25:32 2015 +0000
+++ b/src/middleware/eval.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -35,7 +35,7 @@
                   :text "Malformed input!"
                   :orig e))))
 
-(defmiddleware wrap-eval "eval" message
+(define-middleware wrap-eval "eval" message
   (let* ((code (fset:lookup message "code"))
          (captured-out (flex:make-in-memory-output-stream))
          (captured-err (flex:make-in-memory-output-stream))
--- a/src/middleware/session.lisp	Thu Dec 03 15:25:32 2015 +0000
+++ b/src/middleware/session.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -44,16 +44,16 @@
            (*session* session))
       (funcall h (fset:with message "session" session-id)))))
 
-(defmiddleware wrap-session-ls "ls-sessions" message
+(define-middleware wrap-session-ls "ls-sessions" message
   (respond message
            (make-map "status" '("done")
                      "sessions" (get-sessions))))
 
-(defmiddleware wrap-session-close "close" message
+(define-middleware wrap-session-close "close" message
   (remove-session! (fset:lookup message "session"))
   (respond message (make-map "status" '("session-closed"))))
 
-(defmiddleware wrap-session-clone "clone" message
+(define-middleware wrap-session-clone "clone" message
   (let ((new-id (register-session! (random-uuid)
                                    (fset:lookup message "session"))))
     (respond message (make-map "status" '("done") "new-session" new-id))))
--- a/src/utils.lisp	Thu Dec 03 15:25:32 2015 +0000
+++ b/src/utils.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -102,10 +102,9 @@
      (progn ,@body)
      (funcall ,fallback ,message)))
 
-(defmacro defmiddleware (name op message-binding &rest body)
+(defmacro define-middleware (name op message-binding &rest body)
   (let ((fallback (gensym)))
   `(defun ,name (,fallback)
      (lambda (,message-binding)
        (handle-op ,message-binding ,op ,fallback
                   ,@body)))))
-
--- a/src/workarounds.lisp	Thu Dec 03 15:25:32 2015 +0000
+++ b/src/workarounds.lisp	Sat Dec 05 20:27:18 2015 +0000
@@ -17,7 +17,7 @@
        (respond ,message (make-map "status" '("done"))))
      (funcall ,fallback ,message)))
 
-(defmacro defworkaround (name op message-binding &rest body)
+(defmacro define-workaround (name op message-binding &rest body)
   (let ((fallback (gensym)))
     `(defun ,name (,fallback)
        (lambda (,message-binding)
@@ -26,32 +26,32 @@
            ,@body)))))
 
 
-(defworkaround workaround-fireplace-classpath "eval" message
+(define-workaround workaround-fireplace-classpath "eval" message
   (workaround-matches
     '("(do (println \"success\") "
       "(symbol (str (System/getProperty \"path.separator\") "
       "(System/getProperty \"java.class.path\"))))"))
   (respond message (make-map "value" ":")))
 
-(defworkaround workaround-fireplace-pathsep "eval" message
+(define-workaround workaround-fireplace-pathsep "eval" message
   (workaround-matches
     '("[(System/getProperty \"path.separator\") "
       "(System/getProperty \"java.class.path\")]"))
   (respond message (make-map "value" "[\"/\" \":\"]")))
 
-(defworkaround workaround-fireplace-star "eval" message
+(define-workaround workaround-fireplace-star "eval" message
   ((lambda (code)
      (member code '("(*1 1)" "(*2 2)" "(*3 3)") :test #'equal)))
   (respond message (make-map "value" "Not yet implemented, sorry :(")))
 
-(defworkaround workaround-fireplace-fakepathsep "eval" message
+(define-workaround workaround-fireplace-fakepathsep "eval" message
   ; lol what in the fuck even is this for?
   (workaround-matches
     '("[(System/getProperty \"path.separator\") "
       "(System/getProperty \"fake.class.path\")]"))
   (respond message (make-map "value" "[\"/\" \"None\"]")))
 
-(defworkaround workaround-fireplace-macroexpand-all "eval" message
+(define-workaround workaround-fireplace-macroexpand-all "eval" message
   ; this should really do a macroexpand-all but this'll have to do for now
   (starts-with "(clojure.walk/macroexpand-all (quote")
   ; TODO: Fix the extra done status message here