Skip to content

Commit bff179d

Browse files
committed
Bug fix: Don't complain about 'updatetime' when autoload is disabled (issue #47)
Issue #47 on GitHub: #47
1 parent 7c61b34 commit bff179d

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

autoload/xolox/easytags.vim

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: May 13, 2013
3+
" Last Change: May 19, 2013
44
" URL: http://peterodding.com/code/vim/easytags/
55

6-
let g:xolox#easytags#version = '3.3'
6+
let g:xolox#easytags#version = '3.3.1'
77

88
call xolox#misc#compat#check('easytags', 3)
99

@@ -41,34 +41,35 @@ let s:last_automatic_run = 0
4141

4242
function! xolox#easytags#autoload(event) " {{{2
4343
try
44-
if a:event =~? 'cursorhold'
45-
" Only for the CursorHold automatic command: check for unreasonable
46-
" &updatetime values. The minimum value 4000 is kind of arbitrary
47-
" (apart from being Vim's default) so I made it configurable.
48-
let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000)
49-
if &updatetime < updatetime_min
50-
if s:last_automatic_run == 0
51-
" Warn once about the low &updatetime value.
52-
call xolox#misc#msg#warn("easytags.vim %s: The 'updatetime' option has an unreasonably low value, so I'll start compensating (see the easytags_updatetime_min option).", g:xolox#easytags#version)
53-
let s:last_automatic_run = localtime()
54-
else
55-
let next_scheduled_run = s:last_automatic_run + max([1, updatetime_min / 1000])
56-
if localtime() < next_scheduled_run
57-
" It's not our time yet; wait for the next event.
58-
call xolox#misc#msg#debug("easytags.vim %s: Skipping this beat of 'updatetime' to compensate for low value.", g:xolox#easytags#version)
59-
return
60-
else
61-
call xolox#misc#msg#debug("easytags.vim %s: This is our beat of 'updatetime'!", g:xolox#easytags#version)
62-
let s:last_automatic_run = localtime()
63-
endif
64-
endif
65-
endif
66-
endif
6744
let do_update = xolox#misc#option#get('easytags_auto_update', 1)
6845
let do_highlight = xolox#misc#option#get('easytags_auto_highlight', 1) && &eventignore !~? '\<syntax\>'
6946
" Don't execute this function for unsupported file types (doesn't load
7047
" the list of file types if updates and highlighting are both disabled).
7148
if (do_update || do_highlight) && !empty(xolox#easytags#select_supported_filetypes(&ft))
49+
if a:event =~? 'cursorhold'
50+
" Only for the CursorHold automatic command: check for unreasonable
51+
" &updatetime values. The minimum value 4000 is kind of arbitrary
52+
" (apart from being Vim's default) so I made it configurable.
53+
let updatetime_min = xolox#misc#option#get('easytags_updatetime_min', 4000)
54+
if &updatetime < updatetime_min
55+
if s:last_automatic_run == 0
56+
" Warn once about the low &updatetime value.
57+
call xolox#misc#msg#warn("easytags.vim %s: The 'updatetime' option has an unreasonably low value, so I'll start compensating (see the easytags_updatetime_min option).", g:xolox#easytags#version)
58+
let s:last_automatic_run = localtime()
59+
else
60+
let next_scheduled_run = s:last_automatic_run + max([1, updatetime_min / 1000])
61+
if localtime() < next_scheduled_run
62+
" It's not our time yet; wait for the next event.
63+
call xolox#misc#msg#debug("easytags.vim %s: Skipping this beat of 'updatetime' to compensate for low value.", g:xolox#easytags#version)
64+
" Shortcut to break out of xolox#easytags#autoload().
65+
return
66+
else
67+
call xolox#misc#msg#debug("easytags.vim %s: This is our beat of 'updatetime'!", g:xolox#easytags#version)
68+
let s:last_automatic_run = localtime()
69+
endif
70+
endif
71+
endif
72+
endif
7273
" Update entries for current file in tags file?
7374
if do_update
7475
let pathname = s:resolve(expand('%:p'))

doc/easytags.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@ If you like this plug-in please vote for it on Vim Online [16].
581581
*easytags-license*
582582
License ~
583583

584-
This software is licensed under the MIT license [17]. Copyright 2013 Peter
585-
Odding <peter@peterodding.com>.
584+
This software is licensed under the MIT license [17]. Š 2013 Peter Odding
585+
<peter@peterodding.com>.
586586

587587
===============================================================================
588588
*easytags-references*

0 commit comments

Comments
 (0)