Skip to content

Commit

Permalink
Bug fix: Guard against recursive calls to tags#load_index() (issue #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Sep 17, 2011
1 parent 528fdcb commit b38f0ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions autoload/xolox/notes.vim
@@ -1,12 +1,12 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: September 4, 2011
" Last Change: September 17, 2011
" URL: http://peterodding.com/code/vim/notes/

" Note: This file is encoded in UTF-8 including a byte order mark so
" that Vim loads the script using the right encoding transparently.

let g:xolox#notes#version = '0.11'
let g:xolox#notes#version = '0.11.1'

function! xolox#notes#shortcut() " {{{1
" The "note:" pseudo protocol is just a shortcut for the :Note command.
Expand Down
9 changes: 8 additions & 1 deletion autoload/xolox/notes/tags.vim
@@ -1,21 +1,28 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: September 4, 2011
" Last Change: September 17, 2011
" URL: http://peterodding.com/code/vim/notes/

if !exists('s:currently_tagged_notes')
let s:currently_tagged_notes = {} " The in-memory representation of tags and the notes in which they're used.
let s:previously_tagged_notes = {} " Copy of index as it is / should be now on disk (to detect changes).
let s:last_disk_sync = 0 " Whether the on-disk representation of the tags has been read.
let s:buffer_name = 'Tagged Notes' " The buffer name for the list of tagged notes.
let s:loading_index = 0
endif

function! xolox#notes#tags#load_index() " {{{1
if s:loading_index
" Guard against recursive calls.
return s:currently_tagged_notes
endif
let starttime = xolox#misc#timer#start()
let indexfile = expand(g:notes_tagsindex)
let lastmodified = getftime(indexfile)
if lastmodified == -1
let s:loading_index = 1
call xolox#notes#tags#create_index()
let s:loading_index = 0
elseif lastmodified > s:last_disk_sync
let s:currently_tagged_notes = {}
for line in readfile(indexfile)
Expand Down

0 comments on commit b38f0ee

Please sign in to comment.