Meikel  Brandmeyer avatar Meikel Brandmeyer committed f257542

Fixed delay on o/O bug (Fixes #1)

This is a bit unfulfilling. I don't know why this fixes the issue.
Maybe the calling depth is a problem?

Comments (0)

Files changed (1)

indent/clojure.vim

 if exists("*searchpairpos")
 
 function! s:MatchPairs(open, close, stopat)
-	let closure = { 'open': a:open, 'close': a:close, 'stopat': a:stopat }
-
-	function closure.f() dict
-		" Stop only on vector and map [ resp. {. Ignore the ones in strings and
-		" comments.
-		return searchpairpos(self.open, '', self.close, 'bW',
+	" Stop only on vector and map [ resp. {. Ignore the ones in strings and
+	" comments.
+	return searchpairpos(a:open, '', a:close, 'bWn',
 				\ 'vimclojure#SynIdName() !~ "clojureParen\\d"',
-				\ self.stopat)
-	endfunction
-
-	return vimclojure#WithSavedPosition(closure)
+				\ a:stopat)
 endfunction
 
 function! VimClojureCheckForStringWorker()
 	return vimclojure#WithSavedPosition({'f': function("VimClojureCheckForStringWorker")})
 endfunction
 
-function! GetClojureIndentWorker()
+function! GetClojureIndent()
+	" Get rid of special case.
+	if line(".") == 1
+		return 0
+	endif
+
+	" We have to apply some heuristics here to figure out, whether to use
+	" normal lisp indenting or not.
+	let i = VimClojureCheckForString()
+	if i > -1
+		return i
+	endif
+
 	call cursor(0, 1)
 
 	" Find the next enclosing [ or {. We can limit the second search
 
 	" In case after the paren is a whitespace, we search for the next word.
 	normal! l
-	if vimclojure#Yank('l', 'normal! "lyl') == ' '
+	let reg = getreg("l")
+	normal! "lyl
+	if getreg("l") == ' '
 		normal! w
 	endif
+	call setreg("l", reg)
 
 	" If we moved to another line, there is no word after the (. We
 	" use the ( position for indent.
 
 	" We still have to check, whether the keyword starts with a (, [ or {.
 	" In that case we use the ( position for indent.
-	let w = vimclojure#Yank('l', 'normal! "lye')
+	let reg = getreg("l")
+	normal! "lye
+	let w = getreg("l")
+	call setreg("l", reg)
 	if stridx('([{', w[0]) > 0
 		return paren[1]
 	endif
 	return col(".") + 1
 endfunction
 
-function! GetClojureIndent()
-	" Get rid of special case.
-	if line(".") == 1
-		return 0
-	endif
-
-	" We have to apply some heuristics here to figure out, whether to use
-	" normal lisp indenting or not.
-	let i = VimClojureCheckForString()
-	if i > -1
-		return i
-	endif
-
-	return vimclojure#WithSavedPosition({'f': function("GetClojureIndentWorker")})
-endfunction
-
 setlocal indentexpr=GetClojureIndent()
 
 else
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.