Use namespaces in critical path
This commit is contained in:
parent
aed21575b8
commit
f4e9f1c10a
@ -146,7 +146,10 @@ endfunction
|
|||||||
|
|
||||||
function! s:nrepl_eval(expr, ...) dict abort
|
function! s:nrepl_eval(expr, ...) dict abort
|
||||||
let payload = {"op": "eval"}
|
let payload = {"op": "eval"}
|
||||||
let payload.code = '(try (eval ''(do '.a:expr."\n".')) (catch Exception e (print (apply str (interleave (repeat "\b") (map str (.getStackTrace e))))) (throw e)))'
|
let payload.code = '(try (clojure.core/eval ''(do '.a:expr."\n".'))' .
|
||||||
|
\ ' (catch Exception e' .
|
||||||
|
\ ' (clojure.core/print (clojure.core/apply clojure.core/str (clojure.core/interleave (clojure.core/repeat "\b") (clojure.core/map clojure.core/str (.getStackTrace e)))))' .
|
||||||
|
\ ' (throw e)))'
|
||||||
let options = a:0 ? a:1 : {}
|
let options = a:0 ? a:1 : {}
|
||||||
if has_key(options, 'ns')
|
if has_key(options, 'ns')
|
||||||
let payload.ns = options.ns
|
let payload.ns = options.ns
|
||||||
|
@ -283,14 +283,14 @@ function! s:oneoff.eval(expr, options) dict abort
|
|||||||
let java_cmd = exists('$JAVA_CMD') ? $JAVA_CMD : 'java'
|
let java_cmd = exists('$JAVA_CMD') ? $JAVA_CMD : 'java'
|
||||||
let command = java_cmd.' -cp '.shellescape(self.classpath).' clojure.main -e ' .
|
let command = java_cmd.' -cp '.shellescape(self.classpath).' clojure.main -e ' .
|
||||||
\ shellescape(
|
\ shellescape(
|
||||||
\ '(binding [*out* (java.io.FileWriter. '.s:str(s:oneoff_out).')' .
|
\ '(clojure.core/binding [*out* (java.io.FileWriter. '.s:str(s:oneoff_out).')' .
|
||||||
\ ' *err* (java.io.FileWriter. '.s:str(s:oneoff_err).')]' .
|
\ ' *err* (java.io.FileWriter. '.s:str(s:oneoff_err).')]' .
|
||||||
\ ' (try' .
|
\ ' (try' .
|
||||||
\ ' (require ''clojure.repl) '.ns.'(spit '.s:str(s:oneoff_pr).' (pr-str (eval (read-string (slurp '.s:str(s:oneoff_in).')))))' .
|
\ ' (clojure.core/require ''clojure.repl) '.ns.'(clojure.core/spit '.s:str(s:oneoff_pr).' (clojure.core/pr-str (clojure.core/eval (clojure.core/read-string (clojure.core/slurp '.s:str(s:oneoff_in).')))))' .
|
||||||
\ ' (catch Exception e' .
|
\ ' (catch Exception e' .
|
||||||
\ ' (spit *err* (.toString e))' .
|
\ ' (clojure.core/spit *err* (.toString e))' .
|
||||||
\ ' (spit '.s:str(s:oneoff_ex).' (class e))' .
|
\ ' (clojure.core/spit '.s:str(s:oneoff_ex).' (clojure.core/class e))' .
|
||||||
\ ' (spit '.s:str(s:oneoff_stk).' (apply str (interpose "\n" (.getStackTrace e))))))' .
|
\ ' (clojure.core/spit '.s:str(s:oneoff_stk).' (clojure.core/apply clojure.core/str (clojure.core/interpose "\n" (.getStackTrace e))))))' .
|
||||||
\ ' nil)')
|
\ ' nil)')
|
||||||
let wtf = system(command)
|
let wtf = system(command)
|
||||||
let result = {}
|
let result = {}
|
||||||
@ -886,7 +886,7 @@ endfunction
|
|||||||
function! s:Lookup(ns, macro, arg) abort
|
function! s:Lookup(ns, macro, arg) abort
|
||||||
" doc is in clojure.core in older Clojure versions
|
" doc is in clojure.core in older Clojure versions
|
||||||
try
|
try
|
||||||
call foreplay#eval("(require '".a:ns.") (eval (list (if (ns-resolve 'clojure.core '".a:macro.") 'clojure.core/".a:macro." '".a:ns.'/'.a:macro.") '".a:arg.'))')
|
call foreplay#eval("(require '".a:ns.") (clojure.core/eval (list (if (ns-resolve 'clojure.core '".a:macro.") 'clojure.core/".a:macro." '".a:ns.'/'.a:macro.") '".a:arg.'))')
|
||||||
catch /^Clojure:/
|
catch /^Clojure:/
|
||||||
catch /.*/
|
catch /.*/
|
||||||
echohl ErrorMSG
|
echohl ErrorMSG
|
||||||
|
Loading…
Reference in New Issue
Block a user