Skip to content

Commit

Permalink
optimize fold caching even further
Browse files Browse the repository at this point in the history
  • Loading branch information
jceb committed Oct 9, 2011
1 parent 3ca4148 commit ea1e84e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions indent/org.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ from orgmode import fold_orgmode
fold_orgmode(allow_dirty=True)
EOF
else
"unlet! b:org_folding_cache
python << EOF
from orgmode import fold_orgmode
fold_orgmode()
Expand All @@ -55,7 +54,8 @@ EOF
let l:tmp = b:fold_expr
unlet b:fold_expr
if exists('b:org_folding_cache')
if len(b:org_folding_cache) > 3
if ! has_key(b:org_folding_cache, v:lnum) &&
\ len(b:org_folding_cache) == 3
let b:org_folding_cache = {}
endif
if ! has_key(b:org_folding_cache, v:lnum)
Expand Down Expand Up @@ -90,7 +90,6 @@ from orgmode import fold_text
fold_text(allow_dirty=True)
EOF
else
"unlet! b:org_folding_cache
python << EOF
from orgmode import fold_text
fold_text()
Expand All @@ -100,14 +99,10 @@ EOF
if exists('b:foldtext')
let l:tmp = b:foldtext
unlet b:foldtext
if exists('b:org_folding_cache')
if len(b:org_folding_cache) > 3
let b:org_folding_cache = {}
endif
if has_key(b:org_folding_cache, v:lnum) &&
if exists('b:org_folding_cache') &&
\ has_key(b:org_folding_cache, v:lnum) &&
\ len(b:org_folding_cache[v:lnum]) == 1
let add(b:org_folding_cache[v:lnum], l:tmp)
endif
call add(b:org_folding_cache[v:lnum], l:tmp)
endif
return l:tmp
endif
Expand Down

0 comments on commit ea1e84e

Please sign in to comment.