# HG changeset patch # User Steve Losh # Date 1449683261 0 # Node ID d74fc3dab8fa74dc23b5ee3229b46da251c395d0 # Parent d5962bdd918626039355a9adab6c42c6fb7a2766 Add load-file and macroexpand middlewares diff -r d5962bdd9186 -r d74fc3dab8fa nrepl.asd --- a/nrepl.asd Wed Dec 09 16:00:46 2015 +0000 +++ b/nrepl.asd Wed Dec 09 17:47:41 2015 +0000 @@ -31,6 +31,8 @@ ((:file "core") (:file "describe") (:file "documentation") + (:file "load-file") + (:file "macroexpand") (:file "eval") (:file "session"))))))) diff -r d5962bdd9186 -r d74fc3dab8fa src/middleware/load-file.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/middleware/load-file.lisp Wed Dec 09 17:47:41 2015 +0000 @@ -0,0 +1,8 @@ +(in-package #:nrepl) + + +(define-middleware wrap-load-file "load-file" message + (let ((path (fset:lookup message "path"))) + (load path) + (respond message (make-map "status" '("done") + "value" "T")))) diff -r d5962bdd9186 -r d74fc3dab8fa src/middleware/macroexpand.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/middleware/macroexpand.lisp Wed Dec 09 17:47:41 2015 +0000 @@ -0,0 +1,12 @@ +(in-package #:nrepl) + +(define-middleware wrap-macroexpand "macroexpand" message + (let ((form (read-from-string (fset:lookup message "form")))) + (respond message + (make-map + "status" '("done") + "macroexpand" (format nil "~A" (macroexpand form)) + "macroexpand-1" (format nil "~A" (macroexpand-1 form)))))) + + + diff -r d5962bdd9186 -r d74fc3dab8fa src/server.lisp --- a/src/server.lisp Wed Dec 09 16:00:46 2015 +0000 +++ b/src/server.lisp Wed Dec 09 17:47:41 2015 +0000 @@ -24,6 +24,8 @@ #'workaround-fireplace-fakepathsep #'workaround-fireplace-macroexpand-all #'wrap-describe + #'wrap-load-file + #'wrap-macroexpand #'wrap-eval #'wrap-documentation))