Commits

Meikel Brandmeyer  committed 1abf1cb

Fix serious regression in result window handling (thanks to Wolodja Wentland)

  • Participants
  • Parent commits fdd454c

Comments (0)

Files changed (1)

File vim/autoload/vimclojure.vim

 	return call(function("vimclojure#ExecuteNailWithInput"), [a:nail, ""] + a:000)
 endfunction
 
+function! vimclojure#ShowResult(result)
+	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
+	call buf.showOutput(a:result)
+	wincmd p
+endfunction
+
+function! vimclojure#ShowClojureResult(result, nspace)
+	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
+	let b:vimclojure_namespace = a:nspace
+	call buf.showOutput(a:result)
+	wincmd p
+endfunction
+
 function! vimclojure#DocLookup(word)
 	if a:word == ""
 		return
 
 	let doc = vimclojure#ExecuteNailWithInput("DocLookup", a:word,
 				\ "-n", b:vimclojure_namespace)
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
-	call buf.showOutput(doc)
-	wincmd p
+	call vimclojure#ShowResult(doc)
 endfunction
 
 function! vimclojure#FindDoc()
 	let pattern = input("Pattern to look for: ")
 	let doc = vimclojure#ExecuteNailWithInput("FindDoc", pattern)
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
-	call buf.showOutput(doc)
-	wincmd p
+	call vimclojure#ShowResult(doc)
 endfunction
 
 let s:DefaultJavadocPaths = {
 				\ "-n", b:vimclojure_namespace)
 
 	if path.stderr != ""
-		let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
-		call buf.showOutput(path)
-		wincmd p
+		call vimclojure#ShowResult(path)
 		return
 	endif
 
 function! vimclojure#SourceLookup(word)
 	let source = vimclojure#ExecuteNailWithInput("SourceLookup", a:word,
 				\ "-n", b:vimclojure_namespace)
-	let ns = b:vimclojure_namespace
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call buf.showOutput(source)
-	wincmd p
+	call vimclojure#ShowClojureResult(source, b:vimclojure_namespace)
 endfunction
 
 function! vimclojure#MetaLookup(word)
 	let meta = vimclojure#ExecuteNailWithInput("MetaLookup", a:word,
 				\ "-n", b:vimclojure_namespace)
-	let ns = b:vimclojure_namespace
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call buf.showOutput(meta)
-	wincmd p
+	call vimclojure#ShowClojureResult(meta, b:vimclojure_namespace)
 endfunction
 
 function! vimclojure#GotoSource(word)
 				\ "-n", b:vimclojure_namespace)
 
 	if pos.stderr != ""
-		let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
-		call buf.showOutput(pos)
-		wincmd p
+		call vimclojure#ShowResult(pos)
 		return
 	endif
 
 
 	let expanded = call(function("vimclojure#ExecuteNailWithInput"), cmd)
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call buf.showOutput(expanded)
-	wincmd p
+	call vimclojure#ShowClojureResult(expanded, ns)
 endfunction
 
 function! vimclojure#RequireFile(all)
 	let require = "(require :reload" . all . " :verbose '". ns. ")"
 	let result = vimclojure#ExecuteNailWithInput("Repl", require, "-r")
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#RunTests(all)
 
 	let result = call(function("vimclojure#ExecuteNailWithInput"),
 				\ [ "RunTests", "", "-n", ns ] + (a:all ? [ "-a" ] : []))
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalFile()
 	let result = vimclojure#ExecuteNailWithInput("Repl", content,
 				\ "-r", "-n", ns, "-f", file)
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalLine()
 	let result = vimclojure#ExecuteNailWithInput("Repl", content,
 				\ "-r", "-n", ns, "-f", file, "-l", theLine)
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalBlock()
 	let result = vimclojure#ExecuteNailWithInput("Repl", content,
 				\ "-r", "-n", ns, "-f", file, "-l", line("'<") - 1)
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalToplevel()
 	let result = vimclojure#ExecuteNailWithInput("Repl", expr,
 				\ "-r", "-n", ns, "-f", file, "-l", pos[0] - 1)
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! ClojureEvalParagraphWorker() dict
 	let result = vimclojure#ExecuteNailWithInput("Repl", content,
 				\ "-r", "-n", ns, "-f", file, "-l", startPosition - 1)
 
-	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
-	let b:vimclojure_namespace = ns
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 " The Repl
 	if result.value == 0 && result.stderr == ""
 		call vimclojure#ReplDoEnter()
 	elseif result.stderr != ""
-		let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
-		call buf.showOutput(result)
+		call vimclojure#ShowResult(result)
 	else
 		let result = vimclojure#ExecuteNailWithInput("Repl", cmd,
 					\ "-r", "-i", self._id)