From 49b6012f98eda8f0e907acfebe8321313313e1fa Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 13 Apr 2013 17:19:24 +0100 Subject: [PATCH] add basic deprecation warning system --- autoload/syntastic/util.vim | 10 ++++++++++ plugin/syntastic/registry.vim | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 86f7df6d..2fafc782 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -130,6 +130,16 @@ function! syntastic#util#unique(list) return keys(seen) endfunction +let s:deprecationNoticesIssued = [] +function! syntastic#util#deprecationWarn(msg) + if index(s:deprecationNoticesIssued, a:msg) >= 0 + return + endif + + call add(s:deprecationNoticesIssued, a:msg) + echomsg "syntastic: warning: " . a:msg +endfunction + let &cpo = s:save_cpo unlet s:save_cpo " vim: set et sts=4 sw=4: diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 8a1bd25c..ad3ef2c5 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -141,7 +141,7 @@ endfunction function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) if exists("g:syntastic_" . a:filetype . "_checker") && !exists("g:syntastic_" . a:filetype . "_checkers") let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker] - echomsg "syntastic: warning: variable g:syntastic_" . a:filetype . "_checker is deprecated" + call syntastic#util#deprecationWarn("variable g:syntastic_" . a:filetype . "_checker is deprecated") endif return exists("b:syntastic_checkers") || exists("g:syntastic_" . a:filetype . "_checkers") endfunction